Skip to content

Commit 837d9c9

Browse files
committed
Merge branch 'master' of https://github.com/stan-dev/docs
2 parents 9437b5c + 398e81a commit 837d9c9

File tree

1 file changed

+55
-24
lines changed

1 file changed

+55
-24
lines changed

src/functions-reference/unbounded_continuous_distributions.Rmd

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If $\mu \in \mathbb{R}$ and $\sigma \in \mathbb{R}^+$, then for $y \in
3030

3131
`y ~ ` **`normal`**`(mu, sigma)`
3232

33-
Increment target log probability density with `normal_lpdf( y | mu, sigma)`
33+
Increment target log probability density with `normal_lpdf(y | mu, sigma)`
3434
dropping constant additive terms.
3535
<!-- real; normal ~; -->
3636
\index{{\tt \bfseries normal }!sampling statement|hyperpage}
@@ -60,8 +60,9 @@ be scaled and translated for anything other than a standard normal.
6060
The log of the cumulative normal distribution of y given location mu
6161
and scale sigma; normal_lcdf will underflow to $-\infty$ for
6262
$\frac{{y}-{\mu}}{{\sigma}}$ below -37.5 and overflow to 0 for
63-
$\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; see above for discussion of
64-
`Phi_approx` as an alternative.
63+
$\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; `log(Phi_approx(...))` is more
64+
robust in the tails, but must be scaled and translated for anything other
65+
than a standard normal.
6566

6667
<!-- real; normal_lccdf; (reals y | reals mu, reals sigma); -->
6768
\index{{\tt \bfseries normal\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage}
@@ -70,8 +71,9 @@ $\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; see above for discussion of
7071
The log of the complementary cumulative normal distribution of y given
7172
location mu and scale sigma; normal_lccdf will overflow to 0 for
7273
$\frac{{y}-{\mu}}{{\sigma}}$ below -37.5 and underflow to $-\infty$
73-
for $\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; see above for discussion
74-
of `Phi_approx` as an alternative.
74+
for $\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; `log1m(Phi_approx(...))` is
75+
more robust in the tails, but must be scaled and translated for anything
76+
other than a standard normal.
7577

7678
<!-- R; normal_rng; (reals mu, reals sigma); -->
7779
\index{{\tt \bfseries normal\_rng }!{\tt (reals mu, reals sigma): R}|hyperpage}
@@ -87,7 +89,7 @@ For a description of argument and return types, see section
8789
The standard normal distribution is so-called because its parameters
8890
are the units for their respective operations---the location (mean) is
8991
zero and the scale (standard deviation) one. The standard normal is
90-
parameter free and the unit parameters allow considerable
92+
parameter-free, and the unit parameters allow considerable
9193
simplification of the expression for the density. \[
9294
\text{StdNormal}(y) \ = \ \text{Normal}(y \mid 0, 1) \ = \
9395
\frac{1}{\sqrt{2 \pi}} \, \exp \left( \frac{-y^2}{2} \right)\!. \] Up
@@ -97,11 +99,16 @@ With no logarithm, no subtraction, and no division by a parameter, the
9799
standard normal log density is much more efficient to compute than the
98100
normal log density with constant location $0$ and scale $1$.
99101

100-
### Stan Functions
102+
### Sampling Statement
101103

102-
Only the log probabilty density function is available for the standard
103-
normal distribution; for other functions, use the `normal_` versions
104-
with parameters $\mu = 0$ and $\sigma = 1$.
104+
`y ~ ` **`std_normal`**`()`
105+
106+
Increment target log probability density with `std_normal_lpdf(y)`
107+
dropping constant additive terms.
108+
<!-- real; std_normal ~; -->
109+
\index{{\tt \bfseries std\_normal }!sampling statement|hyperpage}
110+
111+
### Stan Functions
105112

106113
<!-- real; std_normal_lpdf; (reals y); -->
107114
\index{{\tt \bfseries std\_normal\_lpdf }!{\tt (reals y): real}|hyperpage}
@@ -110,14 +117,38 @@ with parameters $\mu = 0$ and $\sigma = 1$.
110117
The standard normal (location zero, scale one) log probability density
111118
of y.
112119

113-
### Sampling Statement
120+
<!-- real; std_normal_cdf; (reals y); -->
121+
\index{{\tt \bfseries std\_normal\_cdf }!{\tt (reals y): real}|hyperpage}
114122

115-
`y ~ ` **`std_normal`**`(reals y)`
123+
`real` **`std_normal_cdf`**`(reals y)`<br>\newline
124+
The cumulative standard normal distribution of y; std_normal_cdf will
125+
underflow to 0 for $y$ below -37.5 and overflow to 1 for $y$ above 8.25;
126+
the function `Phi_approx` is more robust in the tails.
127+
128+
<!-- real; std_normal_lcdf; (reals y); -->
129+
\index{{\tt \bfseries std\_normal\_lcdf }!{\tt (reals y): real}|hyperpage}
130+
131+
`real` **`std_normal_lcdf`**`(reals y)`<br>\newline
132+
The log of the cumulative standard normal distribution of y; std_normal_lcdf
133+
will underflow to $-\infty$ for $y$ below -37.5 and overflow to 0 for $y$
134+
above 8.25; `log(Phi_approx(...))` is more robust in the tails.
135+
136+
<!-- real; std_normal_lccdf; (reals y); -->
137+
\index{{\tt \bfseries std\_normal\_lccdf }!{\tt (reals y): real}|hyperpage}
138+
139+
`real` **`std_normal_lccdf`**`(reals y)`<br>\newline
140+
The log of the complementary cumulative standard normal distribution of y;
141+
std_normal_lccdf will overflow to 0 for $y$ below -37.5 and underflow to
142+
$-\infty$ for $y$ above 8.25; `log1m(Phi_approx(...))` is more robust in the
143+
tails.
144+
145+
<!-- real; std_normal_rng; (); -->
146+
\index{{\tt \bfseries std\_normal\_rng }!{\tt (): real}|hyperpage}
147+
148+
`real` **`std_normal_rng`**`()`<br>\newline
149+
Generate a normal variate with location zero and scale one; may only
150+
be used in transformed data and generated quantities blocks.
116151

117-
Increment target log probability density with `std_normal_lpdf(y)`
118-
dropping constant additive terms.
119-
<!-- real; std_normal ~; -->
120-
\index{{\tt \bfseries std\_normal }!sampling statement|hyperpage}
121152

122153
## Normal-Id Generalised Linear Model (Linear Regression) {#normal-id-glm}
123154

@@ -138,7 +169,7 @@ If $x\in \mathbb{R}^{n\cdot m}, \alpha \in \mathbb{R}^n, \beta\in
138169

139170
`y ~ ` **`normal_id_glm`**`(x, alpha, beta, sigma)`
140171

141-
Increment target log probability density with `normal_id_glm_lpdf( y | x, alpha, beta, sigma)`
172+
Increment target log probability density with `normal_id_glm_lpdf(y | x, alpha, beta, sigma)`
142173
dropping constant additive terms.
143174
<!-- real; normal_id_glm ~; -->
144175
\index{{\tt \bfseries normal\_id\_glm }!sampling statement|hyperpage}
@@ -183,7 +214,7 @@ y}{\sqrt{2}\sigma}\right) . \]
183214

184215
`y ~ ` **`exp_mod_normal`**`(mu, sigma, lambda)`
185216

186-
Increment target log probability density with `exp_mod_normal_lpdf( y | mu, sigma, lambda)`
217+
Increment target log probability density with `exp_mod_normal_lpdf(y | mu, sigma, lambda)`
187218
dropping constant additive terms.
188219
<!-- real; exp_mod_normal ~; -->
189220
\index{{\tt \bfseries exp\_mod\_normal }!sampling statement|hyperpage}
@@ -243,7 +274,7 @@ If $\xi \in \mathbb{R}$, $\omega \in \mathbb{R}^+$, and $\alpha \in
243274

244275
`y ~ ` **`skew_normal`**`(xi, omega, alpha)`
245276

246-
Increment target log probability density with `skew_normal_lpdf( y | xi, omega, alpha)`
277+
Increment target log probability density with `skew_normal_lpdf(y | xi, omega, alpha)`
247278
dropping constant additive terms.
248279
<!-- real; skew_normal ~; -->
249280
\index{{\tt \bfseries skew\_normal }!sampling statement|hyperpage}
@@ -302,7 +333,7 @@ If $\nu \in \mathbb{R}^+$, $\mu \in \mathbb{R}$, and $\sigma \in
302333

303334
`y ~ ` **`student_t`**`(nu, mu, sigma)`
304335

305-
Increment target log probability density with `student_t_lpdf( y | nu, mu, sigma)`
336+
Increment target log probability density with `student_t_lpdf(y | nu, mu, sigma)`
306337
dropping constant additive terms.
307338
<!-- real; student_t ~; -->
308339
\index{{\tt \bfseries student\_t }!sampling statement|hyperpage}
@@ -359,7 +390,7 @@ If $\mu \in \mathbb{R}$ and $\sigma \in \mathbb{R}^+$, then for $y \in
359390

360391
`y ~ ` **`cauchy`**`(mu, sigma)`
361392

362-
Increment target log probability density with `cauchy_lpdf( y | mu, sigma)`
393+
Increment target log probability density with `cauchy_lpdf(y | mu, sigma)`
363394
dropping constant additive terms.
364395
<!-- real; cauchy ~; -->
365396
\index{{\tt \bfseries cauchy }!sampling statement|hyperpage}
@@ -427,7 +458,7 @@ a non-centered parameterization by taking \[ \beta^{\text{raw}} \sim
427458

428459
`y ~ ` **`double_exponential`**`(mu, sigma)`
429460

430-
Increment target log probability density with `double_exponential_lpdf( y | mu, sigma)`
461+
Increment target log probability density with `double_exponential_lpdf(y | mu, sigma)`
431462
dropping constant additive terms.
432463
<!-- real; double_exponential ~; -->
433464
\index{{\tt \bfseries double\_exponential }!sampling statement|hyperpage}
@@ -484,7 +515,7 @@ If $\mu \in \mathbb{R}$ and $\sigma \in \mathbb{R}^+$, then for $y \in
484515

485516
`y ~ ` **`logistic`**`(mu, sigma)`
486517

487-
Increment target log probability density with `logistic_lpdf( y | mu, sigma)`
518+
Increment target log probability density with `logistic_lpdf(y | mu, sigma)`
488519
dropping constant additive terms.
489520
<!-- real; logistic ~; -->
490521
\index{{\tt \bfseries logistic }!sampling statement|hyperpage}
@@ -540,7 +571,7 @@ If $\mu \in \mathbb{R}$ and $\beta \in \mathbb{R}^+$, then for $y \in
540571

541572
`y ~ ` **`gumbel`**`(mu, beta)`
542573

543-
Increment target log probability density with `gumbel_lpdf( y | mu, beta)`
574+
Increment target log probability density with `gumbel_lpdf(y | mu, beta)`
544575
dropping constant additive terms.
545576
<!-- real; gumbel ~; -->
546577
\index{{\tt \bfseries gumbel }!sampling statement|hyperpage}

0 commit comments

Comments
 (0)