@@ -95,7 +95,8 @@ arguments to produce an expression, which has a value when executed.
95
95
### Functions as statements {-}
96
96
97
97
Functions with void return types may be applied to arguments and used
98
- as statements. These act like sampling statements or print
98
+ as [ statements.qmd] ( statements ) .
99
+ These act like distribution statements or print
99
100
statements. Such uses are only appropriate for functions that act
100
101
through side effects, such as incrementing the log probability
101
102
accumulator, printing, or raising exceptions.
@@ -147,12 +148,12 @@ for containers, so an array of `int` may be assigned to an array of
147
148
` real ` of the same shape. And we can also promote ` vector ` to
148
149
` complex_vector ` and similarly for row vectors and matrices.
149
150
150
- ### Probability functions in sampling statements {-}
151
+ ### Probability functions in distribution statements {-}
151
152
152
- Functions whose name ends in ` _lpdf ` or ` _lpmf ` (density
153
+ Functions whose name ends in ` _lpdf ` or ` _lpmf ` (log density
153
154
and mass functions) may be used as probability functions and may be
154
- used in place of parameterized distributions on the right-hand- side of
155
- sampling statements.
155
+ used in place of parameterized distributions on the right side of
156
+ [ statements.qmd#distribution-statements.section ] (distribution statements) .
156
157
157
158
158
159
### Restrictions on placement {-}
@@ -292,28 +293,30 @@ a function elsewhere results in a compile-time error.
292
293
293
294
### Log probability access in functions {-}
294
295
295
- Functions that include sampling statements or log probability
296
- increment statements must have a name that ends in ` _lp ` .
297
- Attempts to use sampling statements or increment log probability
296
+ Functions that include
297
+ [ statements.qmd#distribution-statements.section] (distribution statements) or
298
+ [ statements.qmd#increment-log-prob.section] (log probability increment statements)
299
+ must have a name that ends in ` _lp ` .
300
+ Attempts to use distribution statements or increment log probability
298
301
statements in other functions lead to a compile-time error.
299
302
300
- Like the target log density increment statement and sampling
303
+ Like the target log density increment statement and distribution
301
304
statements, user-defined functions with names that end in ` _lp `
302
305
may only be used in blocks where the log probability accumulator is
303
306
accessible, namely the transformed parameters and model blocks. An
304
307
attempt to use such a function elsewhere results in a compile-time
305
308
error.
306
309
307
310
308
- ### Defining probability functions for sampling statements {-}
311
+ ### Defining probability functions for distribution statements {-}
309
312
310
313
Functions whose names end in ` _lpdf ` and ` _lpmf ` (density
311
- and mass functions) can be used as probability functions in sampling
314
+ and mass functions) can be used as probability functions in distribution
312
315
statements. As with the built-in functions, the first argument will
313
- appear on the left of the sampling statement operator (` ~ ` ) in
314
- the sampling statement and the other arguments follow. For example,
316
+ appear on the left of the distribution statement operator (` ~ ` ) in
317
+ the distribution statement and the other arguments follow. For example,
315
318
suppose a function returning the log of the density of ` y ` given
316
- parameter ` theta ` allows the use of the sampling statement is
319
+ parameter ` theta ` allows the use of the distribution statement is
317
320
defined as follows.
318
321
319
322
``` stan
@@ -335,7 +338,7 @@ The `_lupdf` and `_lupmf` forms of the user-defined functions will
335
338
instead allow other unnormalized density functions to drop additive
336
339
constants.
337
340
338
- The sampling shorthand
341
+ The distribution statement shorthand
339
342
340
343
``` stan
341
344
z ~ foo(phi);
0 commit comments