diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7b32d1753..3a4b816a0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,7 @@ #### Submission Checklist - [ ] Builds locally +- [ ] New functions marked with `` `r since("VERSION")` `` - [ ] Declare copyright holder and open-source license: see below #### Summary diff --git a/README.md b/README.md index 1f41a7066..3679efc7f 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ This repository uses [GitHub Pages](https://help.github.com/categories/github-pages-basics) to serve the [project pages](https://help.github.com/articles/user-organization-and-project-pages/#project-pages-sites) site -with URL `https://mc-stan.org/docs`. +with URL https://mc-stan.org/docs. The publishing strategy is to serve the contents of the directory `docs` on branch `master`. The `docs` directory contains an empty file named `.nojekyll` so that GitHub will treat the contents as pre-generated HTML instead of trying to run [jekyll](https://jekyllrb.com). diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 000000000..73a15c2e0 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,7 @@ +*.aux +*.fdb_latexmk +*.fls +*.idx +*.ilg +*.ind +*.toc diff --git a/src/functions-reference/array_operations.Rmd b/src/functions-reference/array_operations.Rmd index d8419f664..c4c7a317a 100644 --- a/src/functions-reference/array_operations.Rmd +++ b/src/functions-reference/array_operations.Rmd @@ -24,24 +24,28 @@ with respect to the combination operation (min, max, sum, or product). `real` **`min`**`(array[] real x)`
\newline The minimum value in x, or $+\infty$ if x is size 0. +`r since("2.0")` \index{{\tt \bfseries min }!{\tt (array[] int x): int}|hyperpage} `int` **`min`**`(array[] int x)`
\newline The minimum value in x, or error if x is size 0. +`r since("2.0")` \index{{\tt \bfseries max }!{\tt (array[] real x): real}|hyperpage} `real` **`max`**`(array[] real x)`
\newline The maximum value in x, or $-\infty$ if x is size 0. +`r since("2.0")` \index{{\tt \bfseries max }!{\tt (array[] int x): int}|hyperpage} `int` **`max`**`(array[] int x)`
\newline The maximum value in x, or error if x is size 0. +`r since("2.0")` ### Sum, product, and log sum of exp @@ -52,18 +56,21 @@ The maximum value in x, or error if x is size 0. The sum of the elements in x, defined for $x$ of size $N$ by \[ \text{sum}(x) = \begin{cases} \sum_{n=1}^N x_n & \text{if} N > 0 \\[4pt] 0 & \text{if} N = 0 \end{cases} \] +`r since("2.1")` \index{{\tt \bfseries sum }!{\tt (array[] real x): real}|hyperpage} `real` **`sum`**`(array[] real x)`
\newline The sum of the elements in x; see definition above. +`r since("2.0")` \index{{\tt \bfseries prod }!{\tt (array[] real x): real}|hyperpage} `real` **`prod`**`(array[] real x)`
\newline The product of the elements in x, or 1 if x is size 0. +`r since("2.0")` \index{{\tt \bfseries prod }!{\tt (array[] int x): real}|hyperpage} @@ -72,6 +79,7 @@ The product of the elements in x, or 1 if x is size 0. The product of the elements in x, \[ \text{product}(x) = \begin{cases} \prod_{n=1}^N x_n & \text{if} N > 0 \\[4pt] 1 & \text{if} N = 0 \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries log\_sum\_exp }!{\tt (array[] real x): real}|hyperpage} @@ -79,6 +87,7 @@ The product of the elements in x, \[ \text{product}(x) = \begin{cases} `real` **`log_sum_exp`**`(array[] real x)`
\newline The natural logarithm of the sum of the exponentials of the elements in x, or $-\infty$ if the array is empty. +`r since("2.0")` ### Sample mean, variance, and standard deviation @@ -102,6 +111,7 @@ The sample mean of the elements in x. For an array $x$ of size $N > 0$, \[ \text{mean}(x) \ = \ \bar{x} \ = \ \frac{1}{N} \sum_{n=1}^N x_n. \] It is an error to the call the mean function with an array of size $0$. +`r since("2.0")` \index{{\tt \bfseries variance }!{\tt (array[] real x): real}|hyperpage} @@ -112,6 +122,7 @@ The sample variance of the elements in x. For $N > 0$, \[ - \bar{x})^2 & \text{if } N > 1 \\[4pt] 0 & \text{if } N = 1 \end{cases} \] It is an error to call the `variance` function with an array of size 0. +`r since("2.0")` \index{{\tt \bfseries sd }!{\tt (array[] real x): real}|hyperpage} @@ -121,6 +132,7 @@ The sample standard deviation of elements in x. \[ \text{sd}(x) = \begin{cases} \sqrt{\, \text{variance}(x)} & \text{if } N > 1 \\[4pt] 0 & \text{if } N = 0 \end{cases} \] It is an error to call the `sd` function with an array of size 0. +`r since("2.0")` ### Euclidean distance and squared distance @@ -132,24 +144,28 @@ The Euclidean distance between x and y, defined by \[ \text{distance}(x,y) \ = \ \sqrt{\textstyle \sum_{n=1}^N (x_n - y_n)^2} \] where `N` is the size of x and y. It is an error to call `distance` with arguments of unequal size. +`r since("2.2")` \index{{\tt \bfseries distance }!{\tt (vector x, row\_vector y): real}|hyperpage} `real` **`distance`**`(vector x, row_vector y)`
\newline The Euclidean distance between x and y +`r since("2.2")` \index{{\tt \bfseries distance }!{\tt (row\_vector x, vector y): real}|hyperpage} `real` **`distance`**`(row_vector x, vector y)`
\newline The Euclidean distance between x and y +`r since("2.2")` \index{{\tt \bfseries distance }!{\tt (row\_vector x, row\_vector y): real}|hyperpage} `real` **`distance`**`(row_vector x, row_vector y)`
\newline The Euclidean distance between x and y +`r since("2.2")` \index{{\tt \bfseries squared\_distance }!{\tt (vector x, vector y): real}|hyperpage} @@ -160,24 +176,28 @@ The squared Euclidean distance between x and y, defined by \[ \textstyle \sum_{n=1}^N (x_n - y_n)^2, \] where `N` is the size of x and y. It is an error to call `squared_distance` with arguments of unequal size. +`r since("2.7")` \index{{\tt \bfseries squared\_distance }!{\tt (vector x, row\_vector y): real}|hyperpage} `real` **`squared_distance`**`(vector x, row_vector y)`
\newline The squared Euclidean distance between x and y +`r since("2.26")` \index{{\tt \bfseries squared\_distance }!{\tt (row\_vector x, vector y): real}|hyperpage} `real` **`squared_distance`**`(row_vector x, vector y)`
\newline The squared Euclidean distance between x and y +`r since("2.26")` \index{{\tt \bfseries squared\_distance }!{\tt (row\_vector x, row\_vector y): real}|hyperpage} `real` **`squared_distance`**`(row_vector x, row_vector y)`
\newline The Euclidean distance between x and y +`r since("2.26")` ### Quantile @@ -193,12 +213,14 @@ Sample quantiles in Statistical Packages (R's default quantile function). `real` **`quantile`**`(data array[] real x, data real p)`
\newline The p-th quantile of x +`r since("2.27")` \index{{\tt \bfseries quantile }!{\tt (data array[] real x, data array[] real p): real}|hyperpage} `array[] real` **`quantile`**`(data array[] real x, data array[] real p)`
\newline An array containing the quantiles of x given by the array of probabilities p +`r since("2.27")` ## Array size and dimension function @@ -238,6 +260,7 @@ extract the dimensions of vectors and matrices. `array[] int` **`dims`**`(T x)`
\newline Return an integer array containing the dimensions of x; the type of the argument T can be any Stan type with up to 8 array dimensions. +`r since("2.0")` \index{{\tt \bfseries num\_elements }!{\tt (array[] T x): int}|hyperpage} @@ -248,6 +271,7 @@ elements in contained arrays, vectors, and matrices. T can be any array type. For example, if `x` is of type `array[4, 3] real` then `num_elements(x)` is 12, and if `y` is declared as `array[5] matrix[3, 4] y`, then `size(y)` evaluates to 60. +`r since("2.5")` \index{{\tt \bfseries size }!{\tt (array[] T x): int}|hyperpage} @@ -257,6 +281,7 @@ Return the number of elements in the array x; the type of the array T can be any type, but the size is just the size of the top level array, not the total number of elements contained. For example, if `x` is of type `array[4, 3] real` then `size(x)` is 4. +`r since("2.0")` ## Array broadcasting {#array-broadcasting} @@ -270,18 +295,21 @@ arrays. `array[] T` **`rep_array`**`(T x, int n)`
\newline Return the n array with every entry assigned to x. +`r since("2.0")` \index{{\tt \bfseries rep\_array }!{\tt (T x, int m, int n): array[,] T}|hyperpage} `array [,] T` **`rep_array`**`(T x, int m, int n)`
\newline Return the m by n array with every entry assigned to x. +`r since("2.0")` \index{{\tt \bfseries rep\_array }!{\tt (T x, int k, int m, int n): array[,,] T}|hyperpage} `array[,,] T` **`rep_array`**`(T x, int k, int m, int n)`
\newline Return the k by m by n array with every entry assigned to x. +`r since("2.0")` For example, `rep_array(1.0,5)` produces a real array (type `array[] real`) of size 5 with all values set to 1.0. On the other hand, @@ -343,6 +371,7 @@ After the assignment to `b`, the value for `b[j, k, m, n]` is equal to Return the concatenation of two arrays in the order of the arguments. T must be an N-dimensional array of any Stan type (with a maximum N of 7). All dimensions but the first must match. +`r since("2.18")` For example, the following code appends two three dimensional arrays of matrices together. Note that all dimensions except the first match. @@ -372,24 +401,28 @@ as a real array of size 3, with values \[ \text{v} = (1, -10.3, `array[] real` **`sort_asc`**`(array[] real v)`
\newline Sort the elements of v in ascending order +`r since("2.0")` \index{{\tt \bfseries sort\_asc }!{\tt (array[] int v): array[] int}|hyperpage} `array[] int` **`sort_asc`**`(array[] int v)`
\newline Sort the elements of v in ascending order +`r since("2.0")` \index{{\tt \bfseries sort\_desc }!{\tt (array[] real v): array[] real}|hyperpage} `array[] real` **`sort_desc`**`(array[] real v)`
\newline Sort the elements of v in descending order +`r since("2.0")` \index{{\tt \bfseries sort\_desc }!{\tt (array[] int v): array[] int}|hyperpage} `array[] int` **`sort_desc`**`(array[] int v)`
\newline Sort the elements of v in descending order +`r since("2.0")` \index{{\tt \bfseries sort\_indices\_asc }!{\tt (array[] real v): array[] int}|hyperpage} @@ -397,6 +430,7 @@ Sort the elements of v in descending order `array[] int` **`sort_indices_asc`**`(array[] real v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in ascending order. +`r since("2.3")` \index{{\tt \bfseries sort\_indices\_asc }!{\tt (array[] int v): array[] int}|hyperpage} @@ -404,6 +438,7 @@ index v in ascending order. `array[] int` **`sort_indices_asc`**`(array[] int v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in ascending order. +`r since("2.3")` \index{{\tt \bfseries sort\_indices\_desc }!{\tt (array[] real v): array[] int}|hyperpage} @@ -411,6 +446,7 @@ index v in ascending order. `array[] int` **`sort_indices_desc`**`(array[] real v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in descending order. +`r since("2.3")` \index{{\tt \bfseries sort\_indices\_desc }!{\tt (array[] int v): array[] int}|hyperpage} @@ -418,18 +454,21 @@ index v in descending order. `array[] int` **`sort_indices_desc`**`(array[] int v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in descending order. +`r since("2.3")` \index{{\tt \bfseries rank }!{\tt (array[] real v, int s): int}|hyperpage} `int` **`rank`**`(array[] real v, int s)`
\newline Number of components of v less than v[s] +`r since("2.0")` \index{{\tt \bfseries rank }!{\tt (array[] int v, int s): int}|hyperpage} `int` **`rank`**`(array[] int v, int s)`
\newline Number of components of v less than v[s] +`r since("2.0")` ## Reversing functions {#reversing-functions} @@ -444,3 +483,4 @@ array of size 3, with values `array[] T` **`reverse`**`(array[] T v)`
\newline Return a new array containing the elements of the argument in reverse order. +`r since("2.23")` diff --git a/src/functions-reference/binary_distributions.Rmd b/src/functions-reference/binary_distributions.Rmd index 2d7df6327..0b23cdd9b 100644 --- a/src/functions-reference/binary_distributions.Rmd +++ b/src/functions-reference/binary_distributions.Rmd @@ -25,6 +25,8 @@ If $\theta \in [0,1]$, then for $y \in \{0,1\}$, \[ `y ~ ` **`bernoulli`**`(theta)` Increment target log probability density with `bernoulli_lupmf(y | theta)`. +`r since("2.0")` + \index{{\tt \bfseries bernoulli }!sampling statement|hyperpage} @@ -35,6 +37,7 @@ Increment target log probability density with `bernoulli_lupmf(y | theta)`. `real` **`bernoulli_lpmf`**`(ints y | reals theta)`
\newline The log Bernoulli probability mass of y given chance of success `theta` +`r since("2.12")` \index{{\tt \bfseries bernoulli\_lupmf }!{\tt (ints y \textbar\ reals theta): real}|hyperpage} @@ -42,6 +45,7 @@ The log Bernoulli probability mass of y given chance of success `theta` `real` **`bernoulli_lupmf`**`(ints y | reals theta)`
\newline The log Bernoulli probability mass of y given chance of success theta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries bernoulli\_cdf }!{\tt (ints y, reals theta): real}|hyperpage} @@ -49,6 +53,7 @@ dropping constant additive terms `real` **`bernoulli_cdf`**`(ints y, reals theta)`
\newline The Bernoulli cumulative distribution function of y given chance of success `theta` +`r since("2.0")` \index{{\tt \bfseries bernoulli\_lcdf }!{\tt (ints y \textbar\ reals theta): real}|hyperpage} @@ -56,6 +61,7 @@ success `theta` `real` **`bernoulli_lcdf`**`(ints y | reals theta)`
\newline The log of the Bernoulli cumulative distribution function of y given chance of success `theta` +`r since("2.12")` \index{{\tt \bfseries bernoulli\_lccdf }!{\tt (ints y \textbar\ reals theta): real}|hyperpage} @@ -63,6 +69,7 @@ chance of success `theta` `real` **`bernoulli_lccdf`**`(ints y | reals theta)`
\newline The log of the Bernoulli complementary cumulative distribution function of y given chance of success `theta` +`r since("2.12")` \index{{\tt \bfseries bernoulli\_rng }!{\tt (reals theta): R}|hyperpage} @@ -72,6 +79,7 @@ Generate a Bernoulli variate with chance of success `theta`; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Bernoulli distribution, logit parameterization {#bernoulli-logit-distribution} @@ -94,6 +102,8 @@ If $\alpha \in \mathbb{R}$, then for $y \in \{0,1\}$, \[ `y ~ ` **`bernoulli_logit`**`(alpha)` Increment target log probability density with `bernoulli_logit_lupmf(y | alpha)`. +`r since("2.0")` + \index{{\tt \bfseries bernoulli\_logit }!sampling statement|hyperpage} @@ -105,6 +115,7 @@ Increment target log probability density with `bernoulli_logit_lupmf(y | alpha)` `real` **`bernoulli_logit_lpmf`**`(ints y | reals alpha)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha)` +`r since("2.12")` \index{{\tt \bfseries bernoulli\_logit\_lupmf }!{\tt (ints y \textbar\ reals alpha): real}|hyperpage} @@ -112,6 +123,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_lupmf`**`(ints y | reals alpha)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha)` dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries bernoulli\_logit\_rng }!{\tt (reals alpha): R}|hyperpage} @@ -121,6 +133,7 @@ Generate a Bernoulli variate with chance of success $\text{logit}^{-1}(\alpha)$; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Bernoulli-logit generalized linear model (Logistic Regression) {#bernoulli-logit-glm} @@ -148,6 +161,8 @@ n}\text{Bernoulli}(y_i~|~\text{logit}^{-1}(\alpha_i + x_i\cdot `y ~ ` **`bernoulli_logit_glm`**`(x, alpha, beta)` Increment target log probability density with `bernoulli_logit_glm_lupmf(y | x, alpha, beta)`. +`r since("2.25")` + \index{{\tt \bfseries bernoulli\_logit\_glm }!sampling statement|hyperpage} @@ -159,6 +174,7 @@ Increment target log probability density with `bernoulli_logit_glm_lupmf(y | x, `real` **`bernoulli_logit_glm_lpmf`**`(int y | matrix x, real alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)`. +`r since("2.23")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, real alpha, vector beta): real}|hyperpage} @@ -166,6 +182,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lupmf`**`(int y | matrix x, real alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lpmf }!{\tt (int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} @@ -173,6 +190,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lpmf`**`(int y | matrix x, vector alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)`. +`r since("2.23")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} @@ -180,6 +198,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lupmf`**`(int y | matrix x, vector alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, real alpha, vector beta): real}|hyperpage} @@ -187,6 +206,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lpmf`**`(array[] int y | row_vector x, real alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)`. +`r since("2.23")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, real alpha, vector beta): real}|hyperpage} @@ -194,6 +214,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lupmf`**`(array[] int y | row_vector x, real alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, vector beta): real}|hyperpage} @@ -201,6 +222,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lpmf`**`(array[] int y | row_vector x, vector alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)`. +`r since("2.23")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, vector beta): real}|hyperpage} @@ -208,6 +230,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lupmf`**`(array[] int y | row_vector x, vector alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)` dropping constant additive terms. +`r since("2.25")` @@ -216,6 +239,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lpmf`**`(array[] int y | matrix x, real alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)`. +`r since("2.18")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, real alpha, vector beta): real}|hyperpage} @@ -223,6 +247,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lupmf`**`(array[] int y | matrix x, real alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lpmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} @@ -230,6 +255,7 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lpmf`**`(array[] int y | matrix x, vector alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)`. +`r since("2.18")` \index{{\tt \bfseries bernoulli\_logit\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} @@ -237,3 +263,4 @@ The log Bernoulli probability mass of y given chance of success `real` **`bernoulli_logit_glm_lupmf`**`(array[] int y | matrix x, vector alpha, vector beta)`
\newline The log Bernoulli probability mass of y given chance of success `inv_logit(alpha + x * beta)` dropping constant additive terms. +`r since("2.25")` diff --git a/src/functions-reference/bounded_continuous_distributions.Rmd b/src/functions-reference/bounded_continuous_distributions.Rmd index 5ad511f5d..5ada4f1b6 100644 --- a/src/functions-reference/bounded_continuous_distributions.Rmd +++ b/src/functions-reference/bounded_continuous_distributions.Rmd @@ -22,6 +22,7 @@ $y \in [\alpha,\beta]$, \[ \text{Uniform}(y|\alpha,\beta) = `y ~ ` **`uniform`**`(alpha, beta)` Increment target log probability density with `uniform_lupdf(y | alpha, beta)`. +`r since("2.0")` \index{{\tt \bfseries uniform }!sampling statement|hyperpage} @@ -33,6 +34,7 @@ Increment target log probability density with `uniform_lupdf(y | alpha, beta)`. `real` **`uniform_lpdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the uniform density of y given lower bound alpha and upper bound beta +`r since("2.12")` \index{{\tt \bfseries uniform\_lupdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -40,6 +42,7 @@ bound beta `real` **`uniform_lupdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the uniform density of y given lower bound alpha and upper bound beta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries uniform\_cdf }!{\tt (reals y, reals alpha, reals beta): real}|hyperpage} @@ -47,6 +50,7 @@ bound beta dropping constant additive terms `real` **`uniform_cdf`**`(reals y, reals alpha, reals beta)`
\newline The uniform cumulative distribution function of y given lower bound alpha and upper bound beta +`r since("2.0")` \index{{\tt \bfseries uniform\_lcdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -54,6 +58,7 @@ alpha and upper bound beta `real` **`uniform_lcdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the uniform cumulative distribution function of y given lower bound alpha and upper bound beta +`r since("2.12")` \index{{\tt \bfseries uniform\_lccdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -61,6 +66,7 @@ lower bound alpha and upper bound beta `real` **`uniform_lccdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the uniform complementary cumulative distribution function of y given lower bound alpha and upper bound beta +`r since("2.12")` \index{{\tt \bfseries uniform\_rng }!{\tt (reals alpha, reals beta): R}|hyperpage} @@ -70,3 +76,4 @@ Generate a uniform variate with lower bound alpha and upper bound beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` diff --git a/src/functions-reference/bounded_discrete_distributions.Rmd b/src/functions-reference/bounded_discrete_distributions.Rmd index 0a6df0b3e..4b943f4e2 100644 --- a/src/functions-reference/bounded_discrete_distributions.Rmd +++ b/src/functions-reference/bounded_discrete_distributions.Rmd @@ -42,6 +42,8 @@ Suppose $N \in \mathbb{N}$ and $\theta \in [0,1]$, and $n \in `n ~ ` **`binomial`**`(N, theta)` Increment target log probability density with `binomial_lupmf(n | N, theta)`. +`r since("2.0")` + \index{{\tt \bfseries binomial }!sampling statement|hyperpage} @@ -53,6 +55,7 @@ Increment target log probability density with `binomial_lupmf(n | N, theta)`. `real` **`binomial_lpmf`**`(ints n | ints N, reals theta)`
\newline The log binomial probability mass of n successes in N trials given chance of success theta +`r since("2.12")` \index{{\tt \bfseries binomia\_lupmf }!{\tt (ints n \textbar\ ints N, reals theta): real}|hyperpage} @@ -60,6 +63,7 @@ chance of success theta `real` **`binomial_lupmf`**`(ints n | ints N, reals theta)`
\newline The log binomial probability mass of n successes in N trials given chance of success theta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries binomia\_cdf }!{\tt (ints n, ints N, reals theta): real}|hyperpage} @@ -67,6 +71,7 @@ chance of success theta dropping constant additive terms `real` **`binomial_cdf`**`(ints n, ints N, reals theta)`
\newline The binomial cumulative distribution function of n successes in N trials given chance of success theta +`r since("2.0")` \index{{\tt \bfseries binomia\_lcdf }!{\tt (ints n \textbar\ ints N, reals theta): real}|hyperpage} @@ -74,6 +79,7 @@ trials given chance of success theta `real` **`binomial_lcdf`**`(ints n | ints N, reals theta)`
\newline The log of the binomial cumulative distribution function of n successes in N trials given chance of success theta +`r since("2.12")` \index{{\tt \bfseries binomia\_lccdf }!{\tt (ints n \textbar\ ints N, reals theta): real}|hyperpage} @@ -81,6 +87,7 @@ successes in N trials given chance of success theta `real` **`binomial_lccdf`**`(ints n | ints N, reals theta)`
\newline The log of the binomial complementary cumulative distribution function of n successes in N trials given chance of success theta +`r since("2.12")` \index{{\tt \bfseries binomial\_rng }!{\tt (ints N, reals theta): R}|hyperpage} @@ -90,6 +97,7 @@ Generate a binomial variate with N trials and chance of success theta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Binomial distribution, logit parameterization @@ -125,6 +133,7 @@ n}{\text{logit}^{-1}(\alpha)} \] `n ~ ` **`binomial_logit`**`(N, alpha)` Increment target log probability density with `binomial_logit_lupmf(n | N, alpha)`. +`r since("2.0")` \index{{\tt \bfseries binomial\_logit }!sampling statement|hyperpage} @@ -136,6 +145,7 @@ Increment target log probability density with `binomial_logit_lupmf(n | N, alpha `real` **`binomial_logit_lpmf`**`(ints n | ints N, reals alpha)`
\newline The log binomial probability mass of n successes in N trials given logit-scaled chance of success alpha +`r since("2.12")` \index{{\tt \bfseries binomial\_logit\_lupmf }!{\tt (ints n \textbar\ ints N, reals alpha): real}|hyperpage} @@ -143,6 +153,7 @@ logit-scaled chance of success alpha `real` **`binomial_logit_lupmf`**`(ints n | ints N, reals alpha)`
\newline The log binomial probability mass of n successes in N trials given logit-scaled chance of success alpha dropping constant additive terms +`r since("2.25")` ## Beta-binomial distribution @@ -161,6 +172,7 @@ If $N \in \mathbb{N}$, $\alpha \in \mathbb{R}^+$, and $\beta \in `n ~ ` **`beta_binomial`**`(N, alpha, beta)` Increment target log probability density with `beta_binomial_lupmf(n | N, alpha, beta)`. +`r since("2.0")` \index{{\tt \bfseries beta\_binomial }!sampling statement|hyperpage} @@ -173,6 +185,7 @@ Increment target log probability density with `beta_binomial_lupmf(n | N, alpha, The log beta-binomial probability mass of n successes in N trials given prior success count (plus one) of alpha and prior failure count (plus one) of beta +`r since("2.12")` \index{{\tt \bfseries beta\_binomial\_lupmf }!{\tt (ints n \textbar\ ints N, reals alpha, reals beta): real}|hyperpage} @@ -181,6 +194,7 @@ given prior success count (plus one) of alpha and prior failure count The log beta-binomial probability mass of n successes in N trials given prior success count (plus one) of alpha and prior failure count (plus one) of beta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries beta\_binomial\_cdf }!{\tt (ints n, ints N, reals alpha, reals beta): real}|hyperpage} @@ -189,6 +203,7 @@ given prior success count (plus one) of alpha and prior failure count The beta-binomial cumulative distribution function of n successes in N trials given prior success count (plus one) of alpha and prior failure count (plus one) of beta +`r since("2.0")` \index{{\tt \bfseries beta\_binomial\_lcdf }!{\tt (ints n \textbar\ ints N, reals alpha, reals beta): real}|hyperpage} @@ -197,6 +212,7 @@ count (plus one) of beta The log of the beta-binomial cumulative distribution function of n successes in N trials given prior success count (plus one) of alpha and prior failure count (plus one) of beta +`r since("2.12")` \index{{\tt \bfseries beta\_binomial\_lccdf }!{\tt (ints n \textbar\ ints N, reals alpha, reals beta): real}|hyperpage} @@ -205,6 +221,7 @@ and prior failure count (plus one) of beta The log of the beta-binomial complementary cumulative distribution function of n successes in N trials given prior success count (plus one) of alpha and prior failure count (plus one) of beta +`r since("2.12")` \index{{\tt \bfseries beta\_binomial\_rng }!{\tt (ints N, reals alpha, reals beta): R}|hyperpage} @@ -215,6 +232,7 @@ Generate a beta-binomial variate with N trials, prior success count only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Hypergeometric distribution @@ -230,6 +248,7 @@ If $a \in \mathbb{N}$, $b \in \mathbb{N}$, and $N \in `n ~ ` **`hypergeometric`**`(N, a, b)` Increment target log probability density with `hypergeometric_lupmf(n | N, a, b)`. +`r since("2.0")` \index{{\tt \bfseries hypergeometric }!sampling statement|hyperpage} @@ -241,6 +260,7 @@ Increment target log probability density with `hypergeometric_lupmf(n | N, a, b) `real` **`hypergeometric_lpmf`**`(int n | int N, int a, int b)`
\newline The log hypergeometric probability mass of n successes in N trials given total success count of a and total failure count of b +`r since("2.12")` \index{{\tt \bfseries hypergeometric\_lupmf }!{\tt (int n | int N, int a, int b): real}|hyperpage} @@ -249,6 +269,7 @@ given total success count of a and total failure count of b The log hypergeometric probability mass of n successes in N trials given total success count of a and total failure count of b dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries hypergeometric\_rng }!{\tt (int N, int a, int2 b): int}|hyperpage} @@ -257,6 +278,7 @@ additive terms Generate a hypergeometric variate with N trials, total success count of a, and total failure count of b; may only be used in transformed data and generated quantities blocks +`r since("2.18")` ## Categorical distribution {#categorical-distribution} @@ -276,6 +298,7 @@ See [the definition of softmax](#softmax) for the definition of the softmax func Increment target log probability density with `categorical_lupmf(y | theta)` dropping constant additive terms. +`r since("2.0")` \index{{\tt \bfseries categorical }!sampling statement|hyperpage} @@ -284,6 +307,7 @@ dropping constant additive terms. `y ~ ` **`categorical_logit`**`(beta)` Increment target log probability density with `categorical_logit_lupmf(y | beta)`. +`r since("2.4")` \index{{\tt \bfseries categorical\_logit }!sampling statement|hyperpage} @@ -301,6 +325,7 @@ The log categorical probability mass function with outcome(s) y in $1:N$ given $N$-vector of outcome probabilities theta. The parameter theta must have non-negative entries that sum to one, but it need not be a variable declared as a simplex. +`r since("2.12")` \index{{\tt \bfseries categorical\_lupmf }!{\tt (ints y \textbar\ vector theta): real}|hyperpage} @@ -309,7 +334,8 @@ be a variable declared as a simplex. The log categorical probability mass function with outcome(s) y in $1:N$ given $N$-vector of outcome probabilities theta dropping constant additive terms. The parameter theta must have non-negative entries that sum - to one, but it need not be a variable declared as a simplex. +to one, but it need not be a variable declared as a simplex. +`r since("2.25")` \index{{\tt \bfseries categorical\_logit\_lpmf }!{\tt (ints y \textbar\ vector beta): real}|hyperpage} @@ -317,6 +343,7 @@ additive terms. The parameter theta must have non-negative entries that sum `real` **`categorical_logit_lpmf`**`(ints y | vector beta)`
\newline The log categorical probability mass function with outcome(s) y in $1:N$ given log-odds of outcomes beta. +`r since("2.12")` \index{{\tt \bfseries categorical\_logit\_lupmf }!{\tt (ints y \textbar\ vector beta): real}|hyperpage} @@ -324,6 +351,7 @@ $1:N$ given log-odds of outcomes beta. `real` **`categorical_logit_lupmf`**`(ints y | vector beta)`
\newline The log categorical probability mass function with outcome(s) y in $1:N$ given log-odds of outcomes beta dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries categorical\_rng }!{\tt (vector theta): int}|hyperpage} @@ -331,6 +359,7 @@ $1:N$ given log-odds of outcomes beta dropping constant additive terms. `int` **`categorical_rng`**`(vector theta)`
\newline Generate a categorical variate with $N$-simplex distribution parameter theta; may only be used in transformed data and generated quantities blocks +`r since("2.0")` \index{{\tt \bfseries categorical\_logit\_rng }!{\tt (vector beta): int}|hyperpage} @@ -339,6 +368,7 @@ theta; may only be used in transformed data and generated quantities blocks Generate a categorical variate with outcome in range $1:N$ from log-odds vector beta; may only be used in transformed data and generated quantities blocks +`r since("2.16")` ## Categorical logit generalized linear model (softmax regression) {#categorical-logit-glm} @@ -367,6 +397,7 @@ See [the definition of softmax](#softmax) for the definition of the softmax func `y ~ ` **`categorical_logit_glm`**`(x, alpha, beta)` Increment target log probability density with `categorical_logit_glm_lupmf(y | x, alpha, beta)`. +`r since("2.23")` \index{{\tt \bfseries categorical\_logit\_glm }!sampling statement|hyperpage} @@ -379,6 +410,7 @@ Increment target log probability density with `categorical_logit_glm_lupmf(y | x `real` **`categorical_logit_glm_lpmf`**`(int y | row_vector x, vector alpha, matrix beta)`
\newline The log categorical probability mass function with outcome `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries categorical\_logit\_glm\_lupmf }!{\tt (int y \textbar\ row\_vector x, vector alpha, matrix beta): real}|hyperpage} @@ -387,6 +419,7 @@ $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. The log categorical probability mass function with outcome `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries categorical\_logit\_glm\_lpmf }!{\tt (int y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage} @@ -394,6 +427,7 @@ dropping constant additive terms. `real` **`categorical_logit_glm_lpmf`**`(int y | matrix x, vector alpha, matrix beta)`
\newline The log categorical probability mass function with outcomes `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries categorical\_logit\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage} @@ -402,6 +436,7 @@ $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. The log categorical probability mass function with outcomes `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries categorical\_logit\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, matrix beta): real}|hyperpage} @@ -409,6 +444,7 @@ dropping constant additive terms. `real` **`categorical_logit_glm_lpmf`**`(array[] int y | row_vector x, vector alpha, matrix beta)`
\newline The log categorical probability mass function with outcomes `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries categorical\_logit\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, matrix beta): real}|hyperpage} @@ -417,6 +453,7 @@ $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. The log categorical probability mass function with outcomes `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries categorical\_logit\_glm\_lpmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage} @@ -424,6 +461,7 @@ dropping constant additive terms. `real` **`categorical_logit_glm_lpmf`**`(array[] int y | matrix x, vector alpha, matrix beta)`
\newline The log categorical probability mass function with outcomes `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries categorical\_logit\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage} @@ -432,6 +470,7 @@ $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta`. The log categorical probability mass function with outcomes `y` in $1:N$ given $N$-vector of log-odds of outcomes `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` ## Discrete range distribution {#discrete-range-distribution} @@ -448,6 +487,7 @@ any integer $y \in \{l,\ldots,u\}$, \[ \text{DiscreteRange}(y ~|~ l, u) = Increment the target log probability density with `discrete_range_lupmf(y | l, u)` dropping constant additive terms. +`r since("2.26")` \index{{\tt \bfseries discrete\_range }!sampling statement|hyperpage} @@ -462,6 +502,7 @@ or an array of integers (type `array[] int`). `real` **`discrete_range_lpmf`**`(ints y | ints l, ints u)`
\newline The log probability mass function with outcome(s) y in $l:u$. +`r since("2.26")` \index{{\tt \bfseries discrete\_range\_lupmf }!{\tt (ints y \textbar\ ints l, ints u): real}|hyperpage} @@ -469,6 +510,7 @@ The log probability mass function with outcome(s) y in $l:u$. `real` **`discrete_range_lupmf`**`(ints y | ints l, ints u)`
\newline The log probability mass function with outcome(s) y in $l:u$ dropping constant additive terms. +`r since("2.26")` \index{{\tt \bfseries discrete\_range\_cdf }!{\tt (ints n, ints N, reals theta): real}|hyperpage} @@ -476,6 +518,7 @@ dropping constant additive terms. `real` **`discrete_range_cdf`**`(ints y, ints l, ints u)`
\newline The discrete range cumulative distribution function for the given y, lower and upper bounds. +`r since("2.26")` \index{{\tt \bfseries discrete\_range\_lcdf }!{\tt (ints n \textbar\ ints N, reals theta): real}|hyperpage} @@ -483,6 +526,7 @@ for the given y, lower and upper bounds. `real` **`discrete_range_lcdf`**`(ints y | ints l, ints u)`
\newline The log of the discrete range cumulative distribution function for the given y, lower and upper bounds. +`r since("2.26")` \index{{\tt \bfseries discrete\_range\_lccdf }!{\tt (ints n \textbar\ ints N, reals theta): real}|hyperpage} @@ -490,6 +534,7 @@ for the given y, lower and upper bounds. `real` **`discrete_range_lccdf`**`(ints y | ints l, ints u)`
\newline The log of the discrete range complementary cumulative distribution function for the given y, lower and upper bounds. +`r since("2.26")` \index{{\tt \bfseries discrete\_range\_rng }!{\tt (ints l, ints u): int}|hyperpage} @@ -497,6 +542,7 @@ for the given y, lower and upper bounds. `int` **`discrete_range_rng`**`(ints l, ints u)`
\newline Generate a discrete variate between the given lower and upper bounds; may only be used in transformed data and generated quantities blocks. +`r since("2.26")` ## Ordered logistic distribution @@ -522,6 +568,7 @@ $\text{logit}^{-1}(\infty) = 1$. `k ~ ` **`ordered_logistic`**`(eta, c)` Increment target log probability density with `ordered_logistic_lupmf(k | eta, c)`. +`r since("2.0")` \index{{\tt \bfseries ordered\_logistic }!sampling statement|hyperpage} @@ -533,6 +580,7 @@ Increment target log probability density with `ordered_logistic_lupmf(k | eta, c `real` **`ordered_logistic_lpmf`**`(ints k | vector eta, vectors c)`
\newline The log ordered logistic probability mass of k given linear predictors `eta`, and cutpoints `c`. +`r since("2.18")` \index{{\tt \bfseries ordered\_logistic\_lupmf }!{\tt (ints k \textbar\ vector eta, vectors c): real}|hyperpage} @@ -540,6 +588,7 @@ The log ordered logistic probability mass of k given linear predictors `real` **`ordered_logistic_lupmf`**`(ints k | vector eta, vectors c)`
\newline The log ordered logistic probability mass of k given linear predictors `eta`, and cutpoints `c` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries ordered\_logistic\_rng }!{\tt (real eta, vector c): int}|hyperpage} @@ -547,6 +596,7 @@ The log ordered logistic probability mass of k given linear predictors `int` **`ordered_logistic_rng`**`(real eta, vector c)`
\newline Generate an ordered logistic variate with linear predictor `eta` and cutpoints `c`; may only be used in transformed data and generated quantities blocks +`r since("2.0")` ## Ordered logistic generalized linear model (ordinal regression) @@ -572,6 +622,7 @@ $\text{logit}^{-1}(\infty) = 1$. `y ~ ` **`ordered_logistic_glm`**`(x, beta, c)` Increment target log probability density with `ordered_logistic_lupmf(y | x, beta, c)`. +`r since("2.23")` \index{{\tt \bfseries ordered\_logistic\_glm }!sampling statement|hyperpage} @@ -583,6 +634,7 @@ Increment target log probability density with `ordered_logistic_lupmf(y | x, bet `real` **`ordered_logistic_glm_lpmf`**`(int y | row_vector x, vector beta, vector c)`
\newline The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c. The cutpoints `c` must be ordered. +`r since("2.23")` \index{{\tt \bfseries ordered\_logistic\_glm\_lupmf }!{\tt (int y \textbar\ row\_vector x, vector beta, vector c): real}|hyperpage} @@ -591,6 +643,7 @@ The cutpoints `c` must be ordered. The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c dropping constant additive terms. The cutpoints `c` must be ordered. +`r since("2.25")` \index{{\tt \bfseries ordered\_logistic\_glm\_lpmf }!{\tt (int y \textbar\ matrix x, vector beta, vector c): real}|hyperpage} @@ -598,6 +651,7 @@ The log ordered logistic probability mass of y, given linear predictors `real` **`ordered_logistic_glm_lpmf`**`(int y | matrix x, vector beta, vector c)`
\newline The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c. The cutpoints `c` must be ordered. +`r since("2.23")` \index{{\tt \bfseries ordered\_logistic\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, vector beta, vector c): real}|hyperpage} @@ -606,6 +660,7 @@ The cutpoints `c` must be ordered. The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c dropping constant additive terms. The cutpoints `c` must be ordered. +`r since("2.25")` \index{{\tt \bfseries ordered\_logistic\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, vector beta, vector c): real}|hyperpage} @@ -613,6 +668,7 @@ The log ordered logistic probability mass of y, given linear predictors `real` **`ordered_logistic_glm_lpmf`**`(array[] int y | row_vector x, vector beta, vector c)`
\newline The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c. The cutpoints `c` must be ordered. +`r since("2.23")` \index{{\tt \bfseries ordered\_logistic\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, vector beta, vector c): real}|hyperpage} @@ -621,6 +677,7 @@ The cutpoints `c` must be ordered. The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c dropping constant additive terms. The cutpoints `c` must be ordered. +`r since("2.25")` \index{{\tt \bfseries ordered\_logistic\_glm\_lpmf }!{\tt (array[] int y \textbar\ matrix x, vector beta, vector c): real}|hyperpage} @@ -628,6 +685,7 @@ The log ordered logistic probability mass of y, given linear predictors `real` **`ordered_logistic_glm_lpmf`**`(array[] int y | matrix x, vector beta, vector c)`
\newline The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c. The cutpoints `c` must be ordered. +`r since("2.23")` \index{{\tt \bfseries ordered\_logistic\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, vector beta, vector c): real}|hyperpage} @@ -636,6 +694,7 @@ The log ordered logistic probability mass of y, given linear predictors The log ordered logistic probability mass of y, given linear predictors `x * beta`, and cutpoints c dropping constant additive terms. The cutpoints `c` must be ordered. +`r since("2.25")` ## Ordered probit distribution @@ -660,6 +719,7 @@ $\Phi(\infty) = 1$. `k ~ ` **`ordered_probit`**`(eta, c)` Increment target log probability density with `ordered_probit_lupmf(k | eta, c)`. +`r since("2.19")` \index{{\tt \bfseries ordered\_probit }!sampling statement|hyperpage} @@ -671,6 +731,7 @@ Increment target log probability density with `ordered_probit_lupmf(k | eta, c)` `real` **`ordered_probit_lpmf`**`(ints k | vector eta, vectors c)`
\newline The log ordered probit probability mass of k given linear predictors eta, and cutpoints c. +`r since("2.18")` \index{{\tt \bfseries ordered\_probit\_lupmf }!{\tt (ints k \textbar\ vector eta, vectors c): real}|hyperpage} @@ -678,6 +739,7 @@ eta, and cutpoints c. `real` **`ordered_probit_lupmf`**`(ints k | vector eta, vectors c)`
\newline The log ordered probit probability mass of k given linear predictors eta, and cutpoints c dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries ordered\_probit\_rng }!{\tt (real eta, vector c): int}|hyperpage} @@ -685,3 +747,4 @@ eta, and cutpoints c dropping constant additive terms. `int` **`ordered_probit_rng`**`(real eta, vector c)`
\newline Generate an ordered probit variate with linear predictor eta and cutpoints c; may only be used in transformed data and generated quantities blocks +`r since("2.18")` diff --git a/src/functions-reference/circular_distributions.Rmd b/src/functions-reference/circular_distributions.Rmd index dcfcacd97..c4be17616 100644 --- a/src/functions-reference/circular_distributions.Rmd +++ b/src/functions-reference/circular_distributions.Rmd @@ -40,6 +40,7 @@ of the values of $y$ or $\mu$). `y ~ ` **`von_mises`**`(mu, kappa)` Increment target log probability density with `von_mises_lupdf(y | mu, kappa)`. +`r since("2.0")` \index{{\tt \bfseries von\_mises }!sampling statement|hyperpage} @@ -51,6 +52,7 @@ Increment target log probability density with `von_mises_lupdf(y | mu, kappa)`. `R` **`von_mises_lpdf`**`(reals y | reals mu, reals kappa)`
\newline The log of the von mises density of y given location mu and scale kappa. +`r since("2.18")` \index{{\tt \bfseries von\_mises\_lupdf }!{\tt (reals y \textbar\ reals mu, reals kappa): R}|hyperpage} @@ -58,6 +60,7 @@ kappa. `R` **`von_mises_lupdf`**`(reals y | reals mu, reals kappa)`
\newline The log of the von mises density of y given location mu and scale kappa dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries von\_mises\_rng }!{\tt (reals mu, reals kappa): R}|hyperpage} @@ -68,6 +71,7 @@ returns values in the interval $[(\mu \mod 2\pi)-\pi,(\mu \mod 2\pi)+\pi]$); may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ### Numerical stability diff --git a/src/functions-reference/complex-valued_basic_functions.Rmd b/src/functions-reference/complex-valued_basic_functions.Rmd index fe8327c34..445a15a6a 100644 --- a/src/functions-reference/complex-valued_basic_functions.Rmd +++ b/src/functions-reference/complex-valued_basic_functions.Rmd @@ -62,25 +62,25 @@ complex z3 = to_complex(re, im); // z3 = -2.9 + 1.3i ``` -\index{{\tt\bfseries to\_complex }!{\tt (): complex}|hyperpage} +\index{{\tt \bfseries to\_complex }!{\tt (): complex}|hyperpage} `complex` **`to_complex`**`()`
\newline Return complex number with real part 0.0 and imaginary part 0.0. - +`r since("2.28")` -\index{{\tt\bfseries to\_complex }!{\tt (real re): complex}|hyperpage} +\index{{\tt \bfseries to\_complex }!{\tt (real re): complex}|hyperpage} `complex` **`to_complex`**`(real re)`
\newline Return complex number with real part `re` and imaginary part 0.0. - +`r since("2.28")` -\index{{\tt\bfseries to\_complex }!{\tt (real re, real im): complex}|hyperpage} +\index{{\tt \bfseries to\_complex }!{\tt (real re, real im): complex}|hyperpage} `complex` **`to_complex`**`(real re, real im)`
\newline Return complex number with real part `re` and imaginary part `im`. - +`r since("2.28")` ### Complex accessors @@ -89,18 +89,18 @@ extracted with the following functions. -\index{{\tt\bfseries get\_real }!{\tt (complex z): real}|hyperpage} +\index{{\tt \bfseries get\_real }!{\tt (complex z): real}|hyperpage} `real` **`get_real`**`(complex z)`
\newline Return the real part of the complex number `z`. - +`r since("2.28")` -\index{{\tt\bfseries get\_imag }!{\tt (complex z): real}|hyperpage} +\index{{\tt \bfseries get\_imag }!{\tt (complex z): real}|hyperpage} `real` **`get_imag`**`(complex z)`
\newline Return the imaginary part of the complex number `z`. - +`r since("2.28")` ## Complex arithmetic operators {#complex-arithmetic} @@ -113,19 +113,20 @@ promoted to type `complex` before performing the operation. ### Unary operators -\index{{\tt\bfseries operator\_add}!{\tt (complex z): complex}|hyperpage} +\index{{\tt \bfseries operator\_add}!{\tt (complex z): complex}|hyperpage} `complex` **`operator+`**`(complex z)`
\newline Return the complex argument `z`, \[ +z = z. \] +`r since("2.28")` -\index{{\tt\bfseries operator\_subtract}!{\tt (complex z): complex}|hyperpage} +\index{{\tt \bfseries operator\_subtract}!{\tt (complex z): complex}|hyperpage} `complex` **`operator-`**`(complex z)`
\newline Return the negation of the complex argument `z`, which for $z = x + yi$ is \[ -z = -x - yi. \] - +`r since("2.28")` ### Binary operators @@ -134,7 +135,7 @@ Return the negation of the complex argument `z`, which for $z = x + yi$ is `complex` **`operator+`**`(complex x, complex y)`
\newline Return the sum of x and y, \[ (x + y) = \text{operator+}(x, y) = x + y. \] - +`r since("2.28")` \index{{\tt \bfseries operator\_subtract }!{\tt (complex x, complex y): complex}|hyperpage} @@ -142,7 +143,7 @@ Return the sum of x and y, \[ (x + y) = \text{operator+}(x, y) = x + y. \] `complex` **`operator-`**`(complex x, complex y)`
\newline Return the difference between x and y, \[ (x - y) = \text{operator-}(x, y) = x - y. \] - +`r since("2.28")` \index{{\tt \bfseries operator\_multiply }!{\tt (complex x, complex y): complex}|hyperpage} @@ -150,7 +151,7 @@ Return the difference between x and y, \[ (x - y) = `complex` **`operator*`**`(complex x, complex y)`
\newline Return the product of x and y, \[ (x \, * \, y) = \text{operator*}(x, y) = x \times y. \] - +`r since("2.28")` \index{{\tt \bfseries operator\_divide }!{\tt (complex x, complex y): complex}|hyperpage} @@ -158,7 +159,18 @@ Return the product of x and y, \[ (x \, * \, y) = \text{operator*}(x, y) = x `complex` **`operator/`**`(complex x, complex y)`
\newline Return the quotient of x and y, \[ (x / y) = \text{operator/}(x,y) = \frac{x}{y} \] +`r since("2.28")` + + +\index{{\tt \bfseries operator\_pow }!{\tt (complex x, complex y): complex}|hyperpage} +`complex` **`operator^`**`(complex x, complex y)`
\newline +Return x raised to the power of y, +\[ +(x^\mathrm{\wedge}y)= \text{operator}^\mathrm{\wedge}(x,y) += \textrm{exp}(y \, \log(x)). +\] +`r since("2.28")` ## Complex comparison operators {#complex-comparison} @@ -199,6 +211,7 @@ Return 1 if x is equal to y and 0 otherwise, \ = \ \begin{cases} 1 & \text{if $x = y$}, \ \text{and} \\ 0 & \text{otherwise.} \end{cases} \] +`r since("2.28")` @@ -212,7 +225,7 @@ Return 1 if x is not equal to y and 0 otherwise, \ = \ \begin{cases} 1 & \text{if $x \neq y$}, \ \text{and} \\ 0 & \text{otherwise.} \end{cases} \] - +`r since("2.28")` ## Complex (compound) assignment operators {#complex-assignment} @@ -231,6 +244,7 @@ imaginary component is 0.0. `void` **`operator=`**`(complex x, complex y)`
\newline `y = x;` assigns a (copy of) the value of `y` to `x`. +`r since("2.28")` @@ -238,28 +252,28 @@ imaginary component is 0.0. `void` **`operator+=`**`(complex x, complex y)`
\newline `x += y;` is equivalent to `x = x + y;`. - +`r since("2.28")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (complex x, complex y): void}|hyperpage} `void` **`operator-=`**`(complex x, complex y)`
\newline `x -= y;` is equivalent to `x = x - y;`. - +`r since("2.28")` \index{{\tt \bfseries operator\_compound\_multiply }!{\tt (complex x, complex y): void}|hyperpage} `void` **`operator*=`**`(complex x, complex y)`
\newline `x *= y;` is equivalent to `x = x * y;`. - +`r since("2.28")` \index{{\tt \bfseries operator\_compound\_divide }!{\tt (complex x, complex y): void}|hyperpage} `void` **`operator/=`**`(complex x, complex y)`
\newline `x /= y;` is equivalent to `x = x / y;`. - +`r since("2.28")` ## Complex special functions {#complex-special} @@ -277,7 +291,7 @@ magnitude, which for $z = x + yi$ is \[ \textrm{abs}(z) = \sqrt{x^2 + y^2}. \] - +`r since("2.28")` \index{{\tt \bfseries arg }!{\tt (complex z): real}|hyperpage} @@ -287,7 +301,7 @@ Return the phase angle (in radians) of z, which for $z = x + yi$ is \[ \textrm{arg}(z) = \textrm{atan2}(y, x) = \textrm{atan}(y / x). \] - +`r since("2.28")` \index{{\tt \bfseries norm }!{\tt (complex z): real}|hyperpage} @@ -298,7 +312,7 @@ and which for $z = x + yi$ is \[ \textrm{norm}(z) = \textrm{abs}^2(z) = x^2 + y^2. \] - +`r since("2.28")` \index{{\tt \bfseries conj }!{\tt (complex z): complex}|hyperpage} @@ -309,7 +323,7 @@ so that if $z = x + yi$, \[ \textrm{conj}(z) = x - yi. \] - +`r since("2.28")` \index{{\tt \bfseries proj }!{\tt (complex z): complex}|hyperpage} @@ -325,6 +339,7 @@ Return the projection of `z` onto the Riemann sphere, which for $z = x \end{cases} \] where $\textrm{sign}(y)$ is -1 if $y$ is negative and 1 otherwise. +`r since("2.28")` @@ -333,6 +348,7 @@ where $\textrm{sign}(y)$ is -1 if $y$ is negative and 1 otherwise. `complex` **`polar`**`(real r, real theta)`
\newline Return the complex number with magnitude (absolute value) `r` and phase angle `theta`. +`r since("2.28")` ## Complex exponential and power functions {#complex-exponential} @@ -342,7 +358,6 @@ arguments with specialized meanings that generalize their real counterparts. These versions are only called when the argument is complex. - \index{{\tt \bfseries exp }!{\tt (complex z): complex}|hyperpage} @@ -352,7 +367,7 @@ is \[ \exp z = \exp(x) \textrm{cis}(y) = \exp(x) (\cos(y) + i \sin(y)). \] - +`r since("2.28")` \index{{\tt \bfseries log }!{\tt (complex z): complex}|hyperpage} @@ -363,7 +378,7 @@ Return the complex natural logarithm of `z`, which for $z = \textrm{polar}(r, \[ \log z = \log r + \theta i. \] - +`r since("2.28")` \index{{\tt \bfseries log10 }!{\tt (complex z): complex}|hyperpage} @@ -373,7 +388,7 @@ Return the complex common logarithm of `z`, \[ \log_{10} z = \frac{\log z}{\log 10}. \] - +`r since("2.28")` \index{{\tt \bfseries pow }!{\tt (complex x, complex y): complex}|hyperpage} @@ -383,7 +398,7 @@ Return x raised to the power of y, \[ \text{pow}(x,y) = \textrm{exp}(y \, \log(x)). \] - +`r since("2.28")` \index{{\tt \bfseries sqrt }!{\tt (complex x): complex}|hyperpage} @@ -392,6 +407,7 @@ Return x raised to the power of y, Return the complex square root of x with branch cut along the negative real axis. For finite inputs, the result will be in the right half-plane. +`r since("2.28")` ## Complex trigonometric functions {#complex-trig} @@ -409,7 +425,7 @@ Return the complex cosine of z, which is = \frac{\displaystyle \exp(z \, i) + \exp(-z \, i)} {\displaystyle 2}. \] - +`r since("2.28")` \index{{\tt \bfseries sin }!{\tt (complex z): complex}|hyperpage} @@ -422,6 +438,7 @@ Return the complex sine of z, = \frac{\displaystyle \exp(z \, i) - \exp(-z \, i)} {\displaystyle 2 \, i}. \] +`r since("2.28")` @@ -435,7 +452,7 @@ Return the complex tangent of z, = \frac{(\exp(-z \, i) - \exp(z \, i)) \, i} {\exp(-z \, i) + \exp(z \, i)}. \] - +`r since("2.28")` \index{{\tt \bfseries acos }!{\tt (complex z): complex}|hyperpage} @@ -446,7 +463,7 @@ Return the complex arc (inverse) cosine of z, \textrm{acos}(z) = \frac{1}{2} \pi + \log (z \, i + \sqrt{1 - z^2}) \, i. \] - +`r since("2.28")` \index{{\tt \bfseries asin }!{\tt (complex z): complex}|hyperpage} @@ -457,7 +474,7 @@ Return the complex arc (inverse) sine of z, \text{asin}(z) = -\log(z \, i + \sqrt{1 - z^2}) \, i. \] - +`r since("2.28")` \index{{\tt \bfseries atan }!{\tt (complex z): complex}|hyperpage} @@ -468,10 +485,7 @@ Return the complex arc (inverse) tangent of z, \text{atan}(z) = - \frac{1}{2} (\log(1 - z \, i) - \log(1 + z \, i)) \, i. \] - - - - +`r since("2.28")` @@ -490,7 +504,7 @@ Return the complex hyperbolic cosine of z, = \frac{\exp(z) + \exp(-z)} {2}. \] - +`r since("2.28")` \index{{\tt \bfseries sinh }!{\tt (complex z): complex}|hyperpage} @@ -502,7 +516,7 @@ Return the complex hyperbolic sine of z, = \frac{\displaystyle \exp(z) - \exp(-z)} {\displaystyle 2}. \] - +`r since("2.28")` \index{{\tt \bfseries tanh }!{\tt (complex z): complex}|hyperpage} @@ -516,6 +530,7 @@ Return the complex hyperbolic tangent of z, \ = \ \frac{\displaystyle \exp(z) - \exp(-z)} {\displaystyle \exp(z) + \exp(-z)}. \] +`r since("2.28")` @@ -527,7 +542,7 @@ Return the complex hyperbolic arc (inverse) cosine of z, \textrm{acosh}(z) = \log(z + \sqrt{(z + 1)(z - 1)}). \] - +`r since("2.28")` \index{{\tt \bfseries asinh }!{\tt (complex z): complex}|hyperpage} @@ -538,7 +553,7 @@ Return the complex hyperbolic arc (inverse) sine of z, \textrm{asinh}(z) = \log(z + \sqrt{1 + z^2}). \] - +`r since("2.28")` \index{{\tt \bfseries atanh }!{\tt (complex z): complex}|hyperpage} @@ -550,3 +565,4 @@ Return the complex hyperbolic arc (inverse) tangent of z, = \frac{\log(1 + z) - \log(1 - z)} {2}. \] +`r since("2.28")` diff --git a/src/functions-reference/compound_arithmetic_and_assignment.Rmd b/src/functions-reference/compound_arithmetic_and_assignment.Rmd index da714bc3c..0b9394725 100644 --- a/src/functions-reference/compound_arithmetic_and_assignment.Rmd +++ b/src/functions-reference/compound_arithmetic_and_assignment.Rmd @@ -36,48 +36,56 @@ cat(' * Compound Ele `void` **`operator+=`**`(int x, int y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_add }!{\tt (real x, real y): void}|hyperpage} `void` **`operator+=`**`(real x, real y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_add }!{\tt (vector x, real y): void}|hyperpage} `void` **`operator+=`**`(vector x, real y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_add }!{\tt (row\_vector x, real y): void}|hyperpage} `void` **`operator+=`**`(row_vector x, real y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_add }!{\tt (matrix x, real y): void}|hyperpage} `void` **`operator+=`**`(matrix x, real y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_add }!{\tt (vector x, vector y): void}|hyperpage} `void` **`operator+=`**`(vector x, vector y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_add }!{\tt (row\_vector x, row\_vector y): void}|hyperpage} `void` **`operator+=`**`(row_vector x, row_vector y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_add }!{\tt (matrix x, matrix y): void}|hyperpage} `void` **`operator+=`**`(matrix x, matrix y)`
\newline `x += y` is equivalent to `x = x + y`. +`r since("2.17")` ## Compound subtraction and assignment @@ -86,48 +94,56 @@ cat(' *
Compound Ele `void` **`operator-=`**`(int x, int y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (real x, real y): void}|hyperpage} `void` **`operator-=`**`(real x, real y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (vector x, real y): void}|hyperpage} `void` **`operator-=`**`(vector x, real y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (row\_vector x, real y): void}|hyperpage} `void` **`operator-=`**`(row_vector x, real y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (matrix x, real y): void}|hyperpage} `void` **`operator-=`**`(matrix x, real y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (vector x, vector y): void}|hyperpage} `void` **`operator-=`**`(vector x, vector y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (row\_vector x, row\_vector y): void}|hyperpage} `void` **`operator-=`**`(row_vector x, row_vector y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_subtract }!{\tt (matrix x, matrix y): void}|hyperpage} `void` **`operator-=`**`(matrix x, matrix y)`
\newline `x -= y` is equivalent to `x = x - y`. +`r since("2.17")` ## Compound multiplication and assignment @@ -136,42 +152,49 @@ cat(' *
Compound Ele `void` **`operator*=`**`(int x, int y)`
\newline `x *= y` is equivalent to `x = x * y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_multiply }!{\tt (real x, real y): void}|hyperpage} `void` **`operator*=`**`(real x, real y)`
\newline `x *= y` is equivalent to `x = x * y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_multiply }!{\tt (vector x, real y): void}|hyperpage} `void` **`operator*=`**`(vector x, real y)`
\newline `x *= y` is equivalent to `x = x * y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_multiply }!{\tt (row\_vector x, real y): void}|hyperpage} `void` **`operator*=`**`(row_vector x, real y)`
\newline `x *= y` is equivalent to `x = x * y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_multiply }!{\tt (matrix x, real y): void}|hyperpage} `void` **`operator*=`**`(matrix x, real y)`
\newline `x *= y` is equivalent to `x = x * y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_multiply }!{\tt (row\_vector x, matrix y): void}|hyperpage} `void` **`operator*=`**`(row_vector x, matrix y)`
\newline `x *= y` is equivalent to `x = x * y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_multiply }!{\tt (matrix x, matrix y): void}|hyperpage} `void` **`operator*=`**`(matrix x, matrix y)`
\newline `x *= y` is equivalent to `x = x * y`. +`r since("2.17")` ## Compound division and assignment @@ -180,30 +203,35 @@ cat(' *
Compound Ele `void` **`operator/=`**`(int x, int y)`
\newline `x /= y` is equivalent to `x = x / y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_divide }!{\tt (real x, real y): void}|hyperpage} `void` **`operator/=`**`(real x, real y)`
\newline `x /= y` is equivalent to `x = x / y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_divide }!{\tt (vector x, real y): void}|hyperpage} `void` **`operator/=`**`(vector x, real y)`
\newline `x /= y` is equivalent to `x = x / y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_divide }!{\tt (row\_vector x, real y): void}|hyperpage} `void` **`operator/=`**`(row_vector x, real y)`
\newline `x /= y` is equivalent to `x = x / y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_divide }!{\tt (matrix x, real y): void}|hyperpage} `void` **`operator/=`**`(matrix x, real y)`
\newline `x /= y` is equivalent to `x = x / y`. +`r since("2.17")` ## Compound elementwise multiplication and assignment @@ -212,18 +240,21 @@ cat(' *
Compound Ele `void` **`operator.*=`**`(vector x, vector y)`
\newline `x .*= y` is equivalent to `x = x .* y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_elt\_multiply }!{\tt (row\_vector x, row\_vector y): void}|hyperpage} `void` **`operator.*=`**`(row_vector x, row_vector y)`
\newline `x .*= y` is equivalent to `x = x .* y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_elt\_multiply }!{\tt (matrix x, matrix y): void}|hyperpage} `void` **`operator.*=`**`(matrix x, matrix y)`
\newline `x .*= y` is equivalent to `x = x .* y`. +`r since("2.17")` ## Compound elementwise division and assignment @@ -232,34 +263,40 @@ cat(' *
Compound Ele `void` **`operator./=`**`(vector x, vector y)`
\newline `x ./= y` is equivalent to `x = x ./ y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_elt\_divide }!{\tt (row\_vector x, row\_vector y): void}|hyperpage} `void` **`operator./=`**`(row_vector x, row_vector y)`
\newline `x ./= y` is equivalent to `x = x ./ y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_elt\_divide }!{\tt (matrix x, matrix y): void}|hyperpage} `void` **`operator./=`**`(matrix x, matrix y)`
\newline `x ./= y` is equivalent to `x = x ./ y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_elt\_divide }!{\tt (vector x, real y): void}|hyperpage} `void` **`operator./=`**`(vector x, real y)`
\newline `x ./= y` is equivalent to `x = x ./ y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_elt\_divide }!{\tt (row\_vector x, real y): void}|hyperpage} `void` **`operator./=`**`(row_vector x, real y)`
\newline `x ./= y` is equivalent to `x = x ./ y`. +`r since("2.17")` \index{{\tt \bfseries operator\_compound\_elt\_divide }!{\tt (matrix x, real y): void}|hyperpage} `void` **`operator./=`**`(matrix x, real y)`
\newline `x ./= y` is equivalent to `x = x ./ y`. +`r since("2.17")` diff --git a/src/functions-reference/continuous_distributions_on_[0_1].Rmd b/src/functions-reference/continuous_distributions_on_[0_1].Rmd index 72e207832..5e5cd0c17 100644 --- a/src/functions-reference/continuous_distributions_on_[0_1].Rmd +++ b/src/functions-reference/continuous_distributions_on_[0_1].Rmd @@ -30,6 +30,7 @@ distribution requires strictly positive parameters, $\alpha, \beta > `theta ~ ` **`beta`**`(alpha, beta)` Increment target log probability density with `beta_lupdf(theta | alpha, beta)`. +`r since("2.0")` \index{{\tt \bfseries beta }!sampling statement|hyperpage} @@ -41,6 +42,7 @@ Increment target log probability density with `beta_lupdf(theta | alpha, beta)`. `real` **`beta_lpdf`**`(reals theta | reals alpha, reals beta)`
\newline The log of the beta density of `theta` in $[0,1]$ given positive prior successes (plus one) alpha and prior failures (plus one) beta +`r since("2.12")` \index{{\tt \bfseries beta\_lupdf }!{\tt (reals theta \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -49,6 +51,7 @@ successes (plus one) alpha and prior failures (plus one) beta The log of the beta density of `theta` in $[0,1]$ given positive prior successes (plus one) alpha and prior failures (plus one) beta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries beta\_cdf }!{\tt (reals theta, reals alpha, reals beta): real}|hyperpage} @@ -57,6 +60,7 @@ dropping constant additive terms The beta cumulative distribution function of `theta` in $[0,1]$ given positive prior successes (plus one) alpha and prior failures (plus one) beta +`r since("2.0")` \index{{\tt \bfseries beta\_lcdf }!{\tt (reals theta \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -65,6 +69,7 @@ one) beta The log of the beta cumulative distribution function of `theta` in $[0,1]$ given positive prior successes (plus one) alpha and prior failures (plus one) beta +`r since("2.12")` \index{{\tt \bfseries beta\_lccdf }!{\tt (reals theta \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -73,6 +78,7 @@ failures (plus one) beta The log of the beta complementary cumulative distribution function of `theta` in $[0,1]$ given positive prior successes (plus one) alpha and prior failures (plus one) beta +`r since("2.12")` \index{{\tt \bfseries beta\_rng }!{\tt (reals alpha, reals beta): R}|hyperpage} @@ -82,6 +88,7 @@ Generate a beta variate with positive prior successes (plus one) alpha and prior failures (plus one) beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Beta proportion distribution @@ -104,6 +111,7 @@ parameter, $\kappa > 0$. `theta ~ ` **`beta_proportion`**`(mu, kappa)` Increment target log probability density with `beta_proportion_lupdf(theta | mu, kappa)`. +`r since("2.19")` \index{{\tt \bfseries beta\_proportion }!sampling statement|hyperpage} @@ -115,6 +123,7 @@ Increment target log probability density with `beta_proportion_lupdf(theta | mu, `real` **`beta_proportion_lpdf`**`(reals theta | reals mu, reals kappa)`
\newline The log of the beta_proportion density of `theta` in $(0,1)$ given mean mu and precision kappa +`r since("2.19")` \index{{\tt \bfseries beta\_proportion\_lupdf }!{\tt (reals theta \textbar\ reals mu, reals kappa): real}|hyperpage} @@ -122,6 +131,7 @@ mean mu and precision kappa `real` **`beta_proportion_lupdf`**`(reals theta | reals mu, reals kappa)`
\newline The log of the beta_proportion density of `theta` in $(0,1)$ given mean mu and precision kappa dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries beta\_proportion\_lcdf }!{\tt (reals theta \textbar\ reals mu, reals kappa): real}|hyperpage} @@ -129,6 +139,7 @@ mean mu and precision kappa dropping constant additive terms `real` **`beta_proportion_lcdf`**`(reals theta | reals mu, reals kappa)`
\newline The log of the beta_proportion cumulative distribution function of `theta` in $(0,1)$ given mean mu and precision kappa +`r since("2.18")` \index{{\tt \bfseries beta\_proportion\_lccdf }!{\tt (reals theta \textbar\ reals mu, reals kappa): real}|hyperpage} @@ -136,6 +147,7 @@ The log of the beta_proportion cumulative distribution function of `real` **`beta_proportion_lccdf`**`(reals theta | reals mu, reals kappa)`
\newline The log of the beta_proportion complementary cumulative distribution function of `theta` in $(0,1)$ given mean mu and precision kappa +`r since("2.18")` \index{{\tt \bfseries beta\_proportion\_rng }!{\tt (reals mu, reals kappa): R}|hyperpage} @@ -145,3 +157,4 @@ Generate a beta_proportion variate with mean mu and precision kappa; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` diff --git a/src/functions-reference/correlation_matrix_distributions.Rmd b/src/functions-reference/correlation_matrix_distributions.Rmd index 9e82defe0..9ee6c0d0e 100644 --- a/src/functions-reference/correlation_matrix_distributions.Rmd +++ b/src/functions-reference/correlation_matrix_distributions.Rmd @@ -60,6 +60,7 @@ practice. `y ~ ` **`lkj_corr`**`(eta)` Increment target log probability density with `lkj_corr_lupdf(y | eta)`. +`r since("2.3")` \index{{\tt \bfseries lkj\_corr }!sampling statement|hyperpage} @@ -72,6 +73,7 @@ Increment target log probability density with `lkj_corr_lupdf(y | eta)`. The log of the LKJ density for the correlation matrix y given nonnegative shape eta. `lkj_corr_cholesky_lpdf` is faster, more numerically stable, uses less memory, and should be preferred to this. +`r since("2.12")` \index{{\tt \bfseries lkj\_corr\_lupdf }!{\tt (matrix y \textbar\ real eta): real}|hyperpage} @@ -81,6 +83,7 @@ The log of the LKJ density for the correlation matrix y given nonnegative shape eta dropping constant additive terms. `lkj_corr_cholesky_lupdf` is faster, more numerically stable, uses less memory, and should be preferred to this. +`r since("2.25")` \index{{\tt \bfseries lkj\_corr\_rng }!{\tt (int K, real eta): matrix}|hyperpage} @@ -88,6 +91,7 @@ and should be preferred to this. `matrix` **`lkj_corr_rng`**`(int K, real eta)`
\newline Generate a LKJ random correlation matrix of order K with shape eta; may only be used in transformed data and generated quantities blocks +`r since("2.0")` ## Cholesky LKJ correlation distribution @@ -134,6 +138,7 @@ unit Euclidean length. `L ~ ` **`lkj_corr_cholesky`**`(eta)` Increment target log probability density with `lkj_corr_cholesky_lupdf(L | eta)`. +`r since("2.4")` \index{{\tt \bfseries lkj\_corr\_cholesky }!sampling statement|hyperpage} @@ -145,6 +150,7 @@ Increment target log probability density with `lkj_corr_cholesky_lupdf(L | eta)` `real` **`lkj_corr_cholesky_lpdf`**`(matrix L | real eta)`
\newline The log of the LKJ density for the lower-triangular Cholesky factor L of a correlation matrix given shape eta +`r since("2.12")` \index{{\tt \bfseries lkj\_corr\_cholesky\_lupdf }!{\tt (matrix L \textbar\ real eta): real}|hyperpage} @@ -152,6 +158,7 @@ of a correlation matrix given shape eta `real` **`lkj_corr_cholesky_lupdf`**`(matrix L | real eta)`
\newline The log of the LKJ density for the lower-triangular Cholesky factor L of a correlation matrix given shape eta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries lkj\_corr\_cholesky\_rng }!{\tt (int K, real eta): matrix}|hyperpage} @@ -160,3 +167,4 @@ of a correlation matrix given shape eta dropping constant additive terms Generate a random Cholesky factor of a correlation matrix of order K that is distributed LKJ with shape eta; may only be used in transformed data and generated quantities blocks +`r since("2.4")` diff --git a/src/functions-reference/covariance_matrix_distributions.Rmd b/src/functions-reference/covariance_matrix_distributions.Rmd index a87e78960..488f2ac14 100644 --- a/src/functions-reference/covariance_matrix_distributions.Rmd +++ b/src/functions-reference/covariance_matrix_distributions.Rmd @@ -30,6 +30,7 @@ Gamma function, \[ \Gamma_K(x) = \frac{1}{\pi^{K(K-1)/4}} \ `W ~ ` **`wishart`**`(nu, Sigma)` Increment target log probability density with `wishart_lupdf(W | nu, Sigma)`. +`r since("2.0")` \index{{\tt \bfseries wishart }!sampling statement|hyperpage} @@ -42,6 +43,7 @@ Increment target log probability density with `wishart_lupdf(W | nu, Sigma)`. The log of the Wishart density for symmetric and positive-definite matrix W given degrees of freedom nu and symmetric and positive-definite scale matrix Sigma +`r since("2.12")` \index{{\tt \bfseries wishart\_lupdf }!{\tt (matrix W \textbar\ real nu, matrix Sigma): real}|hyperpage} @@ -50,6 +52,7 @@ positive-definite scale matrix Sigma The log of the Wishart density for symmetric and positive-definite matrix W given degrees of freedom nu and symmetric and positive-definite scale matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries wishart\_rng }!{\tt (real nu, matrix Sigma): matrix}|hyperpage} @@ -58,6 +61,7 @@ positive-definite scale matrix Sigma dropping constant additive terms Generate a Wishart variate with degrees of freedom nu and symmetric and positive-definite scale matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.0")` ## Inverse Wishart distribution @@ -76,6 +80,7 @@ for symmetric and positive-definite $W \in \mathbb{R}^{K \times K}$, `W ~ ` **`inv_wishart`**`(nu, Sigma)` Increment target log probability density with `inv_wishart_lupdf(W | nu, Sigma)`. +`r since("2.0")` \index{{\tt \bfseries inv\_wishart }!sampling statement|hyperpage} @@ -88,6 +93,7 @@ Increment target log probability density with `inv_wishart_lupdf(W | nu, Sigma)` The log of the inverse Wishart density for symmetric and positive-definite matrix W given degrees of freedom nu and symmetric and positive-definite scale matrix Sigma +`r since("2.12")` \index{{\tt \bfseries inv\_wishart\_lupdf }!{\tt (matrix W \textbar\ real nu, matrix Sigma): real}|hyperpage} @@ -96,6 +102,7 @@ and positive-definite scale matrix Sigma The log of the inverse Wishart density for symmetric and positive-definite matrix W given degrees of freedom nu and symmetric and positive-definite scale matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries inv\_wishart\_rng }!{\tt (real nu, matrix Sigma): matrix}|hyperpage} @@ -104,3 +111,4 @@ and positive-definite scale matrix Sigma dropping constant additive terms Generate an inverse Wishart variate with degrees of freedom nu and symmetric and positive-definite scale matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.0")` diff --git a/src/functions-reference/deprecated_functions.Rmd b/src/functions-reference/deprecated_functions.Rmd index efcee8f5d..248ef599b 100644 --- a/src/functions-reference/deprecated_functions.Rmd +++ b/src/functions-reference/deprecated_functions.Rmd @@ -58,6 +58,7 @@ ODE. `array[,] real` **`integrate_ode_rk45`**`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, array[] real x_r, array[] int x_i)`
\newline Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method. +`r since("2.10, deprecated in 2.24")` \index{{\tt \bfseries integrate\_ode\_rk45 }!{\tt (function ode, array[] real initial\_state, real initial\_time, array[] real times, array[] real theta, array[] real x\_r, array[] int x\_i, real rel\_tol, real abs\_tol, int max\_num\_steps): array[,] real}|hyperpage} @@ -66,6 +67,7 @@ algorithm, a 4th/5th order Runge-Kutta method. Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method with additional control parameters for the solver. +`r since("2.10, deprecated in 2.24")` \index{{\tt \bfseries integrate\_ode }!{\tt (function ode, array[] real initial\_state, real initial\_time, array[] real times, array[] real theta, array[] real x\_r, array[] int x\_i): array[,] real}|hyperpage} @@ -73,12 +75,14 @@ parameters for the solver. `array[,] real` **`integrate_ode`**`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, array[] real x_r, array[] int x_i)`
\newline Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method. +`r since("2.10, deprecated in 2.24")` \index{{\tt \bfseries integrate\_ode\_adams }!{\tt (function ode, array[] real initial\_state, real initial\_time, array[] real times, array[] real theta, data array[] real x\_r, data array[] int x\_i): array[,] real}|hyperpage} `array[,] real` **`integrate_ode_adams`**`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i)`
\newline Solves the ODE system for the times provided using the Adams-Moulton method. +`r since("2.23, deprecated in 2.24")` \index{{\tt \bfseries integrate\_ode\_adams }!{\tt (function ode, array[] real initial\_state, real initial\_time, array[] real times, array[] real theta, data array[] real x\_r, data array[] int x\_i, data real rel\_tol, data real abs\_tol, data int max\_num\_steps): array[,] real}|hyperpage} @@ -86,6 +90,7 @@ Solves the ODE system for the times provided using the Adams-Moulton method. `array[,] real` **`integrate_ode_adams`**`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i, data real rel_tol, data real abs_tol, data int max_num_steps)`
\newline Solves the ODE system for the times provided using the Adams-Moulton method with additional control parameters for the solver. +`r since("2.23, deprecated in 2.24")` ### Stiff solver @@ -95,6 +100,7 @@ method with additional control parameters for the solver. `array[,] real` **`integrate_ode_bdf`**`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i)`
\newline Solves the ODE system for the times provided using the backward differentiation formula (BDF) method. +`r since("2.10, deprecated in 2.24")` \index{{\tt \bfseries integrate\_ode\_bdf }!{\tt (function ode, array[] real initial\_state, real initial\_time, array[] real times, array[] real theta, data array[] real x\_r, data array[] int x\_i, data real rel\_tol, data real abs\_tol, data int max\_num\_steps): array[,] real}|hyperpage} @@ -102,6 +108,7 @@ formula (BDF) method. `array[,] real` **`integrate_ode_bdf`**`(function ode, array[] real initial_state, real initial_time, array[] real times, array[] real theta, data array[] real x_r, data array[] int x_i, data real rel_tol, data real abs_tol, data int max_num_steps)`
\newline Solves the ODE system for the times provided using the backward differentiation formula (BDF) method with additional control parameters for the solver. +`r since("2.10, deprecated in 2.24")` ### Arguments to the ODE solvers diff --git a/src/functions-reference/distributions_over_unbounded_vectors.Rmd b/src/functions-reference/distributions_over_unbounded_vectors.Rmd index c65abc9b8..f3aace7c2 100644 --- a/src/functions-reference/distributions_over_unbounded_vectors.Rmd +++ b/src/functions-reference/distributions_over_unbounded_vectors.Rmd @@ -32,6 +32,7 @@ $\Sigma$. `y ~ ` **`multi_normal`**`(mu, Sigma)` Increment target log probability density with `multi_normal_lupdf(y | mu, Sigma)`. +`r since("2.0")` \index{{\tt \bfseries multi\_normal }!sampling statement|hyperpage} @@ -50,6 +51,7 @@ vectorization. `real` **`multi_normal_lpdf`**`(vectors y | vectors mu, matrix Sigma)`
\newline The log of the multivariate normal density of vector(s) y given location vector(s) mu and covariance matrix Sigma +`r since("2.12")` \index{{\tt \bfseries multi\_normal\_lupdf }!{\tt (vectors y \textbar\ vectors mu, matrix Sigma): real}|hyperpage} @@ -57,7 +59,8 @@ location vector(s) mu and covariance matrix Sigma `real` **`multi_normal_lupdf`**`(vectors y | vectors mu, matrix Sigma)`
\newline The log of the multivariate normal density of vector(s) y given location vector(s) mu and covariance matrix Sigma dropping constant additive - terms +terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_lpdf }!{\tt (vectors y \textbar\ row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -65,6 +68,7 @@ location vector(s) mu and covariance matrix Sigma dropping constant additive `real` **`multi_normal_lpdf`**`(vectors y | row_vectors mu, matrix Sigma)`
\newline The log of the multivariate normal density of vector(s) y given location row vector(s) mu and covariance matrix Sigma +`r since("2.12")` \index{{\tt \bfseries multi\_normal\_lupdf }!{\tt (vectors y \textbar\ row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -73,6 +77,7 @@ location row vector(s) mu and covariance matrix Sigma The log of the multivariate normal density of vector(s) y given location row vector(s) mu and covariance matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_lpdf }!{\tt (row\_vectors y \textbar\ vectors mu, matrix Sigma): real}|hyperpage} @@ -80,6 +85,7 @@ terms `real` **`multi_normal_lpdf`**`(row_vectors y | vectors mu, matrix Sigma)`
\newline The log of the multivariate normal density of row vector(s) y given location vector(s) mu and covariance matrix Sigma +`r since("2.12")` \index{{\tt \bfseries multi\_normal\_lupdf }!{\tt (row\_vectors y \textbar\ vectors mu, matrix Sigma): real}|hyperpage} @@ -88,6 +94,7 @@ location vector(s) mu and covariance matrix Sigma The log of the multivariate normal density of row vector(s) y given location vector(s) mu and covariance matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_lpdf }!{\tt (row\_vectors y \textbar\ row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -95,6 +102,7 @@ terms `real` **`multi_normal_lpdf`**`(row_vectors y | row_vectors mu, matrix Sigma)`
\newline The log of the multivariate normal density of row vector(s) y given location row vector(s) mu and covariance matrix Sigma +`r since("2.12")` \index{{\tt \bfseries multi\_normal\_lupdf }!{\tt (row\_vectors y \textbar\ row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -103,6 +111,7 @@ location row vector(s) mu and covariance matrix Sigma The log of the multivariate normal density of row vector(s) y given location row vector(s) mu and covariance matrix Sigma dropping constant additive terms +`r since("2.25")` Although there is a direct multi-normal RNG function, if more than one result is required, it's much more efficient to Cholesky factor the @@ -115,6 +124,7 @@ covariance matrix and call `multi_normal_cholesky_rng`; see section `vector` **`multi_normal_rng`**`(vector mu, matrix Sigma)`
\newline Generate a multivariate normal variate with location mu and covariance matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.0")` \index{{\tt \bfseries multi\_normal\_rng }!{\tt (row\_vector mu, matrix Sigma): vector}|hyperpage} @@ -122,6 +132,7 @@ matrix Sigma; may only be used in transformed data and generated quantities bloc `vector` **`multi_normal_rng`**`(row_vector mu, matrix Sigma)`
\newline Generate a multivariate normal variate with location mu and covariance matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_rng }!{\tt (vectors mu, matrix Sigma): vectors}|hyperpage} @@ -130,6 +141,7 @@ matrix Sigma; may only be used in transformed data and generated quantities bloc Generate an array of multivariate normal variates with locations mu and covariance matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_rng }!{\tt (row\_vectors mu, matrix Sigma): vectors}|hyperpage} @@ -138,6 +150,7 @@ quantities blocks Generate an array of multivariate normal variates with locations mu and covariance matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.18")` ## Multivariate normal distribution, precision parameterization @@ -153,6 +166,7 @@ for $y \in \mathbb{R}^K$, \[ \text{MultiNormalPrecision}(y|\mu,\Omega) `y ~ ` **`multi_normal_prec`**`(mu, Omega)` Increment target log probability density with `multi_normal_prec_lupdf(y | mu, Omega)`. +`r since("2.3")` \index{{\tt \bfseries multi\_normal\_prec }!sampling statement|hyperpage} @@ -164,6 +178,7 @@ Increment target log probability density with `multi_normal_prec_lupdf(y | mu, O `real` **`multi_normal_prec_lpdf`**`(vectors y | vectors mu, matrix Omega)`
\newline The log of the multivariate normal density of vector(s) y given location vector(s) mu and positive definite precision matrix Omega +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_prec\_lupdf }!{\tt (vectors y \textbar\ vectors mu, matrix Omega): real}|hyperpage} @@ -172,6 +187,7 @@ location vector(s) mu and positive definite precision matrix Omega The log of the multivariate normal density of vector(s) y given location vector(s) mu and positive definite precision matrix Omega dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_prec\_lpdf }!{\tt (vectors y \textbar\ row\_vectors mu, matrix Omega): real}|hyperpage} @@ -179,6 +195,7 @@ dropping constant additive terms `real` **`multi_normal_prec_lpdf`**`(vectors y | row_vectors mu, matrix Omega)`
\newline The log of the multivariate normal density of vector(s) y given location row vector(s) mu and positive definite precision matrix Omega +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_prec\_lupdf }!{\tt (vectors y \textbar\ row\_vectors mu, matrix Omega): real}|hyperpage} @@ -187,6 +204,7 @@ location row vector(s) mu and positive definite precision matrix Omega The log of the multivariate normal density of vector(s) y given location row vector(s) mu and positive definite precision matrix Omega dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_prec\_lpdf }!{\tt (row\_vectors y \textbar\ vectors mu, matrix Omega): real}|hyperpage} @@ -194,6 +212,7 @@ dropping constant additive terms `real` **`multi_normal_prec_lpdf`**`(row_vectors y | vectors mu, matrix Omega)`
\newline The log of the multivariate normal density of row vector(s) y given location vector(s) mu and positive definite precision matrix Omega +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_prec\_lupdf }!{\tt (row\_vectors y \textbar\ vectors mu, matrix Omega): real}|hyperpage} @@ -202,6 +221,7 @@ location vector(s) mu and positive definite precision matrix Omega The log of the multivariate normal density of row vector(s) y given location vector(s) mu and positive definite precision matrix Omega dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_prec\_lpdf }!{\tt (row\_vectors y \textbar\ row\_vectors mu, matrix Omega): real}|hyperpage} @@ -209,6 +229,7 @@ dropping constant additive terms `real` **`multi_normal_prec_lpdf`**`(row_vectors y | row_vectors mu, matrix Omega)`
\newline The log of the multivariate normal density of row vector(s) y given location row vector(s) mu and positive definite precision matrix Omega +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_prec\_lupdf }!{\tt (row\_vectors y \textbar\ row\_vectors mu, matrix Omega): real}|hyperpage} @@ -217,6 +238,7 @@ location row vector(s) mu and positive definite precision matrix Omega The log of the multivariate normal density of row vector(s) y given location row vector(s) mu and positive definite precision matrix Omega dropping constant additive terms +`r since("2.25")` ## Multivariate normal distribution, Cholesky parameterization {#multi-normal-cholesky-fun} @@ -237,6 +259,7 @@ probability functions will raise errors. `y ~ ` **`multi_normal_cholesky`**`(mu, L)` Increment target log probability density with `multi_normal_cholesky_lupdf(y | mu, L)`. +`r since("2.0")` \index{{\tt \bfseries multi\_normal\_cholesky }!sampling statement|hyperpage} @@ -249,6 +272,7 @@ Increment target log probability density with `multi_normal_cholesky_lupdf(y | m The log of the multivariate normal density of vector(s) y given location vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_cholesky\_lupdf }!{\tt (vectors y \textbar\ vectors mu, matrix L): real}|hyperpage} @@ -257,6 +281,7 @@ covariance matrix L The log of the multivariate normal density of vector(s) y given location vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_cholesky\_lpdf }!{\tt (vectors y \textbar\ row\_vectors mu, matrix L): real}|hyperpage} @@ -265,6 +290,7 @@ covariance matrix L dropping constant additive terms The log of the multivariate normal density of vector(s) y given location row vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_cholesky\_lupdf }!{\tt (vectors y \textbar\ row\_vectors mu, matrix L): real}|hyperpage} @@ -273,6 +299,7 @@ covariance matrix L The log of the multivariate normal density of vector(s) y given location row vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_cholesky\_lpdf }!{\tt (row\_vectors y \textbar\ vectors mu, matrix L): real}|hyperpage} @@ -281,6 +308,7 @@ covariance matrix L dropping constant additive terms The log of the multivariate normal density of row vector(s) y given location vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_cholesky\_lupdf }!{\tt (row\_vectors y \textbar\ vectors mu, matrix L): real}|hyperpage} @@ -289,6 +317,7 @@ covariance matrix L The log of the multivariate normal density of row vector(s) y given location vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_cholesky\_lpdf }!{\tt (row\_vectors y \textbar\ row\_vectors mu, matrix L): real}|hyperpage} @@ -297,6 +326,7 @@ covariance matrix L dropping constant additive terms The log of the multivariate normal density of row vector(s) y given location row vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_cholesky\_lupdf }!{\tt (row\_vectors y \textbar\ row\_vectors mu, matrix L): real}|hyperpage} @@ -305,6 +335,7 @@ covariance matrix L The log of the multivariate normal density of row vector(s) y given location row vector(s) mu and lower-triangular Cholesky factor of the covariance matrix L dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_normal\_cholesky\_rng }!{\tt (vector mu, matrix L): vector}|hyperpage} @@ -313,6 +344,7 @@ covariance matrix L dropping constant additive terms Generate a multivariate normal variate with location mu and lower-triangular Cholesky factor of the covariance matrix L; may only be used in transformed data and generated quantities blocks +`r since("2.3")` \index{{\tt \bfseries multi\_normal\_cholesky\_rng }!{\tt (row\_vector mu, matrix L): vector}|hyperpage} @@ -321,6 +353,7 @@ be used in transformed data and generated quantities blocks Generate a multivariate normal variate with location mu and lower-triangular Cholesky factor of the covariance matrix L; may only be used in transformed data and generated quantities blocks +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_cholesky\_rng }!{\tt (vectors mu, matrix L): vectors}|hyperpage} @@ -329,6 +362,7 @@ be used in transformed data and generated quantities blocks Generate an array of multivariate normal variates with locations mu and lower-triangular Cholesky factor of the covariance matrix L; may only be used in transformed data and generated quantities blocks +`r since("2.18")` \index{{\tt \bfseries multi\_normal\_cholesky\_rng }!{\tt (row\_vectors mu, matrix L): vectors}|hyperpage} @@ -337,6 +371,7 @@ only be used in transformed data and generated quantities blocks Generate an array of multivariate normal variates with locations mu and lower-triangular Cholesky factor of the covariance matrix L; may only be used in transformed data and generated quantities blocks +`r since("2.18")` ## Multivariate Gaussian process distribution @@ -357,6 +392,7 @@ function does not take into account the mean prediction. `y ~ ` **`multi_gp`**`(Sigma, w)` Increment target log probability density with `multi_gp_lupdf(y | Sigma, w)`. +`r since("2.3")` \index{{\tt \bfseries multi\_gp }!sampling statement|hyperpage} @@ -368,6 +404,7 @@ Increment target log probability density with `multi_gp_lupdf(y | Sigma, w)`. `real` **`multi_gp_lpdf`**`(matrix y | matrix Sigma, vector w)`
\newline The log of the multivariate GP density of matrix y given kernel matrix Sigma and inverses scales w +`r since("2.12")` \index{{\tt \bfseries multi\_gp\_lupdf }!{\tt (matrix y \textbar\ matrix Sigma, vector w): real}|hyperpage} @@ -375,6 +412,7 @@ Sigma and inverses scales w `real` **`multi_gp_lupdf`**`(matrix y | matrix Sigma, vector w)`
\newline The log of the multivariate GP density of matrix y given kernel matrix Sigma and inverses scales w dropping constant additive terms +`r since("2.25")` ## Multivariate Gaussian process distribution, Cholesky parameterization @@ -399,6 +437,7 @@ account the mean prediction. `y ~ ` **`multi_gp_cholesky`**`(L, w)` Increment target log probability density with `multi_gp_cholesky_lupdf(y | L, w)`. +`r since("2.5")` \index{{\tt \bfseries multi\_gp\_cholesky }!sampling statement|hyperpage} @@ -411,6 +450,7 @@ Increment target log probability density with `multi_gp_cholesky_lupdf(y | L, w) The log of the multivariate GP density of matrix y given lower-triangular Cholesky factor of the kernel matrix L and inverses scales w +`r since("2.12")` \index{{\tt \bfseries multi\_gp\_cholesky\_lupdf }!{\tt (matrix y \textbar\ matrix L, vector w): real}|hyperpage} @@ -419,6 +459,7 @@ scales w The log of the multivariate GP density of matrix y given lower-triangular Cholesky factor of the kernel matrix L and inverses scales w dropping constant additive terms +`r since("2.25")` ## Multivariate Student-t distribution @@ -439,6 +480,7 @@ K)/2\right)} {\Gamma(\nu/2)} \ \frac{1}{\sqrt{\left| \Sigma `y ~ ` **`multi_student_t`**`(nu, mu, Sigma)` Increment target log probability density with `multi_student_t_lupdf(y | nu, mu, Sigma)`. +`r since("2.0")` \index{{\tt \bfseries multi\_student\_t }!sampling statement|hyperpage} @@ -450,6 +492,7 @@ Increment target log probability density with `multi_student_t_lupdf(y | nu, mu, `real` **`multi_student_t_lpdf`**`(vectors y | real nu, vectors mu, matrix Sigma)`
\newline The log of the multivariate Student-$t$ density of vector(s) y given degrees of freedom nu, location vector(s) mu, and scale matrix Sigma +`r since("2.18")` \index{{\tt \bfseries multi\_student\_t\_lupdf }!{\tt (vectors y \textbar\ real nu, vectors mu, matrix Sigma): real}|hyperpage} @@ -458,6 +501,7 @@ degrees of freedom nu, location vector(s) mu, and scale matrix Sigma The log of the multivariate Student-$t$ density of vector(s) y given degrees of freedom nu, location vector(s) mu, and scale matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_student\_t\_lpdf }!{\tt (vectors y \textbar\ real nu, row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -466,6 +510,7 @@ dropping constant additive terms The log of the multivariate Student-$t$ density of vector(s) y given degrees of freedom nu, location row vector(s) mu, and scale matrix Sigma +`r since("2.18")` \index{{\tt \bfseries multi\_student\_t\_lupdf }!{\tt (vectors y \textbar\ real nu, row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -474,6 +519,7 @@ Sigma The log of the multivariate Student-$t$ density of vector(s) y given degrees of freedom nu, location row vector(s) mu, and scale matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_student\_t\_lpdf }!{\tt (row\_vectors y \textbar\ real nu, vectors mu, matrix Sigma): real}|hyperpage} @@ -482,6 +528,7 @@ Sigma dropping constant additive terms The log of the multivariate Student-$t$ density of row vector(s) y given degrees of freedom nu, location vector(s) mu, and scale matrix Sigma +`r since("2.18")` \index{{\tt \bfseries multi\_student\_t\_lupdf }!{\tt (row\_vectors y \textbar\ real nu, vectors mu, matrix Sigma): real}|hyperpage} @@ -490,6 +537,7 @@ Sigma The log of the multivariate Student-$t$ density of row vector(s) y given degrees of freedom nu, location vector(s) mu, and scale matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_student\_t\_lpdf }!{\tt (row\_vectors y \textbar\ real nu, row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -498,6 +546,7 @@ Sigma dropping constant additive terms The log of the multivariate Student-$t$ density of row vector(s) y given degrees of freedom nu, location row vector(s) mu, and scale matrix Sigma +`r since("2.18")` \index{{\tt \bfseries multi\_student\_t\_lupdf }!{\tt (row\_vectors y \textbar\ real nu, row\_vectors mu, matrix Sigma): real}|hyperpage} @@ -506,6 +555,7 @@ matrix Sigma The log of the multivariate Student-$t$ density of row vector(s) y given degrees of freedom nu, location row vector(s) mu, and scale matrix Sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multi\_student\_t\_rng }!{\tt (real nu, vector mu, matrix Sigma): vector}|hyperpage} @@ -514,6 +564,7 @@ matrix Sigma dropping constant additive terms Generate a multivariate Student-$t$ variate with degrees of freedom nu, location mu, and scale matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.0")` \index{{\tt \bfseries multi\_student\_t\_rng }!{\tt (real nu, row\_vector mu, matrix Sigma): vector}|hyperpage} @@ -522,6 +573,7 @@ and generated quantities blocks Generate a multivariate Student-$t$ variate with degrees of freedom nu, location mu, and scale matrix Sigma; may only be used in transfomed data and generated quantities blocks +`r since("2.18")` \index{{\tt \bfseries multi\_student\_t\_rng }!{\tt (real nu, vectors mu, matrix Sigma): vectors}|hyperpage} @@ -530,6 +582,7 @@ and generated quantities blocks Generate an array of multivariate Student-$t$ variates with degrees of freedom nu, locations mu, and scale matrix Sigma; may only be used in transformed data and generated quantities blocks +`r since("2.18")` \index{{\tt \bfseries multi\_student\_t\_rng }!{\tt (real nu, row\_vectors mu, matrix Sigma): vectors}|hyperpage} @@ -538,6 +591,7 @@ transformed data and generated quantities blocks Generate an array of multivariate Student-$t$ variates with degrees of freedom nu, locations mu, and scale matrix Sigma; may only be used in transformed data andgenerated quantities blocks +`r since("2.18")` ## Gaussian dynamic linear models @@ -558,6 +612,7 @@ processes observations and avoids a matrix inversions can be used `y ~ ` **`gaussian_dlm_obs`**`(F, G, V, W, m0, C0)` Increment target log probability density with `gaussian_dlm_obs_lupdf(y | F, G, V, W, m0, C0)`. +`r since("2.0")` \index{{\tt \bfseries gaussian\_dlm\_obs }!sampling statement|hyperpage} @@ -578,6 +633,7 @@ observation matrix y in which rows are variables and columns are observations, design matrix F, transition matrix G, observation covariance matrix V, system covariance matrix W, and the initial state is distributed normal with mean m0 and covariance C0. +`r since("2.12")` \index{{\tt \bfseries gaussian\_dlm\_obs\_lupdf }!{\tt (matrix y \textbar\ matrix F, matrix G, matrix V, matrix W, vector m0, matrix C0): real}|hyperpage} @@ -589,6 +645,7 @@ observations, design matrix F, transition matrix G, observation covariance matrix V, system covariance matrix W, and the initial state is distributed normal with mean m0 and covariance C0. This function drops constant additive terms. +`r since("2.25")` \index{{\tt \bfseries gaussian\_dlm\_obs\_lpdf }!{\tt (matrix y \textbar\ matrix F, matrix G, vector V, matrix W, vector m0, matrix C0): real}|hyperpage} @@ -599,6 +656,7 @@ observation matrix y in which rows are variables and columns are observations, design matrix F, transition matrix G, observation covariance matrix with diagonal V, system covariance matrix W, and the initial state is distributed normal with mean m0 and covariance C0. +`r since("2.12")` \index{{\tt \bfseries gaussian\_dlm\_obs\_lupdf }!{\tt (matrix y \textbar\ matrix F, matrix G, vector V, matrix W, vector m0, matrix C0): real}|hyperpage} @@ -610,3 +668,4 @@ observations, design matrix F, transition matrix G, observation covariance matrix with diagonal V, system covariance matrix W, and the initial state is distributed normal with mean m0 and covariance C0. This function drops constant additive terms. +`r since("2.25")` diff --git a/src/functions-reference/hidden_markov_models.Rmd b/src/functions-reference/hidden_markov_models.Rmd index 9c992bc07..1d489c3e2 100644 --- a/src/functions-reference/hidden_markov_models.Rmd +++ b/src/functions-reference/hidden_markov_models.Rmd @@ -1,6 +1,6 @@ # Hidden Markov Models -An elementary first-order Hidden Markov model +An elementary first-order Hidden Markov model is a probabilistic model over $N$ observations, $y_n$, and $N$ hidden states, $x_n$, which can be fully defined by the conditional distributions @@ -34,7 +34,7 @@ $$ The Stan functions that support this type of model are special in that the user does not explicitly pass $y$ and $\phi$ as arguments. Instead, the user passes $\log \omega$, $\Gamma$, and $\rho$, -which in turn depend on $y$ and $\phi$. +which in turn depend on $y$ and $\phi$. ## Stan functions {#hmm-stan-functions} @@ -43,6 +43,8 @@ which in turn depend on $y$ and $\phi$. `real` **`hmm_marginal`**`(matrix log_omega, matrix Gamma, vector rho)`
\newline Returns the log probability density of $y$, with $x_n$ integrated out at each iteration. +`r since("2.24")` + The arguments represent (1) the log density of each output, (2) the transition matrix, and (3) the initial state vector. * *`log_omega`*: $\log \omega_{kn} = \log p(y_n \mid x_n = k, \phi)$, log density of each output, @@ -52,6 +54,7 @@ The arguments represent (1) the log density of each output, (2) the transition m * *`rho`*: $\rho_k = p(x_0 = k \mid \phi)$, the initial state probability. + \index{{\tt \bfseries hmm\_latent\_rng }!{\tt (matrix log\_omega, matrix Gamma, vector rho): array[] int}|hyperpage} `array[] int` **`hmm_latent_rng`**`(matrix log_omega, matrix Gamma, vector rho)`
\newline @@ -59,7 +62,9 @@ Returns a length $N$ array of integers over $\{1, ..., K\}$, sampled from the joint posterior distribution of the hidden states, $p(x \mid \phi, y)$. May be only used in transformed data and generated quantities. +`r since("2.24")` + \index{{\tt \bfseries hmm\_hidden\_state\_prob }!{\tt (matrix log\_omega, matrix Gamma, vector rho): matrix}|hyperpage} `matrix` **`hmm_hidden_state_prob`**`(matrix log_omega, matrix Gamma, vector rho)`
\newline @@ -68,7 +73,9 @@ Returns the matrix of marginal posterior probabilities of each hidden state valu The $n^\mathrm{th}$ column is a simplex of probabilities for the $n^\mathrm{th}$ variable. -Moreover, let $A$ be the output. Then +Moreover, let $A$ be the output. Then $A_{ij} = p(x_j = i \mid \phi, y)$. This function may only be used in transformed data and generated quantities. +`r since("2.24")` + diff --git a/src/functions-reference/higher-order_functions.Rmd b/src/functions-reference/higher-order_functions.Rmd index 403a0b5f5..3df5df372 100644 --- a/src/functions-reference/higher-order_functions.Rmd +++ b/src/functions-reference/higher-order_functions.Rmd @@ -73,6 +73,7 @@ through the algebraic system. `vector` **`algebra_solver`**`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i)`
\newline Solves the algebraic system, given an initial guess, using the Powell hybrid algorithm. +`r since("2.17")` \index{{\tt \bfseries algebra\_solver }!{\tt (function algebra\_system, vector y\_guess, vector theta, data array[] real x\_r, array[] int x\_i, data real rel\_tol, data real f\_tol, int max\_steps): vector}|hyperpage} @@ -80,21 +81,25 @@ hybrid algorithm. `vector` **`algebra_solver`**`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i, data real rel_tol, data real f_tol, int max_steps)`
\newline Solves the algebraic system, given an initial guess, using the Powell hybrid algorithm with additional control parameters for the solver. +`r since("2.17")` *Note:* In future releases, the function `algebra_solver` will be deprecated and replaced with `algebra_solver_powell`. + \index{{\tt \bfseries algebra\_solver\_newton }!{\tt (function algebra\_system, vector y\_guess, vector theta, data array[] real x\_r, array[] int x\_i): vector}|hyperpage} `vector` **`algebra_solver_newton`**`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i)`
\newline Solves the algebraic system, given an initial guess, using Newton's method. +`r since("2.24")` - + \index{{\tt \bfseries algebra\_solver\_newton }!{\tt (function algebra\_system, vector y\_guess, vector theta, data array[] real x\_r, array[] int x\_i, data real rel\_tol, data real f\_tol, int max\_steps): vector}|hyperpage} `vector` **`algebra_solver_newton`**`(function algebra_system, vector y_guess, vector theta, data array[] real x_r, array[] int x_i, data real rel_tol, data real f_tol, int max_steps)`
\newline Solves the algebraic system, given an initial guess, using Newton's method with additional control parameters for the solver. +`r since("2.24")` #### Arguments to the algebraic solver @@ -199,6 +204,7 @@ in the ODE solve function call must match the types of the arguments represented `array[] vector` **`ode_rk45`**`(function ode, vector initial_state, real initial_time, array[] real times, ...)`
\newline Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method. +`r since("2.24")` \index{{\tt \bfseries ode\_rk45\_tol }!{\tt (function ode, vector initial\_state, real initial\_time, array[] real times, data real rel\_tol, data real abs\_tol, int max\_num\_steps, ...): array[] vector}|hyperpage} @@ -207,6 +213,7 @@ algorithm, a 4th/5th order Runge-Kutta method. Solves the ODE system for the times provided using the Dormand-Prince algorithm, a 4th/5th order Runge-Kutta method with additional control parameters for the solver. +`r since("2.24")` \index{{\tt \bfseries ode\_ckrk }!{\tt (function ode, array[] real initial\_state, real initial\_time, array[] real times, ...): array[] vector}|hyperpage} @@ -214,6 +221,7 @@ parameters for the solver. `array[] vector` **`ode_ckrk`**`(function ode, vector initial_state, real initial_time, array[] real times, ...)`
\newline Solves the ODE system for the times provided using the Cash-Karp algorithm, a 4th/5th order explicit Runge-Kutta method. +`r since("2.27")` \index{{\tt \bfseries ode\_ckrk\_tol }!{\tt (function ode, vector initial\_state, real initial\_time, array[] real times, data real rel\_tol, data real abs\_tol, int max\_num\_steps, ...): array[] vector}|hyperpage} @@ -222,12 +230,14 @@ algorithm, a 4th/5th order explicit Runge-Kutta method. Solves the ODE system for the times provided using the Cash-Karp algorithm, a 4th/5th order explicit Runge-Kutta method with additional control parameters for the solver. +`r since("2.27")` \index{{\tt \bfseries ode\_adams }!{\tt (function ode, vector initial\_state, real initial\_time, array[] real times, ...): array[] vector}|hyperpage} `array[] vector` **`ode_adams`**`(function ode, vector initial_state, real initial_time, array[] real times, ...)`
\newline Solves the ODE system for the times provided using the Adams-Moulton method. +`r since("2.24")` \index{{\tt \bfseries ode\_adams\_tol }!{\tt (function ode, vector initial\_state, real initial\_time, array[] real times, data real rel\_tol, data real abs\_tol, data int max\_num\_steps, ...): array[] vector}|hyperpage} @@ -235,6 +245,7 @@ Solves the ODE system for the times provided using the Adams-Moulton method. `array[] vector` **`ode_adams_tol`**`(function ode, vector initial_state, real initial_time, array[] real times, data real rel_tol, data real abs_tol, int max_num_steps, ...)`
\newline Solves the ODE system for the times provided using the Adams-Moulton method with additional control parameters for the solver. +`r since("2.24")` ### Stiff solver @@ -244,6 +255,7 @@ method with additional control parameters for the solver. `array[] vector` **`ode_bdf`**`(function ode, vector initial_state, real initial_time, array[] real times, ...)`
\newline Solves the ODE system for the times provided using the backward differentiation formula (BDF) method. +`r since("2.24")` \index{{\tt \bfseries ode\_bdf\_tol }!{\tt (function ode, vector initial\_state, real initial\_time, array[] real times, data real rel\_tol, data real abs\_tol, int max\_num\_steps, ...): array[] vector}|hyperpage} @@ -251,6 +263,7 @@ formula (BDF) method. `array[] vector` **`ode_bdf_tol`**`(function ode, vector initial_state, real initial_time, array[] real times, data real rel_tol, data real abs_tol, int max_num_steps, ...)`
\newline Solves the ODE system for the times provided using the backward differentiation formula (BDF) method with additional control parameters for the solver. +`r since("2.24")` ### Adjoint solver @@ -266,6 +279,7 @@ version of the forward solution, and the solution of a quadrature problem (the number of which depends on the number of parameters passed to the solve). The tolerances and numeric methods used for the forward solve, backward solve, quadratures, and interpolation can all be configured. +`r since("2.27")` ### ODE system function @@ -446,12 +460,14 @@ integrator separates parameter values, `theta`, from data values, `x_r`. `real` **`integrate_1d`** `(function integrand, real a, real b, array[] real theta, array[] real x_r, array[] int x_i)`
\newline Integrates the integrand from a to b. +`r since("2.23")` \index{{\tt \bfseries integrate\_1d }!{\tt (function integrand, real a, real b, array[] real theta, array[] real x\_r, array[] int x\_i, real relative\_tolerance): real}|hyperpage} `real` **`integrate_1d`** `(function integrand, real a, real b, array[] real theta, array[] real x_r, array[] int x_i, real relative_tolerance)`
\newline Integrates the integrand from a to b with the given relative tolerance. +`r since("2.23")` #### Arguments to the 1D integrator @@ -544,6 +560,7 @@ parallelization of the resultant sum. Returns the equivalent of `f(x, 1, size(x), s1, s2, ...)`, but computes the result in parallel by breaking the array `x` into independent partial sums. `s1, s2, ...` are shared between all terms in the sum. +`r since("2.23")` * *`f`*: function literal referring to a function specifying the partial sum operation. Refer to the [partial sum function](#functions-partial-sum). @@ -553,6 +570,7 @@ partial sum operation. Refer to the [partial sum function](#functions-partial-su * *`s2`*: second (optional) shared argument, type `T2`, where `T2` can be any type, * *`...`*: remainder of shared arguments, each of which can be any type. + ### The partial sum function {#functions-partial-sum} The partial sum function must have the following signature where the type `T`, and the @@ -626,4 +644,5 @@ type `(vector, vector, array[] real, array[] int):vector` elementwise, i.e., the size of the parallel arrays of job-specific/local parameters `theta`, real data `x_r`, and integer data `x_r`. The shared/global parameters `phi` are passed to each invocation of `f`. +`r since("2.18")` diff --git a/src/functions-reference/index.Rmd b/src/functions-reference/index.Rmd index 4ced42346..c937824aa 100644 --- a/src/functions-reference/index.Rmd +++ b/src/functions-reference/index.Rmd @@ -123,6 +123,19 @@ became difficult to track. Instead, we will defer to the Stan web page and GitHub itself for a list of core developers and all developer contributions respectively. + + +```{r definition, echo = FALSE} +since <- function(x) { + x <- paste("Available since", x) + if (knitr::is_latex_output()) { + sprintf("\\newline\\mbox{\\small\\emph{%s}}", x) + } else if (knitr::is_html_output()) { + sprintf("
%s", x) + } else x +} +``` + \pagestyle{headings} \mainmatter diff --git a/src/functions-reference/integer-valued_basic_functions.Rmd b/src/functions-reference/integer-valued_basic_functions.Rmd index 5a7a3d13b..74b916c17 100644 --- a/src/functions-reference/integer-valued_basic_functions.Rmd +++ b/src/functions-reference/integer-valued_basic_functions.Rmd @@ -67,6 +67,7 @@ definition. `int` **`operator+`**`(int x, int y)`
\newline The sum of the addends x and y \[ \text{operator+}(x,y) = (x + y) \] +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (int x, int y): int}|hyperpage} @@ -74,6 +75,7 @@ The sum of the addends x and y \[ \text{operator+}(x,y) = (x + y) \] `int` **`operator-`**`(int x, int y)`
\newline The difference between the minuend x and subtrahend y \[ \text{operator-}(x,y) = (x - y) \] +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (int x, int y): int}|hyperpage} @@ -81,6 +83,7 @@ The difference between the minuend x and subtrahend y \[ `int` **`operator*`**`(int x, int y)`
\newline The product of the factors x and y \[ \text{operator*}(x,y) = (x \times y) \] +`r since("2.0")` \index{{\tt \bfseries operator\_divide }!{\tt (int x, int y): int}|hyperpage} @@ -90,6 +93,19 @@ The integer quotient of the dividend x and divisor y \[ \text{operator/}(x,y) = \begin{cases} \lfloor x / y \rfloor & \text{if } x / y \geq 0 \\ - \lfloor \text{floor}(-x / y) \rfloor & \text{if } x / y < 0. \end{cases} \] +**deprecated;** - use `operator%/%` instead. +`r since("2.0, deprecated in 2.24")` + + + +\index{{\tt \bfseries operator\_int\_divide }!{\tt (int x, int y): int}|hyperpage} + +`int` **`operator%/%`**`(int x, int y)`
\newline +The integer quotient of the dividend x and divisor y \[ +\text{operator\%/\%}(x,y) = \begin{cases} \lfloor x / y \rfloor & \text{if +} x / y \geq 0 \\ - \lfloor \text{floor}(-x / y) \rfloor & \text{if } +x / y < 0. \end{cases} \] +`r since("2.24")` \index{{\tt \bfseries operator\_mod }!{\tt (int x, int y): int}|hyperpage} @@ -99,6 +115,7 @@ x modulo y, which is the positive remainder after dividing x by y. If both x and y are non-negative, so is the result; otherwise, the sign of the result is platform dependent. \[ \mathrm{operator\%}(x, y) \ = \ x \ \text{mod} \ y \ = \ x - y * \lfloor x / y \rfloor \] +`r since("2.13")` ### Unary prefix operators @@ -107,12 +124,14 @@ of the result is platform dependent. \[ \mathrm{operator\%}(x, y) \ = `int` **`operator-`**`(int x)`
\newline The negation of the subtrahend x \[ \text{operator-}(x) = -x +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (int x): int}|hyperpage} `int` **`operator+`**`(int x)`
\newline This is a no-op. \[ \text{operator+}(x) = x \] +`r since("2.0")` ## Absolute functions @@ -121,6 +140,7 @@ This is a no-op. \[ \text{operator+}(x) = x \] `R` **`abs`**`(T x)`
\newline absolute value of x +`r since("2.0")` \index{{\tt \bfseries int\_step }!{\tt (int x): int}|hyperpage} @@ -138,6 +158,7 @@ or } x \text{ is } NaN \end{cases} \] _**Warning:**_ `int_step(0)` and See the warning in section [step functions](#step-functions) about the dangers of step functions applied to anything other than data. +`r since("2.0")` ## Bound functions @@ -147,6 +168,7 @@ step functions applied to anything other than data. `int` **`min`**`(int x, int y)`
\newline Return the minimum of x and y. \[ \text{min}(x, y) = \begin{cases} x & \text{if } x < y\\ y & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries max }!{\tt (int x, int y): int}|hyperpage} @@ -154,6 +176,7 @@ Return the minimum of x and y. \[ \text{min}(x, y) = \begin{cases} x & `int` **`max`**`(int x, int y)`
\newline Return the maximum of x and y. \[ \text{max}(x, y) = \begin{cases} x & \text{if } x > y\\ y & \text{otherwise} \end{cases} \] +`r since("2.0")` ## Size functions @@ -162,11 +185,11 @@ Return the maximum of x and y. \[ \text{max}(x, y) = \begin{cases} x & `int` **`size`**`(int x)`
\newline - + \index{{\tt \bfseries size }!{\tt (real x): int}|hyperpage} `int` **`size`**`(real x)`
\newline Return the size of `x` which for scalar-valued `x` is 1 - +`r since("2.26")` diff --git a/src/functions-reference/matrix_operations.Rmd b/src/functions-reference/matrix_operations.Rmd index 44af5475e..84710e342 100644 --- a/src/functions-reference/matrix_operations.Rmd +++ b/src/functions-reference/matrix_operations.Rmd @@ -28,12 +28,14 @@ cat(' *
Reverse Functions\n') `int` **`num_elements`**`(vector x)`
\newline The total number of elements in the vector x (same as function `rows`) +`r since("2.5")` \index{{\tt \bfseries num\_elements }!{\tt (row\_vector x): int}|hyperpage} `int` **`num_elements`**`(row_vector x)`
\newline The total number of elements in the vector x (same as function `cols`) +`r since("2.5")` \index{{\tt \bfseries num\_elements }!{\tt (matrix x): int}|hyperpage} @@ -41,54 +43,63 @@ The total number of elements in the vector x (same as function `cols`) `int` **`num_elements`**`(matrix x)`
\newline The total number of elements in the matrix x. For example, if `x` is a $5 \times 3$ matrix, then `num_elements(x)` is 15 +`r since("2.5")` \index{{\tt \bfseries rows }!{\tt (vector x): int}|hyperpage} `int` **`rows`**`(vector x)`
\newline The number of rows in the vector x +`r since("2.0")` \index{{\tt \bfseries rows }!{\tt (row\_vector x): int}|hyperpage} `int` **`rows`**`(row_vector x)`
\newline The number of rows in the row vector x, namely 1 +`r since("2.0")` \index{{\tt \bfseries rows }!{\tt (matrix x): int}|hyperpage} `int` **`rows`**`(matrix x)`
\newline The number of rows in the matrix x +`r since("2.0")` \index{{\tt \bfseries cols }!{\tt (vector x): int}|hyperpage} `int` **`cols`**`(vector x)`
\newline The number of columns in the vector x, namely 1 +`r since("2.0")` \index{{\tt \bfseries cols }!{\tt (row\_vector x): int}|hyperpage} `int` **`cols`**`(row_vector x)`
\newline The number of columns in the row vector x +`r since("2.0")` \index{{\tt \bfseries cols }!{\tt (matrix x): int}|hyperpage} `int` **`cols`**`(matrix x)`
\newline The number of columns in the matrix x +`r since("2.0")` \index{{\tt \bfseries size }!{\tt (vector x): int}|hyperpage} `int` **`size`**`(vector x)`
\newline The size of `x`, i.e., the number of elements +`r since("2.26")` \index{{\tt \bfseries size }!{\tt (row\_vector x): int}|hyperpage} `int` **`size`**`(row_vector x)`
\newline The size of `x`, i.e., the number of elements +`r since("2.26")` \index{{\tt \bfseries size }!{\tt (matrix x): int}|hyperpage} @@ -96,6 +107,7 @@ The size of `x`, i.e., the number of elements `int` **`size`**`(matrix x)`
\newline The size of the matrix `x`. For example, if `x` is a $5 \times 3$ matrix, then `size(x)` is 15 +`r since("2.26")` ## Matrix arithmetic operators {#matrix-arithmetic-operators} @@ -110,18 +122,21 @@ Stan along with their argument and result types. `vector` **`operator-`**`(vector x)`
\newline The negation of the vector x. +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (row\_vector x): row\_vector}|hyperpage} `row_vector` **`operator-`**`(row_vector x)`
\newline The negation of the row vector x. +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (matrix x): matrix}|hyperpage} `matrix` **`operator-`**`(matrix x)`
\newline The negation of the matrix x. +`r since("2.0")` ### Infix matrix operators @@ -130,102 +145,119 @@ The negation of the matrix x. `vector` **`operator+`**`(vector x, vector y)`
\newline The sum of the vectors x and y. +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (row\_vector x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator+`**`(row_vector x, row_vector y)`
\newline The sum of the row vectors x and y. +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (matrix x, matrix y): matrix}|hyperpage} `matrix` **`operator+`**`(matrix x, matrix y)`
\newline The sum of the matrices x and y +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (vector x, vector y): vector}|hyperpage} `vector` **`operator-`**`(vector x, vector y)`
\newline The difference between the vectors x and y. +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (row\_vector x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator-`**`(row_vector x, row_vector y)`
\newline The difference between the row vectors x and y +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (matrix x, matrix y): matrix}|hyperpage} `matrix` **`operator-`**`(matrix x, matrix y)`
\newline The difference between the matrices x and y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (real x, vector y): vector}|hyperpage} `vector` **`operator*`**`(real x, vector y)`
\newline The product of the scalar x and vector y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (real x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator*`**`(real x, row_vector y)`
\newline The product of the scalar x and the row vector y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (real x, matrix y): matrix}|hyperpage} `matrix` **`operator*`**`(real x, matrix y)`
\newline The product of the scalar x and the matrix y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (vector x, real y): vector}|hyperpage} `vector` **`operator*`**`(vector x, real y)`
\newline The product of the scalar y and vector x +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (vector x, row\_vector y): matrix}|hyperpage} `matrix` **`operator*`**`(vector x, row_vector y)`
\newline The product of the vector x and row vector y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (row\_vector x, real y): row\_vector}|hyperpage} `row_vector` **`operator*`**`(row_vector x, real y)`
\newline The product of the scalar y and row vector x +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (row\_vector x, vector y): real}|hyperpage} `real` **`operator*`**`(row_vector x, vector y)`
\newline The product of the row vector x and vector y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (row\_vector x, matrix y): row\_vector}|hyperpage} `row_vector` **`operator*`**`(row_vector x, matrix y)`
\newline The product of the row vector x and matrix y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (matrix x, real y): matrix}|hyperpage} `matrix` **`operator*`**`(matrix x, real y)`
\newline The product of the scalar y and matrix x +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (matrix x, vector y): vector}|hyperpage} `vector` **`operator*`**`(matrix x, vector y)`
\newline The product of the matrix x and vector y +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (matrix x, matrix y): matrix}|hyperpage} `matrix` **`operator*`**`(matrix x, matrix y)`
\newline The product of the matrices x and y +`r since("2.0")` ### Broadcast infix operators @@ -234,54 +266,63 @@ The product of the matrices x and y `vector` **`operator+`**`(vector x, real y)`
\newline The result of adding y to every entry in the vector x +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (real x, vector y): vector}|hyperpage} `vector` **`operator+`**`(real x, vector y)`
\newline The result of adding x to every entry in the vector y +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (row\_vector x, real y): row\_vector}|hyperpage} `row_vector` **`operator+`**`(row_vector x, real y)`
\newline The result of adding y to every entry in the row vector x +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (real x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator+`**`(real x, row_vector y)`
\newline The result of adding x to every entry in the row vector y +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (matrix x, real y): matrix}|hyperpage} `matrix` **`operator+`**`(matrix x, real y)`
\newline The result of adding y to every entry in the matrix x +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (real x, matrix y): matrix}|hyperpage} `matrix` **`operator+`**`(real x, matrix y)`
\newline The result of adding x to every entry in the matrix y +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (vector x, real y): vector}|hyperpage} `vector` **`operator-`**`(vector x, real y)`
\newline The result of subtracting y from every entry in the vector x +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (real x, vector y): vector}|hyperpage} `vector` **`operator-`**`(real x, vector y)`
\newline The result of adding x to every entry in the negation of the vector y +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (row\_vector x, real y): row\_vector}|hyperpage} `row_vector` **`operator-`**`(row_vector x, real y)`
\newline The result of subtracting y from every entry in the row vector x +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (real x, row\_vector y): row\_vector}|hyperpage} @@ -289,36 +330,42 @@ The result of subtracting y from every entry in the row vector x `row_vector` **`operator-`**`(real x, row_vector y)`
\newline The result of adding x to every entry in the negation of the row vector y +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (matrix x, real y): matrix}|hyperpage} `matrix` **`operator-`**`(matrix x, real y)`
\newline The result of subtracting y from every entry in the matrix x +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (real x, matrix y): matrix}|hyperpage} `matrix` **`operator-`**`(real x, matrix y)`
\newline The result of adding x to every entry in negation of the matrix y +`r since("2.0")` \index{{\tt \bfseries operator\_divide }!{\tt (vector x, real y): vector}|hyperpage} `vector` **`operator/`**`(vector x, real y)`
\newline The result of dividing each entry in the vector x by y +`r since("2.0")` \index{{\tt \bfseries operator\_divide }!{\tt (row\_vector x, real y): row\_vector}|hyperpage} `row_vector` **`operator/`**`(row_vector x, real y)`
\newline The result of dividing each entry in the row vector x by y +`r since("2.0")` \index{{\tt \bfseries operator\_divide }!{\tt (matrix x, real y): matrix}|hyperpage} `matrix` **`operator/`**`(matrix x, real y)`
\newline The result of dividing each entry in the matrix x by y +`r since("2.0")` ## Transposition operator @@ -329,18 +376,21 @@ Matrix transposition is represented using a postfix operator. `matrix` **`operator'`**`(matrix x)`
\newline The transpose of the matrix x, written as `x'` +`r since("2.0")` \index{{\tt \bfseries operator\_transpose }!{\tt (vector x): row\_vector}|hyperpage} `row_vector` **`operator'`**`(vector x)`
\newline The transpose of the vector x, written as `x'` +`r since("2.0")` \index{{\tt \bfseries operator\_transpose }!{\tt (row\_vector x): vector}|hyperpage} `vector` **`operator'`**`(row_vector x)`
\newline The transpose of the row vector x, written as `x'` +`r since("2.0")` ## Elementwise functions @@ -355,126 +405,147 @@ general cases. `vector` **`operator.*`**`(vector x, vector y)`
\newline The elementwise product of y and x +`r since("2.0")` \index{{\tt \bfseries operator\_elt\_multiply }!{\tt (row\_vector x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator.*`**`(row_vector x, row_vector y)`
\newline The elementwise product of y and x +`r since("2.0")` \index{{\tt \bfseries operator\_elt\_multiply }!{\tt (matrix x, matrix y): matrix}|hyperpage} `matrix` **`operator.*`**`(matrix x, matrix y)`
\newline The elementwise product of y and x +`r since("2.0")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (vector x, vector y): vector}|hyperpage} `vector` **`operator./`**`(vector x, vector y)`
\newline The elementwise quotient of y and x +`r since("2.0")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (vector x, real y): vector}|hyperpage} `vector` **`operator./`**`(vector x, real y)`
\newline The elementwise quotient of y and x +`r since("2.4")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (real x, vector y): vector}|hyperpage} `vector` **`operator./`**`(real x, vector y)`
\newline The elementwise quotient of y and x +`r since("2.4")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (row\_vector x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator./`**`(row_vector x, row_vector y)`
\newline The elementwise quotient of y and x +`r since("2.0")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (row\_vector x, real y): row\_vector}|hyperpage} `row_vector` **`operator./`**`(row_vector x, real y)`
\newline The elementwise quotient of y and x +`r since("2.4")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (real x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator./`**`(real x, row_vector y)`
\newline The elementwise quotient of y and x +`r since("2.4")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (matrix x, matrix y): matrix}|hyperpage} `matrix` **`operator./`**`(matrix x, matrix y)`
\newline The elementwise quotient of y and x +`r since("2.0")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (matrix x, real y): matrix}|hyperpage} `matrix` **`operator./`**`(matrix x, real y)`
\newline The elementwise quotient of y and x +`r since("2.4")` \index{{\tt \bfseries operator\_elt\_divide }!{\tt (real x, matrix y): matrix}|hyperpage} `matrix` **`operator./`**`(real x, matrix y)`
\newline The elementwise quotient of y and x +`r since("2.4")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (vector x, vector y): vector}|hyperpage} `vector` **`operator.^`**`(vector x, vector y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (vector x, real y): vector}|hyperpage} `vector` **`operator.^`**`(vector x, real y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (real x, vector y): vector}|hyperpage} `vector` **`operator.^`**`(real x, vector y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (row\_vector x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator.^`**`(row_vector x, row_vector y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (row\_vector x, real y): row\_vector}|hyperpage} `row_vector` **`operator.^`**`(row_vector x, real y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (real x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`operator.^`**`(real x, row_vector y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (matrix x, matrix y): matrix}|hyperpage} `matrix` **`operator.^`**`(matrix x, matrix y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (matrix x, real y): matrix}|hyperpage} `matrix` **`operator.^`**`(matrix x, real y)`
\newline The elementwise power of y and x +`r since("2.24")` \index{{\tt \bfseries operator\_elt\_pow }!{\tt (real x, matrix y): matrix}|hyperpage} `matrix` **`operator.^`**`(real x, matrix y)`
\newline The elementwise power of y and x +`r since("2.24")` ## Dot products and specialized products @@ -483,108 +554,126 @@ The elementwise power of y and x `real` **`dot_product`**`(vector x, vector y)`
\newline The dot product of x and y +`r since("2.0")` \index{{\tt \bfseries dot\_product }!{\tt (vector x, row\_vector y): real}|hyperpage} `real` **`dot_product`**`(vector x, row_vector y)`
\newline The dot product of x and y +`r since("2.0")` \index{{\tt \bfseries dot\_product }!{\tt (row\_vector x, vector y): real}|hyperpage} `real` **`dot_product`**`(row_vector x, vector y)`
\newline The dot product of x and y +`r since("2.0")` \index{{\tt \bfseries dot\_product }!{\tt (row\_vector x, row\_vector y): real}|hyperpage} `real` **`dot_product`**`(row_vector x, row_vector y)`
\newline The dot product of x and y +`r since("2.0")` \index{{\tt \bfseries columns\_dot\_product }!{\tt (vector x, vector y): row\_vector}|hyperpage} `row_vector` **`columns_dot_product`**`(vector x, vector y)`
\newline The dot product of the columns of x and y +`r since("2.0")` \index{{\tt \bfseries columns\_dot\_product }!{\tt (row\_vector x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`columns_dot_product`**`(row_vector x, row_vector y)`
\newline The dot product of the columns of x and y +`r since("2.0")` \index{{\tt \bfseries columns\_dot\_product }!{\tt (matrix x, matrix y): row\_vector}|hyperpage} `row_vector` **`columns_dot_product`**`(matrix x, matrix y)`
\newline The dot product of the columns of x and y +`r since("2.0")` \index{{\tt \bfseries rows\_dot\_product }!{\tt (vector x, vector y): vector}|hyperpage} `vector` **`rows_dot_product`**`(vector x, vector y)`
\newline The dot product of the rows of x and y +`r since("2.0")` \index{{\tt \bfseries rows\_dot\_product }!{\tt (row\_vector x, row\_vector y): vector}|hyperpage} `vector` **`rows_dot_product`**`(row_vector x, row_vector y)`
\newline The dot product of the rows of x and y +`r since("2.0")` \index{{\tt \bfseries rows\_dot\_product }!{\tt (matrix x, matrix y): vector}|hyperpage} `vector` **`rows_dot_product`**`(matrix x, matrix y)`
\newline The dot product of the rows of x and y +`r since("2.0")` \index{{\tt \bfseries dot\_self }!{\tt (vector x): real}|hyperpage} `real` **`dot_self`**`(vector x)`
\newline The dot product of the vector x with itself +`r since("2.0")` \index{{\tt \bfseries dot\_self }!{\tt (row\_vector x): real}|hyperpage} `real` **`dot_self`**`(row_vector x)`
\newline The dot product of the row vector x with itself +`r since("2.0")` \index{{\tt \bfseries columns\_dot\_self }!{\tt (vector x): row\_vector}|hyperpage} `row_vector` **`columns_dot_self`**`(vector x)`
\newline The dot product of the columns of x with themselves +`r since("2.0")` \index{{\tt \bfseries columns\_dot\_self }!{\tt (row\_vector x): row\_vector}|hyperpage} `row_vector` **`columns_dot_self`**`(row_vector x)`
\newline The dot product of the columns of x with themselves +`r since("2.0")` \index{{\tt \bfseries columns\_dot\_self }!{\tt (matrix x): row\_vector}|hyperpage} `row_vector` **`columns_dot_self`**`(matrix x)`
\newline The dot product of the columns of x with themselves +`r since("2.0")` \index{{\tt \bfseries rows\_dot\_self }!{\tt (vector x): vector}|hyperpage} `vector` **`rows_dot_self`**`(vector x)`
\newline The dot product of the rows of x with themselves +`r since("2.0")` \index{{\tt \bfseries rows\_dot\_self }!{\tt (row\_vector x): vector}|hyperpage} `vector` **`rows_dot_self`**`(row_vector x)`
\newline The dot product of the rows of x with themselves +`r since("2.0")` \index{{\tt \bfseries rows\_dot\_self }!{\tt (matrix x): vector}|hyperpage} `vector` **`rows_dot_self`**`(matrix x)`
\newline The dot product of the rows of x with themselves +`r since("2.0")` ### Specialized products @@ -595,6 +684,7 @@ The dot product of the rows of x with themselves The product of x postmultiplied by its own transpose, similar to the tcrossprod(x) function in R. The result is a symmetric matrix $\text{x}\,\text{x}^{\top}$. +`r since("2.0")` \index{{\tt \bfseries crossprod }!{\tt (matrix x): matrix}|hyperpage} @@ -603,6 +693,7 @@ $\text{x}\,\text{x}^{\top}$. The product of x premultiplied by its own transpose, similar to the crossprod(x) function in R. The result is a symmetric matrix $\text{x}^{\top}\,\text{x}$. +`r since("2.0")` The following functions all provide shorthand forms for common expressions, which are also much more efficient. @@ -612,12 +703,14 @@ expressions, which are also much more efficient. `matrix` **`quad_form`**`(matrix A, matrix B)`
\newline The quadratic form, i.e., `B' * A * B`. +`r since("2.0")` \index{{\tt \bfseries quad\_form }!{\tt (matrix A, vector B): real}|hyperpage} `real` **`quad_form`**`(matrix A, vector B)`
\newline The quadratic form, i.e., `B' * A * B`. +`r since("2.0")` \index{{\tt \bfseries quad\_form\_diag }!{\tt (matrix m, vector v): matrix}|hyperpage} @@ -625,6 +718,7 @@ The quadratic form, i.e., `B' * A * B`. `matrix` **`quad_form_diag`**`(matrix m, vector v)`
\newline The quadratic form using the column vector v as a diagonal matrix, i.e., `diag_matrix(v) * m * diag_matrix(v)`. +`r since("2.3")` \index{{\tt \bfseries quad\_form\_diag }!{\tt (matrix m, row\_vector rv): matrix}|hyperpage} @@ -632,6 +726,7 @@ i.e., `diag_matrix(v) * m * diag_matrix(v)`. `matrix` **`quad_form_diag`**`(matrix m, row_vector rv)`
\newline The quadratic form using the row vector rv as a diagonal matrix, i.e., `diag_matrix(rv) * m * diag_matrix(rv)`. +`r since("2.3")` \index{{\tt \bfseries quad\_form\_sym }!{\tt (matrix A, matrix B): matrix}|hyperpage} @@ -639,6 +734,7 @@ The quadratic form using the row vector rv as a diagonal matrix, i.e., `matrix` **`quad_form_sym`**`(matrix A, matrix B)`
\newline Similarly to quad_form, gives `B' * A * B`, but additionally checks if A is symmetric and ensures that the result is also symmetric. +`r since("2.3")` \index{{\tt \bfseries quad\_form\_sym }!{\tt (matrix A, vector B): real}|hyperpage} @@ -646,12 +742,14 @@ A is symmetric and ensures that the result is also symmetric. `real` **`quad_form_sym`**`(matrix A, vector B)`
\newline Similarly to quad_form, gives `B' * A * B`, but additionally checks if A is symmetric and ensures that the result is also symmetric. +`r since("2.3")` \index{{\tt \bfseries trace\_quad\_form }!{\tt (matrix A, matrix B): real}|hyperpage} `real` **`trace_quad_form`**`(matrix A, matrix B)`
\newline The trace of the quadratic form, i.e., `trace(B' * A * B)`. +`r since("2.0")` \index{{\tt \bfseries trace\_gen\_quad\_form }!{\tt (matrix D,matrix A, matrix B): real}|hyperpage} @@ -659,6 +757,7 @@ The trace of the quadratic form, i.e., `trace(B' * A * B)`. `real` **`trace_gen_quad_form`**`(matrix D,matrix A, matrix B)`
\newline The trace of a generalized quadratic form, i.e., `trace(D * B' * A * B).` +`r since("2.0")` \index{{\tt \bfseries multiply\_lower\_tri\_self\_transpose }!{\tt (matrix x): matrix}|hyperpage} @@ -671,6 +770,7 @@ same dimensions as x with `L(m,n)` equal to `x(m,n)` for $\text{n} result is the symmetric matrix $\text{L}\,\text{L}^{\top}$. This is a specialization of tcrossprod(x) for lower-triangular matrices. The input matrix does not need to be square. +`r since("2.0")` \index{{\tt \bfseries diag\_pre\_multiply }!{\tt (vector v, matrix m): matrix}|hyperpage} @@ -678,6 +778,7 @@ input matrix does not need to be square. `matrix` **`diag_pre_multiply`**`(vector v, matrix m)`
\newline Return the product of the diagonal matrix formed from the vector v and the matrix m, i.e., `diag_matrix(v) * m`. +`r since("2.0")` \index{{\tt \bfseries diag\_pre\_multiply }!{\tt (row\_vector rv, matrix m): matrix}|hyperpage} @@ -685,6 +786,7 @@ the matrix m, i.e., `diag_matrix(v) * m`. `matrix` **`diag_pre_multiply`**`(row_vector rv, matrix m)`
\newline Return the product of the diagonal matrix formed from the vector rv and the matrix m, i.e., `diag_matrix(rv) * m`. +`r since("2.0")` \index{{\tt \bfseries diag\_post\_multiply }!{\tt (matrix m, vector v): matrix}|hyperpage} @@ -692,6 +794,7 @@ and the matrix m, i.e., `diag_matrix(rv) * m`. `matrix` **`diag_post_multiply`**`(matrix m, vector v)`
\newline Return the product of the matrix m and the diagonal matrix formed from the vector v, i.e., `m * diag_matrix(v)`. +`r since("2.0")` \index{{\tt \bfseries diag\_post\_multiply }!{\tt (matrix m, row\_vector rv): matrix}|hyperpage} @@ -699,6 +802,7 @@ the vector v, i.e., `m * diag_matrix(v)`. `matrix` **`diag_post_multiply`**`(matrix m, row_vector rv)`
\newline Return the product of the matrix `m` and the diagonal matrix formed from the the row vector `rv`, i.e., `m * diag_matrix(rv)`. +`r since("2.0")` ## Reductions @@ -710,6 +814,7 @@ from the the row vector `rv`, i.e., `m * diag_matrix(rv)`. `real` **`log_sum_exp`**`(vector x)`
\newline The natural logarithm of the sum of the exponentials of the elements in x +`r since("2.0")` \index{{\tt \bfseries log\_sum\_exp }!{\tt (row\_vector x): real}|hyperpage} @@ -717,6 +822,7 @@ in x `real` **`log_sum_exp`**`(row_vector x)`
\newline The natural logarithm of the sum of the exponentials of the elements in x +`r since("2.0")` \index{{\tt \bfseries log\_sum\_exp }!{\tt (matrix x): real}|hyperpage} @@ -724,6 +830,7 @@ in x `real` **`log_sum_exp`**`(matrix x)`
\newline The natural logarithm of the sum of the exponentials of the elements in x +`r since("2.0")` ### Minimum and maximum @@ -732,36 +839,42 @@ in x `real` **`min`**`(vector x)`
\newline The minimum value in x, or $+\infty$ if x is empty +`r since("2.0")` \index{{\tt \bfseries min }!{\tt (row\_vector x): real}|hyperpage} `real` **`min`**`(row_vector x)`
\newline The minimum value in x, or $+\infty$ if x is empty +`r since("2.0")` \index{{\tt \bfseries min }!{\tt (matrix x): real}|hyperpage} `real` **`min`**`(matrix x)`
\newline The minimum value in x, or $+\infty$ if x is empty +`r since("2.0")` \index{{\tt \bfseries max }!{\tt (vector x): real}|hyperpage} `real` **`max`**`(vector x)`
\newline The maximum value in x, or $-\infty$ if x is empty +`r since("2.0")` \index{{\tt \bfseries max }!{\tt (row\_vector x): real}|hyperpage} `real` **`max`**`(row_vector x)`
\newline The maximum value in x, or $-\infty$ if x is empty +`r since("2.0")` \index{{\tt \bfseries max }!{\tt (matrix x): real}|hyperpage} `real` **`max`**`(matrix x)`
\newline The maximum value in x, or $-\infty$ if x is empty +`r since("2.0")` ### Sums and products @@ -770,36 +883,42 @@ The maximum value in x, or $-\infty$ if x is empty `real` **`sum`**`(vector x)`
\newline The sum of the values in x, or 0 if x is empty +`r since("2.0")` \index{{\tt \bfseries sum }!{\tt (row\_vector x): real}|hyperpage} `real` **`sum`**`(row_vector x)`
\newline The sum of the values in x, or 0 if x is empty +`r since("2.0")` \index{{\tt \bfseries sum }!{\tt (matrix x): real}|hyperpage} `real` **`sum`**`(matrix x)`
\newline The sum of the values in x, or 0 if x is empty +`r since("2.0")` \index{{\tt \bfseries prod }!{\tt (vector x): real}|hyperpage} `real` **`prod`**`(vector x)`
\newline The product of the values in x, or 1 if x is empty +`r since("2.0")` \index{{\tt \bfseries prod }!{\tt (row\_vector x): real}|hyperpage} `real` **`prod`**`(row_vector x)`
\newline The product of the values in x, or 1 if x is empty +`r since("2.0")` \index{{\tt \bfseries prod }!{\tt (matrix x): real}|hyperpage} `real` **`prod`**`(matrix x)`
\newline The product of the values in x, or 1 if x is empty +`r since("2.0")` ### Sample moments @@ -812,6 +931,7 @@ Full definitions are provided for sample moments in section `real` **`mean`**`(vector x)`
\newline The sample mean of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries mean }!{\tt (row\_vector x): real}|hyperpage} @@ -819,6 +939,7 @@ The sample mean of the values in x; see section `real` **`mean`**`(row_vector x)`
\newline The sample mean of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries mean }!{\tt (matrix x): real}|hyperpage} @@ -826,6 +947,7 @@ The sample mean of the values in x; see section `real` **`mean`**`(matrix x)`
\newline The sample mean of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries variance }!{\tt (vector x): real}|hyperpage} @@ -833,6 +955,7 @@ The sample mean of the values in x; see section `real` **`variance`**`(vector x)`
\newline The sample variance of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries variance }!{\tt (row\_vector x): real}|hyperpage} @@ -840,6 +963,7 @@ The sample variance of the values in x; see section `real` **`variance`**`(row_vector x)`
\newline The sample variance of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries variance }!{\tt (matrix x): real}|hyperpage} @@ -847,6 +971,7 @@ The sample variance of the values in x; see section `real` **`variance`**`(matrix x)`
\newline The sample variance of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries sd }!{\tt (vector x): real}|hyperpage} @@ -854,6 +979,7 @@ The sample variance of the values in x; see section `real` **`sd`**`(vector x)`
\newline The sample standard deviation of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries sd }!{\tt (row\_vector x): real}|hyperpage} @@ -861,6 +987,7 @@ The sample standard deviation of the values in x; see section `real` **`sd`**`(row_vector x)`
\newline The sample standard deviation of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` \index{{\tt \bfseries sd }!{\tt (matrix x): real}|hyperpage} @@ -868,6 +995,7 @@ The sample standard deviation of the values in x; see section `real` **`sd`**`(matrix x)`
\newline The sample standard deviation of the values in x; see section [array reductions](#array-reductions) for details. +`r since("2.0")` ### Quantile @@ -883,25 +1011,28 @@ Sample quantiles in Statistical Packages (R's default quantile function). `real` **`quantile`**`(data vector x, data real p)`
\newline The p-th quantile of x +`r since("2.27")` \index{{\tt \bfseries quantile }!{\tt (data vector x, data array[] real p): real}|hyperpage} `array[] real` **`quantile`**`(data vector x, data array[] real p)`
\newline An array containing the quantiles of x given by the array of probabilities p +`r since("2.27")` \index{{\tt \bfseries quantile }!{\tt (data row\_vector x, data real p): real}|hyperpage} `real` **`quantile`**`(data row_vector x, data real p)`
\newline The p-th quantile of x +`r since("2.27")` \index{{\tt \bfseries quantile }!{\tt (data row\_vector x, data array[] real p): real}|hyperpage} `array[] real` **`quantile`**`(data row_vector x, data array[] real p)`
\newline An array containing the quantiles of x given by the array of probabilities p - +`r since("2.27")` ## Broadcast functions {#matrix-broadcast} @@ -915,18 +1046,21 @@ vertically or stacking copies of column vectors horizontally. `vector` **`rep_vector`**`(real x, int m)`
\newline Return the size m (column) vector consisting of copies of x. +`r since("2.0")` \index{{\tt \bfseries rep\_row\_vector }!{\tt (real x, int n): row\_vector}|hyperpage} `row_vector` **`rep_row_vector`**`(real x, int n)`
\newline Return the size n row vector consisting of copies of x. +`r since("2.0")` \index{{\tt \bfseries rep\_matrix }!{\tt (real x, int m, int n): matrix}|hyperpage} `matrix` **`rep_matrix`**`(real x, int m, int n)`
\newline Return the m by n matrix consisting of copies of x. +`r since("2.0")` \index{{\tt \bfseries rep\_matrix }!{\tt (vector v, int n): matrix}|hyperpage} @@ -934,6 +1068,7 @@ Return the m by n matrix consisting of copies of x. `matrix` **`rep_matrix`**`(vector v, int n)`
\newline Return the m by n matrix consisting of n copies of the (column) vector v of size m. +`r since("2.0")` \index{{\tt \bfseries rep\_matrix }!{\tt (row\_vector rv, int m): matrix}|hyperpage} @@ -941,6 +1076,7 @@ v of size m. `matrix` **`rep_matrix`**`(row_vector rv, int m)`
\newline Return the m by n matrix consisting of m copies of the row vector rv of size n. +`r since("2.0")` Unlike the situation with array broadcasting (see section [array broadcasting](#array-broadcasting)), where there is a distinction between @@ -965,6 +1101,7 @@ automatically promoted. `matrix` **`symmetrize_from_lower_tri`**`(matrix A)`
\newline Construct a symmetric matrix from the lower triangle of A. +`r since("2.26")` ## Diagonal matrix functions @@ -973,30 +1110,35 @@ Construct a symmetric matrix from the lower triangle of A. `matrix` **`add_diag`**`(matrix m, row_vector d)`
\newline Add row_vector `d` to the diagonal of matrix `m`. +`r since("2.21")` \index{{\tt \bfseries add\_diag }!{\tt (matrix m, vector d): matrix}|hyperpage} `matrix` **`add_diag`**`(matrix m, vector d)`
\newline Add vector `d` to the diagonal of matrix `m`. +`r since("2.21")` \index{{\tt \bfseries add\_diag }!{\tt (matrix m, real d): matrix}|hyperpage} `matrix` **`add_diag`**`(matrix m, real d)`
\newline Add scalar `d` to every diagonal element of matrix `m`. +`r since("2.21")` \index{{\tt \bfseries diagonal }!{\tt (matrix x): vector}|hyperpage} `vector` **`diagonal`**`(matrix x)`
\newline The diagonal of the matrix x +`r since("2.0")` \index{{\tt \bfseries diag\_matrix }!{\tt (vector x): matrix}|hyperpage} `matrix` **`diag_matrix`**`(vector x)`
\newline The diagonal matrix with diagonal x +`r since("2.0")` Although the `diag_matrix` function is available, it is unlikely to ever show up in an efficient Stan program. For example, rather than @@ -1024,7 +1166,7 @@ diag_matrix(v))`. `matrix` **`identity_matrix`**`(int k)`
\newline Create an identity matrix of size $k \times k$ - +`r since("2.26")` ## Container construction functions {#container-construction} @@ -1034,6 +1176,7 @@ Create an identity matrix of size $k \times k$ `array[] real` **`linspaced_array`**`(int n, data real lower, data real upper)`
\newline Create a real array of length `n` of equidistantly-spaced elements between `lower` and `upper` +`r since("2.24")` \index{{\tt \bfseries linspaced\_int\_array }!{\tt (int n, int lower, int upper): array[] real}|hyperpage} @@ -1042,96 +1185,112 @@ Create a real array of length `n` of equidistantly-spaced elements between `lowe Create a regularly spaced, increasing integer array of length `n` between `lower` and `upper`, inclusively. If `(upper - lower) / (n - 1)` is less than one, repeat each output `(n - 1) / (upper - lower)` times. If neither `(upper - lower) / (n - 1)` or `(n - 1) / (upper - lower)` are integers, `upper` is reduced until one of these is true. +`r since("2.26")` \index{{\tt \bfseries linspaced\_vector }!{\tt (int n, data real lower, data real upper): vector}|hyperpage} `vector` **`linspaced_vector`**`(int n, data real lower, data real upper)`
\newline Create an `n`-dimensional vector of equidistantly-spaced elements between `lower` and `upper` +`r since("2.24")` \index{{\tt \bfseries linspaced\_row\_vector }!{\tt (int n, data real lower, data real upper): row\_vector}|hyperpage} `row_vector` **`linspaced_row_vector`**`(int n, data real lower, data real upper)`
\newline Create an `n`-dimensional row-vector of equidistantly-spaced elements between `lower` and `upper` +`r since("2.24")` \index{{\tt \bfseries one\_hot\_int\_array }!{\tt (int n, int k): array[] int}|hyperpage} `array[] int` **`one_hot_int_array`**`(int n, int k)`
\newline Create a one-hot encoded int array of length `n` with `array[k] = 1` +`r since("2.26")` \index{{\tt \bfseries one\_hot\_array }!{\tt (int n, int k): array[] real}|hyperpage} `array[] real` **`one_hot_array`**`(int n, int k)`
\newline Create a one-hot encoded real array of length `n` with `array[k] = 1` +`r since("2.24")` \index{{\tt \bfseries one\_hot\_vector }!{\tt (int n, int k): vector}|hyperpage} `vector` **`one_hot_vector`**`(int n, int k)`
\newline Create an `n`-dimensional one-hot encoded vector with `vector[k] = 1` +`r since("2.24")` \index{{\tt \bfseries one\_hot\_row\_vector }!{\tt (int n, int k): row\_vector}|hyperpage} `row_vector` **`one_hot_row_vector`**`(int n, int k)`
\newline Create an `n`-dimensional one-hot encoded row-vector with `row_vector[k] = 1` +`r since("2.24")` \index{{\tt \bfseries ones\_int\_array }!{\tt (int n): array[] int}|hyperpage} `array[] int` **`ones_int_array`**`(int n)`
\newline Create an int array of length `n` of all ones +`r since("2.26")` \index{{\tt \bfseries ones\_array }!{\tt (int n): array[] real}|hyperpage} `array[] real` **`ones_array`**`(int n)`
\newline Create a real array of length `n` of all ones +`r since("2.26")` \index{{\tt \bfseries ones\_vector }!{\tt (int n): vector}|hyperpage} `vector` **`ones_vector`**`(int n)`
\newline Create an `n`-dimensional vector of all ones +`r since("2.26")` \index{{\tt \bfseries ones\_row\_vector }!{\tt (int n): row\_vector}|hyperpage} `row_vector` **`ones_row_vector`**`(int n)`
\newline Create an `n`-dimensional row-vector of all ones +`r since("2.26")` \index{{\tt \bfseries zeros\_int\_array }!{\tt (int n): array[] int}|hyperpage} `array[] int` **`zeros_int_array`**`(int n)`
\newline Create an int array of length `n` of all zeros +`r since("2.26")` \index{{\tt \bfseries zeros\_array }!{\tt (int n): array[] real}|hyperpage} `array[] real` **`zeros_array`**`(int n)`
\newline Create a real array of length `n` of all zeros +`r since("2.24")` \index{{\tt \bfseries zeros\_vector }!{\tt (int n): vector}|hyperpage} `vector` **`zeros_vector`**`(int n)`
\newline Create an `n`-dimensional vector of all zeros +`r since("2.24")` \index{{\tt \bfseries zeros\_row\_vector }!{\tt (int n): row\_vector}|hyperpage} `row_vector` **`zeros_row_vector`**`(int n)`
\newline Create an `n`-dimensional row-vector of all zeros +`r since("2.24")` \index{{\tt \bfseries uniform\_simplex }!{\tt (int n): vector}|hyperpage} `vector` **`uniform_simplex`**`(int n)`
\newline -Create an `n`-dimensional simplex with elements `vector[i] = 1 / n` for all $i \in 1, \dots, n$ +Create an `n`-dimensional simplex with elements `vector[i] = 1 / n` for all $i \in 1, \dots, n$ +`r since("2.24")` ## Slicing and blocking functions @@ -1145,12 +1304,14 @@ diagonal entries for matrices. `vector` **`col`**`(matrix x, int n)`
\newline The n-th column of matrix x +`r since("2.0")` \index{{\tt \bfseries row }!{\tt (matrix x, int m): row\_vector}|hyperpage} `row_vector` **`row`**`(matrix x, int m)`
\newline The m-th row of matrix x +`r since("2.0")` The `row` function is special in that it may be used as an lvalue in an assignment statement (i.e., something to which a value may be @@ -1171,6 +1332,7 @@ Block operations may be used to extract a sub-block of a matrix. `matrix` **`block`**`(matrix x, int i, int j, int n_rows, int n_cols)`
\newline Return the submatrix of x that starts at row i and column j and extends n_rows rows and n_cols columns. +`r since("2.0")` The sub-row and sub-column operations may be used to extract a slice of row or column from a matrix @@ -1181,6 +1343,7 @@ of row or column from a matrix `vector` **`sub_col`**`(matrix x, int i, int j, int n_rows)`
\newline Return the sub-column of x that starts at row i and column j and extends n_rows rows and 1 column. +`r since("2.0")` \index{{\tt \bfseries sub\_row }!{\tt (matrix x, int i, int j, int n\_cols): row\_vector}|hyperpage} @@ -1188,6 +1351,7 @@ extends n_rows rows and 1 column. `row_vector` **`sub_row`**`(matrix x, int i, int j, int n_cols)`
\newline Return the sub-row of x that starts at row i and column j and extends 1 row and n_cols columns. +`r since("2.0")` #### Vector and array slicing operations @@ -1200,12 +1364,14 @@ subvector. `vector` **`head`**`(vector v, int n)`
\newline Return the vector consisting of the first n elements of v. +`r since("2.0")` \index{{\tt \bfseries head }!{\tt (row\_vector rv, int n): row\_vector}|hyperpage} `row_vector` **`head`**`(row_vector rv, int n)`
\newline Return the row vector consisting of the first n elements of rv. +`r since("2.0")` \index{{\tt \bfseries head }!{\tt (array[] T sv, int n): array[] T}|hyperpage} @@ -1213,18 +1379,21 @@ Return the row vector consisting of the first n elements of rv. `array[] T` **`head`**`(array[] T sv, int n)`
\newline Return the array consisting of the first n elements of sv; applies to up to three-dimensional arrays containing any type of elements `T`. +`r since("2.0")` \index{{\tt \bfseries tail }!{\tt (vector v, int n): vector}|hyperpage} `vector` **`tail`**`(vector v, int n)`
\newline Return the vector consisting of the last n elements of v. +`r since("2.0")` \index{{\tt \bfseries tail }!{\tt (row\_vector rv, int n): row\_vector}|hyperpage} `row_vector` **`tail`**`(row_vector rv, int n)`
\newline Return the row vector consisting of the last n elements of rv. +`r since("2.0")` \index{{\tt \bfseries tail }!{\tt (array[] T sv, int n): array[] T}|hyperpage} @@ -1232,6 +1401,7 @@ Return the row vector consisting of the last n elements of rv. `array[] T` **`tail`**`(array[] T sv, int n)`
\newline Return the array consisting of the last n elements of sv; applies to up to three-dimensional arrays containing any type of elements `T`. +`r since("2.0")` \index{{\tt \bfseries segment }!{\tt (vector v, int i, int n): vector}|hyperpage} @@ -1239,6 +1409,7 @@ up to three-dimensional arrays containing any type of elements `T`. `vector` **`segment`**`(vector v, int i, int n)`
\newline Return the vector consisting of the n elements of v starting at i; i.e., elements i through through i + n - 1. +`r since("2.0")` \index{{\tt \bfseries segment }!{\tt (row\_vector rv, int i, int n): row\_vector}|hyperpage} @@ -1246,6 +1417,7 @@ i.e., elements i through through i + n - 1. `row_vector` **`segment`**`(row_vector rv, int i, int n)`
\newline Return the row vector consisting of the n elements of rv starting at i; i.e., elements i through through i + n - 1. +`r since("2.10")` \index{{\tt \bfseries segment }!{\tt (array[] T sv, int i, int n): array[] T}|hyperpage} @@ -1254,6 +1426,7 @@ i; i.e., elements i through through i + n - 1. Return the array consisting of the n elements of sv starting at i; i.e., elements i through through i + n - 1. Applies to up to three-dimensional arrays containing any type of elements `T`. +`r since("2.0")` ## Matrix concatenation {#matrix-concatenation} @@ -1268,6 +1441,7 @@ are like the operations `cbind` and `rbind` in R. `matrix` **`append_col`**`(matrix x, matrix y)`
\newline Combine matrices x and y by columns. The matrices must have the same number of rows. +`r since("2.5")` \index{{\tt \bfseries append\_col }!{\tt (matrix x, vector y): matrix}|hyperpage} @@ -1275,6 +1449,7 @@ number of rows. `matrix` **`append_col`**`(matrix x, vector y)`
\newline Combine matrix x and vector y by columns. The matrix and the vector must have the same number of rows. +`r since("2.5")` \index{{\tt \bfseries append\_col }!{\tt (vector x, matrix y): matrix}|hyperpage} @@ -1282,6 +1457,7 @@ must have the same number of rows. `matrix` **`append_col`**`(vector x, matrix y)`
\newline Combine vector x and matrix y by columns. The vector and the matrix must have the same number of rows. +`r since("2.5")` \index{{\tt \bfseries append\_col }!{\tt (vector x, vector y): matrix}|hyperpage} @@ -1289,24 +1465,28 @@ must have the same number of rows. `matrix` **`append_col`**`(vector x, vector y)`
\newline Combine vectors x and y by columns. The vectors must have the same number of rows. +`r since("2.5")` \index{{\tt \bfseries append\_col }!{\tt (row\_vector x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`append_col`**`(row_vector x, row_vector y)`
\newline Combine row vectors x and y of any size into another row vector. +`r since("2.5")` \index{{\tt \bfseries append\_col }!{\tt (real x, row\_vector y): row\_vector}|hyperpage} `row_vector` **`append_col`**`(real x, row_vector y)`
\newline Append x to the front of y, returning another row vector. +`r since("2.12")` \index{{\tt \bfseries append\_col }!{\tt (row\_vector x, real y): row\_vector}|hyperpage} `row_vector` **`append_col`**`(row_vector x, real y)`
\newline Append y to the end of x, returning another row vector. +`r since("2.12")` #### Vertical concatenation @@ -1316,6 +1496,7 @@ Append y to the end of x, returning another row vector. `matrix` **`append_row`**`(matrix x, matrix y)`
\newline Combine matrices x and y by rows. The matrices must have the same number of columns. +`r since("2.5")` \index{{\tt \bfseries append\_row }!{\tt (matrix x, row\_vector y): matrix}|hyperpage} @@ -1323,6 +1504,7 @@ number of columns. `matrix` **`append_row`**`(matrix x, row_vector y)`
\newline Combine matrix x and row vector y by rows. The matrix and the row vector must have the same number of columns. +`r since("2.5")` \index{{\tt \bfseries append\_row }!{\tt (row\_vector x, matrix y): matrix}|hyperpage} @@ -1330,6 +1512,7 @@ vector must have the same number of columns. `matrix` **`append_row`**`(row_vector x, matrix y)`
\newline Combine row vector x and matrix y by rows. The row vector and the matrix must have the same number of columns. +`r since("2.5")` \index{{\tt \bfseries append\_row }!{\tt (row\_vector x, row\_vector y): matrix}|hyperpage} @@ -1337,24 +1520,28 @@ matrix must have the same number of columns. `matrix` **`append_row`**`(row_vector x, row_vector y)`
\newline Combine row vectors x and y by row. The row vectors must have the same number of columns. +`r since("2.5")` \index{{\tt \bfseries append\_row }!{\tt (vector x, vector y): vector}|hyperpage} `vector` **`append_row`**`(vector x, vector y)`
\newline Concatenate vectors x and y of any size into another vector. +`r since("2.5")` \index{{\tt \bfseries append\_row }!{\tt (real x, vector y): vector}|hyperpage} `vector` **`append_row`**`(real x, vector y)`
\newline Append x to the top of y, returning another vector. +`r since("2.12")` \index{{\tt \bfseries append\_row }!{\tt (vector x, real y): vector}|hyperpage} `vector` **`append_row`**`(vector x, real y)`
\newline Append y to the bottom of x, returning another vector. +`r since("2.12")` ## Special matrix functions {#softmax} @@ -1382,12 +1569,14 @@ Stan provides the following functions for softmax and its log. `vector` **`softmax`**`(vector x)`
\newline The softmax of x +`r since("2.0")` \index{{\tt \bfseries log\_softmax }!{\tt (vector x): vector}|hyperpage} `vector` **`log_softmax`**`(vector x)`
\newline The natural logarithm of the softmax of x +`r since("2.0")` ### Cumulative sums @@ -1399,18 +1588,21 @@ $y_1,\ldots,y_N$, where \[ y_n = \sum_{m = 1}^{n} x_m. \] `array[] real` **`cumulative_sum`**`(array[] real x)`
\newline The cumulative sum of x +`r since("2.0")` \index{{\tt \bfseries cumulative\_sum }!{\tt (vector v): vector}|hyperpage} `vector` **`cumulative_sum`**`(vector v)`
\newline The cumulative sum of v +`r since("2.0")` \index{{\tt \bfseries cumulative\_sum }!{\tt (row\_vector rv): row\_vector}|hyperpage} `row_vector` **`cumulative_sum`**`(row_vector rv)`
\newline The cumulative sum of rv +`r since("2.0")` ## Covariance functions {#covariance} @@ -1439,18 +1631,21 @@ $K_{i,j} = k(x_i, x^\prime_j)$. `matrix` **`cov_exp_quad`**`(row_vectors x, real alpha, real rho)`
\newline The covariance matrix with an exponentiated quadratic kernel of x. +`r since("2.16")` \index{{\tt \bfseries cov\_exp\_quad }!{\tt (vectors x, real alpha, real rho): matrix}|hyperpage} `matrix` **`cov_exp_quad`**`(vectors x, real alpha, real rho)`
\newline The covariance matrix with an exponentiated quadratic kernel of x. +`r since("2.16")` \index{{\tt \bfseries cov\_exp\_quad }!{\tt (array[] real x, real alpha, real rho): matrix}|hyperpage} `matrix` **`cov_exp_quad`**`(array[] real x, real alpha, real rho)`
\newline The covariance matrix with an exponentiated quadratic kernel of x. +`r since("2.16")` \index{{\tt \bfseries cov\_exp\_quad }!{\tt (row\_vectors x1, row\_vectors x2, real alpha, real rho): matrix}|hyperpage} @@ -1458,6 +1653,7 @@ The covariance matrix with an exponentiated quadratic kernel of x. `matrix` **`cov_exp_quad`**`(row_vectors x1, row_vectors x2, real alpha, real rho)`
\newline The covariance matrix with an exponentiated quadratic kernel of x1 and x2. +`r since("2.18")` \index{{\tt \bfseries cov\_exp\_quad }!{\tt (vectors x1, vectors x2, real alpha, real rho): matrix}|hyperpage} @@ -1465,6 +1661,7 @@ x2. `matrix` **`cov_exp_quad`**`(vectors x1, vectors x2, real alpha, real rho)`
\newline The covariance matrix with an exponentiated quadratic kernel of x1 and x2. +`r since("2.18")` \index{{\tt \bfseries cov\_exp\_quad }!{\tt (array[] real x1, array[] real x2, real alpha, real rho): matrix}|hyperpage} @@ -1472,6 +1669,7 @@ x2. `matrix` **`cov_exp_quad`**`(array[] real x1, array[] real x2, real alpha, real rho)`
\newline The covariance matrix with an exponentiated quadratic kernel of x1 and x2. +`r since("2.18")` ## Linear algebra functions and solvers @@ -1489,25 +1687,28 @@ positive-definite matrices. `row_vector` **`operator/`**`(row_vector b, matrix A)`
\newline The right division of b by A; equivalently `b * inverse(A)` +`r since("2.0")` \index{{\tt \bfseries operator\_divide }!{\tt (matrix B, matrix A): matrix}|hyperpage} `matrix` **`operator/`**`(matrix B, matrix A)`
\newline The right division of B by A; equivalently `B * inverse(A)` +`r since("2.5")` \index{{\tt \bfseries operator\_left\_div }!{\tt (matrix A, vector b): vector}|hyperpage} `vector` **`operator\`**`(matrix A, vector b)`
\newline The left division of A by b; equivalently `inverse(A) * b` - +`r since("2.18")` \index{{\tt \bfseries operator\_left\_div }!{\tt (matrix A, matrix B): matrix}|hyperpage} `matrix` **`operator\`**`(matrix A, matrix B)`
\newline The left division of A by B; equivalently `inverse(A) * B` +`r since("2.18")` #### Lower-triangular matrix division functions @@ -1527,6 +1728,7 @@ The left division of b by a lower-triangular view of A; algebraically equivalent to the less efficient and stable form `inverse(tri(A)) * b`, where `tri(A)` is the lower-triangular portion of A with the above-diagonal entries set to zero. +`r since("2.12")` \index{{\tt \bfseries mdivide\_left\_tri\_low }!{\tt (matrix A, matrix B): matrix}|hyperpage} @@ -1536,6 +1738,7 @@ The left division of B by a triangular view of A; algebraically equivalent to the less efficient and stable form `inverse(tri(A)) * B`, where `tri(A)` is the lower-triangular portion of A with the above-diagonal entries set to zero. +`r since("2.5")` \index{{\tt \bfseries mdivide\_right\_tri\_low }!{\tt (row\_vector b, matrix A): row\_vector}|hyperpage} @@ -1545,6 +1748,7 @@ The right division of b by a triangular view of A; algebraically equivalent to the less efficient and stable form `b * inverse(tri(A))`, where `tri(A)` is the lower-triangular portion of A with the above-diagonal entries set to zero. +`r since("2.12")` \index{{\tt \bfseries mdivide\_right\_tri\_low }!{\tt (matrix B, matrix A): matrix}|hyperpage} @@ -1554,6 +1758,7 @@ The right division of B by a triangular view of A; algebraically equivalent to the less efficient and stable form `B * inverse(tri(A))`, where `tri(A)` is the lower-triangular portion of A with the above-diagonal entries set to zero. +`r since("2.5")` ### Symmetric positive-definite matrix division functions @@ -1569,6 +1774,7 @@ these will reject and print warnings. The left division of b by the symmetric, positive-definite matrix A; algebraically equivalent to the less efficient and stable form `inverse(A) * b`. +`r since("2.12")` \index{{\tt \bfseries mdivide\_left\_spd }!{\tt (matrix A, matrix B): vector}|hyperpage} @@ -1577,22 +1783,25 @@ algebraically equivalent to the less efficient and stable form The left division of B by the symmetric, positive-definite matrix A; algebraically equivalent to the less efficient and stable form `inverse(A) * B`. +`r since("2.12")` \index{{\tt \bfseries mdivide\_right\_spd }!{\tt (row\_vector b, matrix A): row\_vector}|hyperpage} `row_vector` **`mdivide_right_spd`**`(row_vector b, matrix A)`
\newline The right division of b by the symmetric, positive-definite matrix A; -algebraically equivalent to the less efficient and stable form `b * -inverse(A)`. +algebraically equivalent to the less efficient and stable form +`b *inverse(A)`. +`r since("2.12")` \index{{\tt \bfseries mdivide\_right\_spd }!{\tt (matrix B, matrix A): matrix}|hyperpage} `matrix` **`mdivide_right_spd`**`(matrix B, matrix A)`
\newline The right division of B by the symmetric, positive-definite matrix A; -algebraically equivalent to the less efficient and stable form `B * -inverse(A)`. +algebraically equivalent to the less efficient and stable form +`B * inverse(A)`. +`r since("2.12")` ### Matrix exponential @@ -1605,6 +1814,7 @@ convergent power series: \[ e^A = \sum_{n=0}^{\infty} \dfrac{A^n}{n!} `matrix` **`matrix_exp`**`(matrix A)`
\newline The matrix exponential of A +`r since("2.13")` \index{{\tt \bfseries matrix\_exp\_multiply }!{\tt (matrix A, matrix B): matrix}|hyperpage} @@ -1612,6 +1822,7 @@ The matrix exponential of A `matrix` **`matrix_exp_multiply`**`(matrix A, matrix B)`
\newline The multiplication of matrix exponential of A and matrix B; algebraically equivalent to the less efficient form `matrix_exp(A) * B`. +`r since("2.18")` \index{{\tt \bfseries scale\_matrix\_exp\_multiply }!{\tt (real t, matrix A, matrix B): matrix}|hyperpage} @@ -1619,6 +1830,7 @@ algebraically equivalent to the less efficient form `matrix_exp(A) * B`. `matrix` **`scale_matrix_exp_multiply`**`(real t, matrix A, matrix B)`
\newline The multiplication of matrix exponential of tA and matrix B; algebraically equivalent to the less efficient form `matrix_exp(t * A) * B`. +`r since("2.18")` ### Matrix power @@ -1629,6 +1841,7 @@ Returns the nth power of the specific matrix: \[ M^n = M_1 * ... * M_n \] `matrix` **`matrix_power`**`(matrix A, int B)`
\newline Matrix A raised to the power B. +`r since("2.24")` ### Linear algebra functions @@ -1639,6 +1852,7 @@ Matrix A raised to the power B. `real` **`trace`**`(matrix A)`
\newline The trace of A, or 0 if A is empty; A is not required to be diagonal +`r since("2.0")` #### Determinants @@ -1647,12 +1861,14 @@ The trace of A, or 0 if A is empty; A is not required to be diagonal `real` **`determinant`**`(matrix A)`
\newline The determinant of A +`r since("2.0")` \index{{\tt \bfseries log\_determinant }!{\tt (matrix A): real}|hyperpage} `real` **`log_determinant`**`(matrix A)`
\newline The log of the absolute value of the determinant of A +`r since("2.0")` #### Inverses @@ -1674,6 +1890,7 @@ function, which returns `1 / m[i, j]` for each element. `matrix` **`inverse`**`(matrix A)`
\newline Compute the inverse of A +`r since("2.0")` \index{{\tt \bfseries inverse\_spd }!{\tt (matrix A): matrix}|hyperpage} @@ -1682,6 +1899,7 @@ Compute the inverse of A Compute the inverse of A where A is symmetric, positive definite. This version is faster and more arithmetically stable when the input is symmetric and positive definite. +`r since("2.0")` \index{{\tt \bfseries chol2inv }!{\tt (matrix L): matrix}|hyperpage} @@ -1689,6 +1907,7 @@ and positive definite. `matrix` **`chol2inv`**`(matrix L)`
\newline Compute the inverse of the matrix whose cholesky factorization is L. That is, for $A = L L^T$, return $A^{-1}$. +`r since("2.26")` #### Generalized Inverse @@ -1705,11 +1924,11 @@ make the matrix change rank. For example, considered the rank of the matrix $A$ as a function of $\epsilon$: $$ -A = \left( - \begin{array}{cccc} +A = \left( + \begin{array}{cccc} 1 + \epsilon & 2 & 1 \\ - 2 & 4 & 2 - \end{array} + 2 & 4 & 2 + \end{array} \right) $$ @@ -1725,6 +1944,7 @@ of differentiability creates undefined behavior. `matrix` **`generalized_inverse`**`(matrix A)`
\newline The generalized inverse of A +`r since("2.26")` #### Eigendecomposition @@ -1733,6 +1953,7 @@ The generalized inverse of A `vector` **`eigenvalues_sym`**`(matrix A)`
\newline The vector of eigenvalues of a symmetric matrix A in ascending order +`r since("2.0")` \index{{\tt \bfseries eigenvectors\_sym }!{\tt (matrix A): matrix}|hyperpage} @@ -1740,6 +1961,7 @@ The vector of eigenvalues of a symmetric matrix A in ascending order `matrix` **`eigenvectors_sym`**`(matrix A)`
\newline The matrix with the (column) eigenvectors of symmetric matrix A in the same order as returned by the function `eigenvalues_sym` +`r since("2.0")` Because multiplying an eigenvector by $-1$ results in an eigenvector, eigenvectors returned by a decomposition are only identified up to a @@ -1763,6 +1985,7 @@ eigenvalues of 0). `matrix` **`qr_thin_Q`**`(matrix A)`
\newline The orthogonal matrix in the thin QR decomposition of A, which implies that the resulting matrix has the same dimensions as A +`r since("2.18")` \index{{\tt \bfseries qr\_thin\_r }!{\tt (matrix A): matrix}|hyperpage} @@ -1771,6 +1994,7 @@ that the resulting matrix has the same dimensions as A The upper triangular matrix in the thin QR decomposition of A, which implies that the resulting matrix is square with the same number of columns as A +`r since("2.18")` \index{{\tt \bfseries qr\_q }!{\tt (matrix A): matrix}|hyperpage} @@ -1778,6 +2002,7 @@ columns as A `matrix` **`qr_Q`**`(matrix A)`
\newline The orthogonal matrix in the fat QR decomposition of A, which implies that the resulting matrix is square with the same number of rows as A +`r since("2.3")` \index{{\tt \bfseries qr\_r }!{\tt (matrix A): matrix}|hyperpage} @@ -1786,6 +2011,7 @@ that the resulting matrix is square with the same number of rows as A The upper trapezoidal matrix in the fat QR decomposition of A, which implies that the resulting matrix will be rectangular with the same dimensions as A +`r since("2.3")` The thin QR decomposition is always preferable because it will consume much less memory when the input matrix is large than will the fat QR @@ -1813,6 +2039,7 @@ lower-triangular vector $L$ such that \[ \Sigma = L \, L^{\top}. \] `matrix` **`cholesky_decompose`**`(matrix A)`
\newline The lower-triangular Cholesky factor of the symmetric positive-definite matrix A +`r since("2.0")` #### Singular value decomposition @@ -1826,18 +2053,21 @@ $M = min(N, P)$, U is size $N$ by $M$ and V is size $P$ by $M$. `vector` **`singular_values`**`(matrix A)`
\newline The singular values of A in descending order +`r since("2.0")` \index{{\tt \bfseries svd\_U }!{\tt (matrix A): vector}|hyperpage} `vector` **`svd_U`**`(matrix A)`
\newline The left-singular vectors of A +`r since("2.26")` \index{{\tt \bfseries svd\_V }!{\tt (matrix A): vector}|hyperpage} `vector` **`svd_V`**`(matrix A)`
\newline The right-singular vectors of A +`r since("2.26")` ## Sort functions @@ -1849,24 +2079,28 @@ the functions work. `vector` **`sort_asc`**`(vector v)`
\newline Sort the elements of v in ascending order +`r since("2.0")` \index{{\tt \bfseries sort\_asc }!{\tt (row\_vector v): row\_vector}|hyperpage} `row_vector` **`sort_asc`**`(row_vector v)`
\newline Sort the elements of v in ascending order +`r since("2.0")` \index{{\tt \bfseries sort\_desc }!{\tt (vector v): vector}|hyperpage} `vector` **`sort_desc`**`(vector v)`
\newline Sort the elements of v in descending order +`r since("2.0")` \index{{\tt \bfseries sort\_desc }!{\tt (row\_vector v): row\_vector}|hyperpage} `row_vector` **`sort_desc`**`(row_vector v)`
\newline Sort the elements of v in descending order +`r since("2.0")` \index{{\tt \bfseries sort\_indices\_asc }!{\tt (vector v): array[] int}|hyperpage} @@ -1874,6 +2108,7 @@ Sort the elements of v in descending order `array[] int` **`sort_indices_asc`**`(vector v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in ascending order. +`r since("2.3")` \index{{\tt \bfseries sort\_indices\_asc }!{\tt (row\_vector v): array[] int}|hyperpage} @@ -1881,6 +2116,7 @@ index v in ascending order. `array[] int` **`sort_indices_asc`**`(row_vector v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in ascending order. +`r since("2.3")` \index{{\tt \bfseries sort\_indices\_desc }!{\tt (vector v): array[] int}|hyperpage} @@ -1888,6 +2124,7 @@ index v in ascending order. `array[] int` **`sort_indices_desc`**`(vector v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in descending order. +`r since("2.3")` \index{{\tt \bfseries sort\_indices\_desc }!{\tt (row\_vector v): array[] int}|hyperpage} @@ -1895,18 +2132,21 @@ index v in descending order. `array[] int` **`sort_indices_desc`**`(row_vector v)`
\newline Return an array of indices between 1 and the size of v, sorted to index v in descending order. +`r since("2.3")` \index{{\tt \bfseries rank }!{\tt (vector v, int s): int}|hyperpage} `int` **`rank`**`(vector v, int s)`
\newline Number of components of v less than v[s] +`r since("2.0")` \index{{\tt \bfseries rank }!{\tt (row\_vector v, int s): int}|hyperpage} `int` **`rank`**`(row_vector v, int s)`
\newline Number of components of v less than v[s] +`r since("2.0")` ## Reverse functions {#reverse-functions} @@ -1915,9 +2155,11 @@ Number of components of v less than v[s] `vector` **`reverse`**`(vector v)`
\newline Return a new vector containing the elements of the argument in reverse order. +`r since("2.23")` \index{{\tt \bfseries reverse }!{\tt (row\_vector v): row\_vector}|hyperpage} `row_vector` **`reverse`**`(row_vector v)`
\newline Return a new row vector containing the elements of the argument in reverse order. +`r since("2.23")` diff --git a/src/functions-reference/mixed_operations.Rmd b/src/functions-reference/mixed_operations.Rmd index 86bf602e1..fa32d4321 100644 --- a/src/functions-reference/mixed_operations.Rmd +++ b/src/functions-reference/mixed_operations.Rmd @@ -8,18 +8,21 @@ vector, row vector and arrays. `matrix` **`to_matrix`**`(matrix m)`
\newline Return the matrix m itself. +`r since("2.3")` \index{{\tt \bfseries to\_matrix }!{\tt (vector v): matrix}|hyperpage} `matrix` **`to_matrix`**`(vector v)`
\newline Convert the column vector v to a `size(v)` by 1 matrix. +`r since("2.3")` \index{{\tt \bfseries to\_matrix }!{\tt (row\_vector v): matrix}|hyperpage} `matrix` **`to_matrix`**`(row_vector v)`
\newline Convert the row vector v to a 1 by `size(v)` matrix. +`r since("2.3")` \index{{\tt \bfseries to\_matrix }!{\tt (matrix m, int m, int n): matrix}|hyperpage} @@ -27,6 +30,7 @@ Convert the row vector v to a 1 by `size(v)` matrix. `matrix` **`to_matrix`**`(matrix m, int m, int n)`
\newline Convert a matrix m to a matrix with m rows and n columns filled in column-major order. +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (vector v, int m, int n): matrix}|hyperpage} @@ -34,6 +38,7 @@ column-major order. `matrix` **`to_matrix`**`(vector v, int m, int n)`
\newline Convert a vector v to a matrix with m rows and n columns filled in column-major order. +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (row\_vector v, int m, int n): matrix}|hyperpage} @@ -41,6 +46,7 @@ column-major order. `matrix` **`to_matrix`**`(row_vector v, int m, int n)`
\newline Convert a row_vector a to a matrix with m rows and n columns filled in column-major order. +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (matrix m, int m, int n, int col\_major): matrix}|hyperpage} @@ -49,6 +55,7 @@ column-major order. Convert a matrix m to a matrix with m rows and n columns filled in row-major order if col_major equals 0 (otherwise, they get filled in column-major order). +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (vector v, int m, int n, int col\_major): matrix}|hyperpage} @@ -57,6 +64,7 @@ column-major order). Convert a vector v to a matrix with m rows and n columns filled in row-major order if col_major equals 0 (otherwise, they get filled in column-major order). +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (row\_vector v, int m, int n, int col\_major): matrix}|hyperpage} @@ -65,6 +73,7 @@ column-major order). Convert a row_vector a to a matrix with m rows and n columns filled in row-major order if col_major equals 0 (otherwise, they get filled in column-major order). +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (array[] real a, int m, int n): matrix}|hyperpage} @@ -72,6 +81,7 @@ column-major order). `matrix` **`to_matrix`**`(array[] real a, int m, int n)`
\newline Convert a one-dimensional array a to a matrix with m rows and n columns filled in column-major order. +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (array[] int a, int m, int n): matrix}|hyperpage} @@ -79,6 +89,7 @@ columns filled in column-major order. `matrix` **`to_matrix`**`(array[] int a, int m, int n)`
\newline Convert a one-dimensional array a to a matrix with m rows and n columns filled in column-major order. +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (array[] real a, int m, int n, int col\_major): matrix}|hyperpage} @@ -87,6 +98,7 @@ columns filled in column-major order. Convert a one-dimensional array a to a matrix with m rows and n columns filled in row-major order if col_major equals 0 (otherwise, they get filled in column-major order). +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (array[] int a, int m, int n, int col\_major): matrix}|hyperpage} @@ -95,6 +107,7 @@ they get filled in column-major order). Convert a one-dimensional array a to a matrix with m rows and n columns filled in row-major order if col_major equals 0 (otherwise, they get filled in column-major order). +`r since("2.15")` \index{{\tt \bfseries to\_matrix }!{\tt (array[,] real a): matrix}|hyperpage} @@ -102,6 +115,7 @@ they get filled in column-major order). `matrix` **`to_matrix`**`(array[,] real a)`
\newline Convert the two dimensional array a to a matrix with the same dimensions and indexing order. +`r since("2.3")` \index{{\tt \bfseries to\_matrix }!{\tt (array[,] int a): matrix}|hyperpage} @@ -110,66 +124,77 @@ dimensions and indexing order. Convert the two dimensional array a to a matrix with the same dimensions and indexing order. If any of the dimensions of a are zero, the result will be a $0 \times 0$ matrix. +`r since("2.3")` \index{{\tt \bfseries to\_vector }!{\tt (matrix m): vector}|hyperpage} `vector` **`to_vector`**`(matrix m)`
\newline Convert the matrix m to a column vector in column-major order. +`r since("2.0")` \index{{\tt \bfseries to\_vector }!{\tt (vector v): vector}|hyperpage} `vector` **`to_vector`**`(vector v)`
\newline Return the column vector v itself. +`r since("2.3")` \index{{\tt \bfseries to\_vector }!{\tt (row\_vector v): vector}|hyperpage} `vector` **`to_vector`**`(row_vector v)`
\newline Convert the row vector v to a column vector. +`r since("2.3")` \index{{\tt \bfseries to\_vector }!{\tt (array[] real a): vector}|hyperpage} `vector` **`to_vector`**`(array[] real a)`
\newline Convert the one-dimensional array a to a column vector. +`r since("2.3")` \index{{\tt \bfseries to\_vector }!{\tt (array[] int a): vector}|hyperpage} `vector` **`to_vector`**`(array[] int a)`
\newline Convert the one-dimensional integer array a to a column vector. +`r since("2.3")` \index{{\tt \bfseries to\_row\_vector }!{\tt (matrix m): row\_vector}|hyperpage} `row_vector` **`to_row_vector`**`(matrix m)`
\newline Convert the matrix m to a row vector in column-major order. +`r since("2.3")` \index{{\tt \bfseries to\_row\_vector }!{\tt (vector v): row\_vector}|hyperpage} `row_vector` **`to_row_vector`**`(vector v)`
\newline Convert the column vector v to a row vector. +`r since("2.3")` \index{{\tt \bfseries to\_row\_vector }!{\tt (row\_vector v): row\_vector}|hyperpage} `row_vector` **`to_row_vector`**`(row_vector v)`
\newline Return the row vector v itself. +`r since("2.3")` \index{{\tt \bfseries to\_row\_vector }!{\tt (array[] real a): row\_vector}|hyperpage} `row_vector` **`to_row_vector`**`(array[] real a)`
\newline Convert the one-dimensional array a to a row vector. +`r since("2.3")` \index{{\tt \bfseries to\_row\_vector }!{\tt (array[] int a): row\_vector}|hyperpage} `row_vector` **`to_row_vector`**`(array[] int a)`
\newline Convert the one-dimensional array a to a row vector. +`r since("2.3")` \index{{\tt \bfseries to\_array\_2d }!{\tt (matrix m): array[,] real}|hyperpage} @@ -177,24 +202,28 @@ Convert the one-dimensional array a to a row vector. `array[,] real` **`to_array_2d`**`(matrix m)`
\newline Convert the matrix m to a two dimensional array with the same dimensions and indexing order. +`r since("2.3")` \index{{\tt \bfseries to\_array\_1d }!{\tt (vector v): array[] real}|hyperpage} `array[] real` **`to_array_1d`**`(vector v)`
\newline Convert the column vector v to a one-dimensional array. +`r since("2.3")` \index{{\tt \bfseries to\_array\_1d }!{\tt (row\_vector v): array[] real}|hyperpage} `array[] real` **`to_array_1d`**`(row_vector v)`
\newline Convert the row vector v to a one-dimensional array. +`r since("2.3")` \index{{\tt \bfseries to\_array\_1d }!{\tt (matrix m): array[] real}|hyperpage} `array[] real` **`to_array_1d`**`(matrix m)`
\newline Convert the matrix m to a one-dimensional array in column-major order. +`r since("2.3")` \index{{\tt \bfseries to\_array\_1d }!{\tt (array[...] real a): array[] real}|hyperpage} @@ -202,6 +231,7 @@ Convert the matrix m to a one-dimensional array in column-major order. `array[] real` **`to_array_1d`**`(array[...] real a)`
\newline Convert the array a (of any dimension up to 10) to a one-dimensional array in row-major order. +`r since("2.3")` \index{{\tt \bfseries to\_array\_1d }!{\tt (array[...] int a): array[] int}|hyperpage} @@ -209,4 +239,4 @@ array in row-major order. `array[] int` **`to_array_1d`**`(array[...] int a)`
\newline Convert the array a (of any dimension up to 10) to a one-dimensional array in row-major order. - +`r since("2.3")` diff --git a/src/functions-reference/multivariate_discrete_distributions.Rmd b/src/functions-reference/multivariate_discrete_distributions.Rmd index 5f88c6794..6baa948aa 100644 --- a/src/functions-reference/multivariate_discrete_distributions.Rmd +++ b/src/functions-reference/multivariate_discrete_distributions.Rmd @@ -26,6 +26,7 @@ multinomial coefficient is defined by \[ \binom{N}{y_1,\ldots,y_k} = `y ~ ` **`multinomial`**`(theta)` Increment target log probability density with `multinomial_lupmf(y | theta)`. +`r since("2.0")` \index{{\tt \bfseries multinomial }!sampling statement|hyperpage} @@ -38,6 +39,7 @@ Increment target log probability density with `multinomial_lupmf(y | theta)`. The log multinomial probability mass function with outcome array `y` of size $K$ given the $K$-simplex distribution parameter theta and (implicit) total count `N = sum(y)` +`r since("2.12")` \index{{\tt \bfseries multinomial\_lupmf }!{\tt (array[] int y \textbar\ vector theta): real}|hyperpage} @@ -46,6 +48,7 @@ of size $K$ given the $K$-simplex distribution parameter theta and The log multinomial probability mass function with outcome array `y` of size $K$ given the $K$-simplex distribution parameter theta and (implicit) total count `N = sum(y)` dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries multinomial\_rng }!{\tt (vector theta, int N): array[] int}|hyperpage} @@ -54,6 +57,7 @@ of size $K$ given the $K$-simplex distribution parameter theta and Generate a multinomial variate with simplex distribution parameter theta and total count $N$; may only be used in transformed data and generated quantities blocks +`r since("2.8")` ## Multinomial distribution, logit parameterization @@ -77,6 +81,7 @@ multinomial coefficient is defined by \[ \binom{N}{y_1,\ldots,y_k} = `y ~ ` **`multinomial_logit`**`(theta)` Increment target log probability density with `multinomial_logit_lupmf(y | theta)`. +`r since("2.24")` \index{{\tt \bfseries multinomial\_logit }!sampling statement|hyperpage} @@ -89,6 +94,7 @@ Increment target log probability density with `multinomial_logit_lupmf(y | theta The log multinomial probability mass function with outcome array `y` of size $K$ given the $K$-simplex distribution parameter $\text{softmax}^{-1}(\theta)$ and (implicit) total count `N = sum(y)` +`r since("2.24")` \index{{\tt \bfseries multinomial\_logit\_lupmf }!{\tt (array[] int y \textbar\ vector theta): real}|hyperpage} @@ -96,7 +102,8 @@ of size $K$ given the $K$-simplex distribution parameter $\text{softmax}^{-1}(\t `real` **`multinomial_logit_lupmf`**`(array[] int y | vector theta)`
\newline The log multinomial probability mass function with outcome array `y` of size $K$ given the $K$-simplex distribution parameter $\text{softmax}^{-1}(\theta)$ and (implicit) total count `N = sum(y)` dropping constant additive - terms +terms +`r since("2.25")` \index{{\tt \bfseries multinomial\_logit\_rng }!{\tt (vector theta, int N): array[] int}|hyperpage} @@ -105,3 +112,4 @@ of size $K$ given the $K$-simplex distribution parameter $\text{softmax}^{-1}(\t Generate a multinomial variate with simplex distribution parameter $\text{softmax}^{-1}(\theta)$ and total count $N$; may only be used in transformed data and generated quantities blocks +`r since("2.24")` diff --git a/src/functions-reference/positive_continuous_distributions.Rmd b/src/functions-reference/positive_continuous_distributions.Rmd index 57bc765a7..58a33de95 100644 --- a/src/functions-reference/positive_continuous_distributions.Rmd +++ b/src/functions-reference/positive_continuous_distributions.Rmd @@ -32,6 +32,7 @@ If $\mu \in \mathbb{R}$ and $\sigma \in \mathbb{R}^+$, then for $y \in `y ~ ` **`lognormal`**`(mu, sigma)` Increment target log probability density with `lognormal_lupdf(y | mu, sigma)`. +`r since("2.0")` \index{{\tt \bfseries lognormal }!sampling statement|hyperpage} @@ -43,6 +44,7 @@ Increment target log probability density with `lognormal_lupdf(y | mu, sigma)`. `real` **`lognormal_lpdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the lognormal density of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries lognormal\_lupdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -50,6 +52,7 @@ sigma `real` **`lognormal_lupdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the lognormal density of y given location mu and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries lognormal\_cdf }!{\tt (reals y, reals mu, reals sigma): real}|hyperpage} @@ -57,6 +60,7 @@ sigma dropping constant additive terms `real` **`lognormal_cdf`**`(reals y, reals mu, reals sigma)`
\newline The cumulative lognormal distribution function of y given location mu and scale sigma +`r since("2.0")` \index{{\tt \bfseries lognormal\_lcdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -64,6 +68,7 @@ and scale sigma `real` **`lognormal_lcdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the lognormal cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries lognormal\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -71,6 +76,7 @@ location mu and scale sigma `real` **`lognormal_lccdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the lognormal complementary cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries lognormal\_rng }!{\tt (reals mu, reals sigma): R}|hyperpage} @@ -80,6 +86,7 @@ Generate a lognormal variate with location mu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.22")` ## Chi-square distribution @@ -94,6 +101,7 @@ y^{\nu/2 - 1} \, \exp \! \left( -\, \frac{1}{2} \, y \right) . \] `y ~ ` **`chi_square`**`(nu)` Increment target log probability density with `chi_square_lupdf(y | nu)`. +`r since("2.0")` \index{{\tt \bfseries chi\_square }!sampling statement|hyperpage} @@ -104,6 +112,7 @@ Increment target log probability density with `chi_square_lupdf(y | nu)`. `real` **`chi_square_lpdf`**`(reals y | reals nu)`
\newline The log of the Chi-square density of y given degrees of freedom nu +`r since("2.12")` \index{{\tt \bfseries chi\_square\_lupdf }!{\tt (reals y \textbar\ reals nu): real}|hyperpage} @@ -111,6 +120,7 @@ The log of the Chi-square density of y given degrees of freedom nu `real` **`chi_square_lupdf`**`(reals y | reals nu)`
\newline The log of the Chi-square density of y given degrees of freedom nu dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries chi\_square\_cdf }!{\tt (reals y, reals nu): real}|hyperpage} @@ -118,6 +128,7 @@ dropping constant additive terms `real` **`chi_square_cdf`**`(reals y, reals nu)`
\newline The Chi-square cumulative distribution function of y given degrees of freedom nu +`r since("2.0")` \index{{\tt \bfseries chi\_square\_lcdf }!{\tt (reals y \textbar\ reals nu): real}|hyperpage} @@ -125,6 +136,7 @@ freedom nu `real` **`chi_square_lcdf`**`(reals y | reals nu)`
\newline The log of the Chi-square cumulative distribution function of y given degrees of freedom nu +`r since("2.12")` \index{{\tt \bfseries chi\_square\_lccdf }!{\tt (reals y \textbar\ reals nu): real}|hyperpage} @@ -132,6 +144,7 @@ degrees of freedom nu `real` **`chi_square_lccdf`**`(reals y | reals nu)`
\newline The log of the complementary Chi-square cumulative distribution function of y given degrees of freedom nu +`r since("2.12")` \index{{\tt \bfseries chi\_square\_rng }!{\tt (reals nu): R}|hyperpage} @@ -141,6 +154,7 @@ Generate a Chi-square variate with degrees of freedom nu; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Inverse chi-square distribution @@ -156,6 +170,7 @@ If $\nu \in \mathbb{R}^+$, then for $y \in \mathbb{R}^+$, \[ `y ~ ` **`inv_chi_square`**`(nu)` Increment target log probability density with `inv_chi_square_lupdf(y | nu)`. +`r since("2.0")` \index{{\tt \bfseries inv\_chi\_square }!sampling statement|hyperpage} @@ -167,6 +182,7 @@ Increment target log probability density with `inv_chi_square_lupdf(y | nu)`. `real` **`inv_chi_square_lpdf`**`(reals y | reals nu)`
\newline The log of the inverse Chi-square density of y given degrees of freedom nu +`r since("2.12")` \index{{\tt \bfseries inv\_chi\_square\_lupdf }!{\tt (reals y \textbar\ reals nu): real}|hyperpage} @@ -174,6 +190,7 @@ freedom nu `real` **`inv_chi_square_lupdf`**`(reals y | reals nu)`
\newline The log of the inverse Chi-square density of y given degrees of freedom nu dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries inv\_chi\_square\_cdf }!{\tt (reals y, reals nu): real}|hyperpage} @@ -181,6 +198,7 @@ freedom nu dropping constant additive terms `real` **`inv_chi_square_cdf`**`(reals y, reals nu)`
\newline The inverse Chi-squared cumulative distribution function of y given degrees of freedom nu +`r since("2.0")` \index{{\tt \bfseries inv\_chi\_square\_lcdf }!{\tt (reals y \textbar\ reals nu): real}|hyperpage} @@ -188,6 +206,7 @@ degrees of freedom nu `real` **`inv_chi_square_lcdf`**`(reals y | reals nu)`
\newline The log of the inverse Chi-squared cumulative distribution function of y given degrees of freedom nu +`r since("2.12")` \index{{\tt \bfseries inv\_chi\_square\_lccdf }!{\tt (reals y \textbar\ reals nu): real}|hyperpage} @@ -195,6 +214,7 @@ y given degrees of freedom nu `real` **`inv_chi_square_lccdf`**`(reals y | reals nu)`
\newline The log of the inverse Chi-squared complementary cumulative distribution function of y given degrees of freedom nu +`r since("2.12")` \index{{\tt \bfseries inv\_chi\_square\_rng }!{\tt (reals nu): R}|hyperpage} @@ -204,6 +224,7 @@ Generate an inverse Chi-squared variate with degrees of freedom nu; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Scaled inverse chi-square distribution @@ -220,6 +241,7 @@ y^{-(\nu/2 + 1)} \, \exp \! \left( \! - \, \frac{1}{2} \, \nu \, `y ~ ` **`scaled_inv_chi_square`**`(nu, sigma)` Increment target log probability density with `scaled_inv_chi_square_lupdf(y | nu, sigma)`. +`r since("2.0")` \index{{\tt \bfseries scaled\_inv\_chi\_square }!sampling statement|hyperpage} @@ -231,6 +253,7 @@ Increment target log probability density with `scaled_inv_chi_square_lupdf(y | n `real` **`scaled_inv_chi_square_lpdf`**`(reals y | reals nu, reals sigma)`
\newline The log of the scaled inverse Chi-square density of y given degrees of freedom nu and scale sigma +`r since("2.12")` \index{{\tt \bfseries scaled\_inv\_chi\_square\_lupdf }!{\tt (reals y \textbar\ reals nu, reals sigma): real}|hyperpage} @@ -238,6 +261,7 @@ freedom nu and scale sigma `real` **`scaled_inv_chi_square_lupdf`**`(reals y | reals nu, reals sigma)`
\newline The log of the scaled inverse Chi-square density of y given degrees of freedom nu and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries scaled\_inv\_chi\_square\_cdf }!{\tt (reals y, reals nu, reals sigma): real}|hyperpage} @@ -245,6 +269,7 @@ freedom nu and scale sigma dropping constant additive terms `real` **`scaled_inv_chi_square_cdf`**`(reals y, reals nu, reals sigma)`
\newline The scaled inverse Chi-square cumulative distribution function of y given degrees of freedom nu and scale sigma +`r since("2.0")` \index{{\tt \bfseries scaled\_inv\_chi\_square\_lcdf }!{\tt (reals y \textbar\ reals nu, reals sigma): real}|hyperpage} @@ -252,6 +277,7 @@ given degrees of freedom nu and scale sigma `real` **`scaled_inv_chi_square_lcdf`**`(reals y | reals nu, reals sigma)`
\newline The log of the scaled inverse Chi-square cumulative distribution function of y given degrees of freedom nu and scale sigma +`r since("2.12")` \index{{\tt \bfseries scaled\_inv\_chi\_square\_lccdf }!{\tt (reals y \textbar\ reals nu, reals sigma): real}|hyperpage} @@ -259,6 +285,7 @@ function of y given degrees of freedom nu and scale sigma `real` **`scaled_inv_chi_square_lccdf`**`(reals y | reals nu, reals sigma)`
\newline The log of the scaled inverse Chi-square complementary cumulative distribution function of y given degrees of freedom nu and scale sigma +`r since("2.12")` \index{{\tt \bfseries scaled\_inv\_chi\_square\_rng }!{\tt (reals nu, reals sigma): R}|hyperpage} @@ -268,6 +295,7 @@ Generate a scaled inverse Chi-squared variate with degrees of freedom nu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Exponential distribution {#exponential-distribution} @@ -281,6 +309,7 @@ If $\beta \in \mathbb{R}^+$, then for $y \in \mathbb{R}^+$, \[ `y ~ ` **`exponential`**`(beta)` Increment target log probability density with `exponential_lupdf(y | beta)`. +`r since("2.0")` \index{{\tt \bfseries exponential }!sampling statement|hyperpage} @@ -291,6 +320,7 @@ Increment target log probability density with `exponential_lupdf(y | beta)`. `real` **`exponential_lpdf`**`(reals y | reals beta)`
\newline The log of the exponential density of y given inverse scale beta +`r since("2.12")` \index{{\tt \bfseries exponential\_lupdf }!{\tt (reals y \textbar\ reals beta): real}|hyperpage} @@ -298,6 +328,7 @@ The log of the exponential density of y given inverse scale beta `real` **`exponential_lupdf`**`(reals y | reals beta)`
\newline The log of the exponential density of y given inverse scale beta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries exponential\_cdf }!{\tt (reals y, reals beta): real}|hyperpage} @@ -305,6 +336,7 @@ dropping constant additive terms `real` **`exponential_cdf`**`(reals y, reals beta)`
\newline The exponential cumulative distribution function of y given inverse scale beta +`r since("2.0")` \index{{\tt \bfseries exponential\_lcdf }!{\tt (reals y \textbar\ reals beta): real}|hyperpage} @@ -312,6 +344,7 @@ scale beta `real` **`exponential_lcdf`**`(reals y | reals beta)`
\newline The log of the exponential cumulative distribution function of y given inverse scale beta +`r since("2.12")` \index{{\tt \bfseries exponential\_lccdf }!{\tt (reals y \textbar\ reals beta): real}|hyperpage} @@ -319,6 +352,7 @@ inverse scale beta `real` **`exponential_lccdf`**`(reals y | reals beta)`
\newline The log of the exponential complementary cumulative distribution function of y given inverse scale beta +`r since("2.12")` \index{{\tt \bfseries exponential\_rng }!{\tt (reals beta): R}|hyperpage} @@ -328,6 +362,7 @@ Generate an exponential variate with inverse scale beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Gamma distribution @@ -343,6 +378,7 @@ If $\alpha \in \mathbb{R}^+$ and $\beta \in \mathbb{R}^+$, then for $y `y ~ ` **`gamma`**`(alpha, beta)` Increment target log probability density with `gamma_lupdf(y | alpha, beta)`. +`r since("2.0")` \index{{\tt \bfseries gamma }!sampling statement|hyperpage} @@ -354,6 +390,7 @@ Increment target log probability density with `gamma_lupdf(y | alpha, beta)`. `real` **`gamma_lpdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the gamma density of y given shape alpha and inverse scale beta +`r since("2.12")` \index{{\tt \bfseries gamma\_lupdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -361,6 +398,7 @@ beta `real` **`gamma_lupdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the gamma density of y given shape alpha and inverse scale beta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries gamma\_cdf }!{\tt (reals y, reals alpha, reals beta): real}|hyperpage} @@ -368,6 +406,7 @@ beta dropping constant additive terms `real` **`gamma_cdf`**`(reals y, reals alpha, reals beta)`
\newline The cumulative gamma distribution function of y given shape alpha and inverse scale beta +`r since("2.0")` \index{{\tt \bfseries gamma\_lcdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -375,6 +414,7 @@ inverse scale beta `real` **`gamma_lcdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the cumulative gamma distribution function of y given shape alpha and inverse scale beta +`r since("2.12")` \index{{\tt \bfseries gamma\_lccdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -382,6 +422,7 @@ alpha and inverse scale beta `real` **`gamma_lccdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the complementary cumulative gamma distribution function of y given shape alpha and inverse scale beta +`r since("2.12")` \index{{\tt \bfseries gamma\_rng }!{\tt (reals alpha, reals beta): R}|hyperpage} @@ -391,6 +432,7 @@ Generate a gamma variate with shape alpha and inverse scale beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Inverse gamma Distribution @@ -406,6 +448,7 @@ If $\alpha \in \mathbb{R}^+$ and $\beta \in \mathbb{R}^+$, then for $y `y ~ ` **`inv_gamma`**`(alpha, beta)` Increment target log probability density with `inv_gamma_lupdf(y | alpha, beta)`. +`r since("2.0")` \index{{\tt \bfseries inv\_gamma }!sampling statement|hyperpage} @@ -417,6 +460,7 @@ Increment target log probability density with `inv_gamma_lupdf(y | alpha, beta)` `real` **`inv_gamma_lpdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the inverse gamma density of y given shape alpha and scale beta +`r since("2.12")` \index{{\tt \bfseries inv\_gamma\_lupdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -424,6 +468,7 @@ beta `real` **`inv_gamma_lupdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the inverse gamma density of y given shape alpha and scale beta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries inv\_gamma\_cdf }!{\tt (reals y, reals alpha, reals beta): real}|hyperpage} @@ -431,6 +476,7 @@ beta dropping constant additive terms `real` **`inv_gamma_cdf`**`(reals y, reals alpha, reals beta)`
\newline The inverse gamma cumulative distribution function of y given shape alpha and scale beta +`r since("2.0")` \index{{\tt \bfseries inv\_gamma\_lcdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -438,6 +484,7 @@ alpha and scale beta `real` **`inv_gamma_lcdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the inverse gamma cumulative distribution function of y given shape alpha and scale beta +`r since("2.12")` \index{{\tt \bfseries inv\_gamma\_lccdf }!{\tt (reals y \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -445,6 +492,7 @@ given shape alpha and scale beta `real` **`inv_gamma_lccdf`**`(reals y | reals alpha, reals beta)`
\newline The log of the inverse gamma complementary cumulative distribution function of y given shape alpha and scale beta +`r since("2.12")` \index{{\tt \bfseries inv\_gamma\_rng }!{\tt (reals alpha, reals beta): R}|hyperpage} @@ -454,6 +502,7 @@ Generate an inverse gamma variate with shape alpha and scale beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Weibull distribution @@ -473,6 +522,7 @@ Note that if $Y \propto \text{Weibull}(\alpha,\sigma)$, then $Y^{-1} `y ~ ` **`weibull`**`(alpha, sigma)` Increment target log probability density with `weibull_lupdf(y | alpha, sigma)`. +`r since("2.0")` \index{{\tt \bfseries weibull }!sampling statement|hyperpage} @@ -483,6 +533,7 @@ Increment target log probability density with `weibull_lupdf(y | alpha, sigma)`. `real` **`weibull_lpdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Weibull density of y given shape alpha and scale sigma +`r since("2.12")` \index{{\tt \bfseries weibull\_lupdf }!{\tt (reals y \textbar\ reals alpha, reals sigma): real}|hyperpage} @@ -490,6 +541,7 @@ The log of the Weibull density of y given shape alpha and scale sigma `real` **`weibull_lupdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Weibull density of y given shape alpha and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries weibull\_cdf }!{\tt (reals y, reals alpha, reals sigma): real}|hyperpage} @@ -497,6 +549,7 @@ dropping constant additive terms `real` **`weibull_cdf`**`(reals y, reals alpha, reals sigma)`
\newline The Weibull cumulative distribution function of y given shape alpha and scale sigma +`r since("2.0")` \index{{\tt \bfseries weibull\_lcdf }!{\tt (reals y \textbar\ reals alpha, reals sigma): real}|hyperpage} @@ -504,6 +557,7 @@ and scale sigma `real` **`weibull_lcdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Weibull cumulative distribution function of y given shape alpha and scale sigma +`r since("2.12")` \index{{\tt \bfseries weibull\_lccdf }!{\tt (reals y \textbar\ reals alpha, reals sigma): real}|hyperpage} @@ -511,6 +565,7 @@ shape alpha and scale sigma `real` **`weibull_lccdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Weibull complementary cumulative distribution function of y given shape alpha and scale sigma +`r since("2.12")` \index{{\tt \bfseries weibull\_rng }!{\tt (reals alpha, reals sigma): R}|hyperpage} @@ -520,6 +575,7 @@ Generate a weibull variate with shape alpha and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Frechet distribution @@ -539,6 +595,7 @@ Note that if $Y \propto \text{Frechet}(\alpha,\sigma)$, then $Y^{-1} `y ~ ` **`frechet`**`(alpha, sigma)` Increment target log probability density with `frechet_lupdf(y | alpha, sigma)`. +`r since("2.5")` \index{{\tt \bfseries frechet }!sampling statement|hyperpage} @@ -549,6 +606,7 @@ Increment target log probability density with `frechet_lupdf(y | alpha, sigma)`. `real` **`frechet_lpdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Frechet density of y given shape alpha and scale sigma +`r since("2.12")` \index{{\tt \bfseries frechet\_lupdf }!{\tt (reals y \textbar\ reals alpha, reals sigma): real}|hyperpage} @@ -556,6 +614,7 @@ The log of the Frechet density of y given shape alpha and scale sigma `real` **`frechet_lupdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Frechet density of y given shape alpha and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries frechet\_cdf }!{\tt (reals y, reals alpha, reals sigma): real}|hyperpage} @@ -563,6 +622,7 @@ dropping constant additive terms `real` **`frechet_cdf`**`(reals y, reals alpha, reals sigma)`
\newline The Frechet cumulative distribution function of y given shape alpha and scale sigma +`r since("2.5")` \index{{\tt \bfseries frechet\_lcdf }!{\tt (reals y \textbar\ reals alpha, reals sigma): real}|hyperpage} @@ -570,6 +630,7 @@ and scale sigma `real` **`frechet_lcdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Frechet cumulative distribution function of y given shape alpha and scale sigma +`r since("2.12")` \index{{\tt \bfseries frechet\_lccdf }!{\tt (reals y \textbar\ reals alpha, reals sigma): real}|hyperpage} @@ -577,6 +638,7 @@ shape alpha and scale sigma `real` **`frechet_lccdf`**`(reals y | reals alpha, reals sigma)`
\newline The log of the Frechet complementary cumulative distribution function of y given shape alpha and scale sigma +`r since("2.12")` \index{{\tt \bfseries frechet\_rng }!{\tt (reals alpha, reals sigma): R}|hyperpage} @@ -586,6 +648,7 @@ Generate a Frechet variate with shape alpha and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Rayleigh distribution @@ -600,6 +663,7 @@ If $\sigma \in \mathbb{R}^+$, then for $y \in [0,\infty)$, \[ `y ~ ` **`rayleigh`**`(sigma)` Increment target log probability density with `rayleigh_lupdf(y | sigma)`. +`r since("2.0")` \index{{\tt \bfseries rayleigh }!sampling statement|hyperpage} @@ -610,6 +674,7 @@ Increment target log probability density with `rayleigh_lupdf(y | sigma)`. `real` **`rayleigh_lpdf`**`(reals y | reals sigma)`
\newline The log of the Rayleigh density of y given scale sigma +`r since("2.12")` \index{{\tt \bfseries rayleigh\_lupdf }!{\tt (reals y \textbar\ reals sigma): real}|hyperpage} @@ -617,18 +682,21 @@ The log of the Rayleigh density of y given scale sigma `real` **`rayleigh_lupdf`**`(reals y | reals sigma)`
\newline The log of the Rayleigh density of y given scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries rayleigh\_cdf }!{\tt (real y, real sigma): real}|hyperpage} `real` **`rayleigh_cdf`**`(real y, real sigma)`
\newline The Rayleigh cumulative distribution of y given scale sigma +`r since("2.0")` \index{{\tt \bfseries rayleigh\_lcdf }!{\tt (real y \textbar\ real sigma): real}|hyperpage} `real` **`rayleigh_lcdf`**`(real y | real sigma)`
\newline The log of the Rayleigh cumulative distribution of y given scale sigma +`r since("2.12")` \index{{\tt \bfseries rayleigh\_lccdf }!{\tt (real y \textbar\ real sigma): real}|hyperpage} @@ -636,6 +704,7 @@ The log of the Rayleigh cumulative distribution of y given scale sigma `real` **`rayleigh_lccdf`**`(real y | real sigma)`
\newline The log of the Rayleigh complementary cumulative distribution of y given scale sigma +`r since("2.12")` \index{{\tt \bfseries rayleigh\_rng }!{\tt (reals sigma): R}|hyperpage} @@ -644,3 +713,4 @@ given scale sigma Generate a Rayleigh variate with scale sigma; may only be used in generated quantities block. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` diff --git a/src/functions-reference/positive_lower-bounded_distributions.Rmd b/src/functions-reference/positive_lower-bounded_distributions.Rmd index f3f3f7ade..a127addd4 100644 --- a/src/functions-reference/positive_lower-bounded_distributions.Rmd +++ b/src/functions-reference/positive_lower-bounded_distributions.Rmd @@ -25,6 +25,7 @@ then for $y \in \mathbb{R}^+$ with $y \geq y_{\text{min}}$, \[ `y ~ ` **`pareto`**`(y_min, alpha)` Increment target log probability density with `pareto_lupdf(y | y_min, alpha)`. +`r since("2.0")` \index{{\tt \bfseries pareto }!sampling statement|hyperpage} @@ -36,6 +37,7 @@ Increment target log probability density with `pareto_lupdf(y | y_min, alpha)`. `real` **`pareto_lpdf`**`(reals y | reals y_min, reals alpha)`
\newline The log of the Pareto density of y given positive minimum value y_min and shape alpha +`r since("2.12")` \index{{\tt \bfseries pareto\_lupdf }!{\tt (reals y \textbar\ reals y\_min, reals alpha): real}|hyperpage} @@ -43,6 +45,7 @@ and shape alpha `real` **`pareto_lupdf`**`(reals y | reals y_min, reals alpha)`
\newline The log of the Pareto density of y given positive minimum value y_min and shape alpha dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries pareto\_cdf }!{\tt (reals y, reals y\_min, reals alpha): real}|hyperpage} @@ -50,6 +53,7 @@ and shape alpha dropping constant additive terms `real` **`pareto_cdf`**`(reals y, reals y_min, reals alpha)`
\newline The Pareto cumulative distribution function of y given positive minimum value y_min and shape alpha +`r since("2.0")` \index{{\tt \bfseries pareto\_lcdf }!{\tt (reals y \textbar\ reals y\_min, reals alpha): real}|hyperpage} @@ -57,6 +61,7 @@ minimum value y_min and shape alpha `real` **`pareto_lcdf`**`(reals y | reals y_min, reals alpha)`
\newline The log of the Pareto cumulative distribution function of y given positive minimum value y_min and shape alpha +`r since("2.12")` \index{{\tt \bfseries pareto\_lccdf }!{\tt (reals y \textbar\ reals y\_min, reals alpha): real}|hyperpage} @@ -64,6 +69,7 @@ positive minimum value y_min and shape alpha `real` **`pareto_lccdf`**`(reals y | reals y_min, reals alpha)`
\newline The log of the Pareto complementary cumulative distribution function of y given positive minimum value y_min and shape alpha +`r since("2.12")` \index{{\tt \bfseries pareto\_rng }!{\tt (reals y\_min, reals alpha): R}|hyperpage} @@ -73,6 +79,7 @@ Generate a Pareto variate with positive minimum value y_min and shape alpha; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Pareto type 2 distribution @@ -92,6 +99,7 @@ $\mu=0$. `y ~ ` **`pareto_type_2`**`(mu, lambda, alpha)` Increment target log probability density with `pareto_type_2_lupdf(y | mu, lambda, alpha)`. +`r since("2.5")` \index{{\tt \bfseries pareto\_type\_2 }!sampling statement|hyperpage} @@ -103,6 +111,7 @@ Increment target log probability density with `pareto_type_2_lupdf(y | mu, lambd `real` **`pareto_type_2_lpdf`**`(reals y | reals mu, reals lambda, reals alpha)`
\newline The log of the Pareto Type 2 density of y given location mu, scale lambda, and shape alpha +`r since("2.18")` \index{{\tt \bfseries pareto\_type\_2\_lupdf }!{\tt (reals y \textbar\ reals mu, reals lambda, reals alpha): real}|hyperpage} @@ -110,6 +119,7 @@ lambda, and shape alpha `real` **`pareto_type_2_lupdf`**`(reals y | reals mu, reals lambda, reals alpha)`
\newline The log of the Pareto Type 2 density of y given location mu, scale lambda, and shape alpha dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries pareto\_type\_2\_cdf }!{\tt (reals y, reals mu, reals lambda, reals alpha): real}|hyperpage} @@ -117,6 +127,7 @@ lambda, and shape alpha dropping constant additive terms `real` **`pareto_type_2_cdf`**`(reals y, reals mu, reals lambda, reals alpha)`
\newline The Pareto Type 2 cumulative distribution function of y given location mu, scale lambda, and shape alpha +`r since("2.5")` \index{{\tt \bfseries pareto\_type\_2\_lcdf }!{\tt (reals y \textbar\ reals mu, reals lambda, reals alpha): real}|hyperpage} @@ -124,6 +135,7 @@ mu, scale lambda, and shape alpha `real` **`pareto_type_2_lcdf`**`(reals y | reals mu, reals lambda, reals alpha)`
\newline The log of the Pareto Type 2 cumulative distribution function of y given location mu, scale lambda, and shape alpha +`r since("2.18")` \index{{\tt \bfseries pareto\_type\_2\_lccdf }!{\tt (reals y \textbar\ reals mu, reals lambda, reals alpha): real}|hyperpage} @@ -131,6 +143,7 @@ given location mu, scale lambda, and shape alpha `real` **`pareto_type_2_lccdf`**`(reals y | reals mu, reals lambda, reals alpha)`
\newline The log of the Pareto Type 2 complementary cumulative distribution function of y given location mu, scale lambda, and shape alpha +`r since("2.18")` \index{{\tt \bfseries pareto\_type\_2\_rng }!{\tt (reals mu, reals lambda, reals alpha): R}|hyperpage} @@ -140,6 +153,7 @@ Generate a Pareto Type 2 variate with location mu, scale lambda, and shape alpha; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Wiener First Passage Time Distribution @@ -159,6 +173,7 @@ If $\alpha \in \mathbb{R}^+$, $\tau \in \mathbb{R}^+$, $\beta \in [0, `y ~ ` **`wiener`**`(alpha, tau, beta, delta)` Increment target log probability density with `wiener_lupdf(y | alpha, tau, beta, delta)`. +`r since("2.7")` \index{{\tt \bfseries wiener }!sampling statement|hyperpage} @@ -171,6 +186,7 @@ Increment target log probability density with `wiener_lupdf(y | alpha, tau, beta The log of the Wiener first passage time density of y given boundary separation alpha, non-decision time tau, a-priori bias beta and drift rate delta +`r since("2.18")` \index{{\tt \bfseries wiener\_lupdf }!{\tt (reals y \textbar\ reals alpha, reals tau, reals beta, reals delta): real}|hyperpage} @@ -179,6 +195,7 @@ rate delta The log of the Wiener first passage time density of y given boundary separation alpha, non-decision time tau, a-priori bias beta and drift rate delta dropping constant additive terms +`r since("2.25")` ### boundaries diff --git a/src/functions-reference/real-valued_basic_functions.Rmd b/src/functions-reference/real-valued_basic_functions.Rmd index 09728a95c..9e24e0224 100644 --- a/src/functions-reference/real-valued_basic_functions.Rmd +++ b/src/functions-reference/real-valued_basic_functions.Rmd @@ -294,65 +294,74 @@ Constants are represented as functions with no arguments and must be called as such. For instance, the mathematical constant $\pi$ must be written in a Stan program as `pi()`. - + \index{{\tt \bfseries pi }!{\tt (): real}|hyperpage} `real` **`pi`**`()`
\newline $\pi$, the ratio of a circle's circumference to its diameter +`r since("2.0")` - + \index{{\tt \bfseries e }!{\tt (): real}|hyperpage} `real` **`e`**`()`
\newline $e$, the base of the natural logarithm +`r since("2.0")` - + \index{{\tt \bfseries sqrt2 }!{\tt (): real}|hyperpage} `real` **`sqrt2`**`()`
\newline The square root of 2 +`r since("2.0")` - + \index{{\tt \bfseries log2 }!{\tt (): real}|hyperpage} `real` **`log2`**`()`
\newline The natural logarithm of 2 +`r since("2.0")` - + \index{{\tt \bfseries log10 }!{\tt (): real}|hyperpage} `real` **`log10`**`()`
\newline The natural logarithm of 10 +`r since("2.0")` ## Special values - + \index{{\tt \bfseries not\_a\_number }!{\tt (): real}|hyperpage} `real` **`not_a_number`**`()`
\newline Not-a-number, a special non-finite real value returned to signal an error +`r since("2.0")` - + \index{{\tt \bfseries positive\_infinity }!{\tt (): real}|hyperpage} `real` **`positive_infinity`**`()`
\newline Positive infinity, a special non-finite real value larger than all finite numbers +`r since("2.0")` - + \index{{\tt \bfseries negative\_infinity }!{\tt (): real}|hyperpage} `real` **`negative_infinity`**`()`
\newline Negative infinity, a special non-finite real value smaller than all finite numbers +`r since("2.0")` - + \index{{\tt \bfseries machine\_precision }!{\tt (): real}|hyperpage} `real` **`machine_precision`**`()`
\newline The smallest number $x$ such that $(x + 1) \neq 1$ in floating-point arithmetic on the current hardware platform +`r since("2.0")` ## Log probability function {#get-log-prob} @@ -380,18 +389,20 @@ to see where it becomes ill defined. has been deprecated; using it will print a warning. The function `get_lp()` will be removed in a future release. - + \index{{\tt \bfseries target }!{\tt (): real}|hyperpage} `real` **`target`**`()`
\newline Return the current value of the log probability accumulator. +`r since("2.10")` - + \index{{\tt \bfseries get\_lp }!{\tt (): real}|hyperpage} `real` **`get_lp`**`()`
\newline Return the current value of the log probability accumulator; **deprecated;** - use `target()` instead. +`r since("2.5")` Both `target` and the deprecated `get_lp` act like other functions ending in `_lp`, meaning that they may only may only be used in the @@ -417,7 +428,6 @@ carried out by first promoting the integer value. `int` **`operator<`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_less\_than }!{\tt (real x, real y): int}|hyperpage} @@ -425,13 +435,13 @@ carried out by first promoting the integer value. Return 1 if x is less than y and 0 otherwise. \[ \text{operator<}(x,y) = \begin{cases} 1 & \text{if $x < y$} \\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries operator\_logical\_less\_than\_equal }!{\tt (int x, int y): int}|hyperpage} `int` **`operator<=`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_less\_than\_equal }!{\tt (real x, real y): int}|hyperpage} @@ -439,13 +449,13 @@ Return 1 if x is less than y and 0 otherwise. \[ \text{operator<}(x,y) Return 1 if x is less than or equal y and 0 otherwise. \[ \text{operator<=}(x,y) = \begin{cases} 1 & \text{if $x \leq y$} \\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries operator\_logical\_greater\_than }!{\tt (int x, int y): int}|hyperpage} `int` **`operator>`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_greater\_than }!{\tt (real x, real y): int}|hyperpage} @@ -453,13 +463,13 @@ Return 1 if x is less than or equal y and 0 otherwise. \[ Return 1 if x is greater than y and 0 otherwise. \[ \text{operator>} = \begin{cases} 1 & \text{if $x > y$} \\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries operator\_logical\_greater\_than\_equal }!{\tt (int x, int y): int}|hyperpage} `int` **`operator>=`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_greater\_than\_equal }!{\tt (real x, real y): int}|hyperpage} @@ -467,13 +477,13 @@ Return 1 if x is greater than y and 0 otherwise. \[ \text{operator>} = Return 1 if x is greater than or equal to y and 0 otherwise. \[ \text{operator>=} = \begin{cases} 1 & \text{if $x \geq y$} \\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries operator\_logical\_equal }!{\tt (int x, int y): int}|hyperpage} `int` **`operator==`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_equal }!{\tt (real x, real y): int}|hyperpage} @@ -481,13 +491,13 @@ Return 1 if x is greater than or equal to y and 0 otherwise. \[ Return 1 if x is equal to y and 0 otherwise. \[ \text{operator==}(x,y) = \begin{cases} 1 & \text{if $x = y$} \\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries operator\_logical\_not\_equal }!{\tt (int x, int y): int}|hyperpage} `int` **`operator!=`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_not\_equal }!{\tt (real x, real y): int}|hyperpage} @@ -495,6 +505,7 @@ Return 1 if x is equal to y and 0 otherwise. \[ \text{operator==}(x,y) Return 1 if x is not equal to y and 0 otherwise. \[ \text{operator!=}(x,y) = \begin{cases} 1 & \text{if $x \neq y$} \\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` ### Boolean operators @@ -512,7 +523,6 @@ b) || (((c >= d) && (e != f)))`. `int` **`operator!`**`(int x)`
\newline - \index{{\tt \bfseries operator\_negation }!{\tt (real x): int}|hyperpage} @@ -520,13 +530,13 @@ b) || (((c >= d) && (e != f)))`. Return 1 if x is zero and 0 otherwise. \[ \text{operator!}(x) = \begin{cases} 0 & \text{if $x \neq 0$} \\ 1 & \text{if $x = 0$} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries operator\_logical\_and }!{\tt (int x, int y): int}|hyperpage} `int` **`operator&&`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_and }!{\tt (real x, real y): int}|hyperpage} @@ -534,13 +544,13 @@ Return 1 if x is zero and 0 otherwise. \[ \text{operator!}(x) = Return 1 if x is unequal to 0 and y is unequal to 0. \[ \mathrm{operator\&\&}(x,y) = \begin{cases} 1 & \text{if $x \neq 0$} \text{ and } y \neq 0\\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries operator\_logical\_or }!{\tt (int x, int y): int}|hyperpage} `int` **`operator||`**`(int x, int y)`
\newline - \index{{\tt \bfseries operator\_logical\_or }!{\tt (real x, real y): int}|hyperpage} @@ -548,6 +558,7 @@ Return 1 if x is unequal to 0 and y is unequal to 0. \[ Return 1 if x is unequal to 0 or y is unequal to 0. \[ \text{operator||}(x,y) = \begin{cases} 1 & \text{if $x \neq 0$} \textrm{ or } y \neq 0\\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` #### Boolean operator short circuiting @@ -578,18 +589,21 @@ operations. For instance, `step(a-b)` evaluates to 1 if `a` is greater than `b` and evaluates to 0 otherwise. `step` is a step-like functions; see the warning in section [step functions](#step-functions) applied to expressions dependent on parameters. +`r since("2.0")` \index{{\tt \bfseries is\_inf }!{\tt (real x): int}|hyperpage} `int` **`is_inf`**`(real x)`
\newline Return 1 if x is infinite (positive or negative) and 0 otherwise. +`r since("2.5")` \index{{\tt \bfseries is\_nan }!{\tt (real x): int}|hyperpage} `int` **`is_nan`**`(real x)`
\newline Return 1 if x is NaN and 0 otherwise. +`r since("2.5")` Care must be taken because both of these indicator functions are step-like and thus can cause discontinuities in gradients when applied @@ -610,6 +624,7 @@ y` and `-x`, respectively. `real` **`operator+`**`(real x, real y)`
\newline Return the sum of x and y. \[ (x + y) = \text{operator+}(x,y) = x+y \] +`r since("2.0")` \index{{\tt \bfseries operator\_subtract }!{\tt (real x, real y): real}|hyperpage} @@ -617,6 +632,7 @@ Return the sum of x and y. \[ (x + y) = \text{operator+}(x,y) = x+y \] `real` **`operator-`**`(real x, real y)`
\newline Return the difference between x and y. \[ (x - y) = \text{operator-}(x,y) = x - y \] +`r since("2.0")` \index{{\tt \bfseries operator\_multiply }!{\tt (real x, real y): real}|hyperpage} @@ -624,6 +640,7 @@ Return the difference between x and y. \[ (x - y) = `real` **`operator*`**`(real x, real y)`
\newline Return the product of x and y. \[ (x * y) = \text{operator*}(x,y) = xy \] +`r since("2.0")` \index{{\tt \bfseries operator\_divide }!{\tt (real x, real y): real}|hyperpage} @@ -631,6 +648,7 @@ Return the product of x and y. \[ (x * y) = \text{operator*}(x,y) = xy `real` **`operator/`**`(real x, real y)`
\newline Return the quotient of x and y. \[ (x / y) = \text{operator/}(x,y) = \frac{x}{y} \] +`r since("2.0")` \index{{\tt \bfseries operator\_pow }!{\tt (real x, real y): real}|hyperpage} @@ -638,6 +656,7 @@ Return the quotient of x and y. \[ (x / y) = \text{operator/}(x,y) = `real` **`operator^`**`(real x, real y)`
\newline Return x raised to the power of y. \[ (x^\mathrm{\wedge}y) = \text{operator}^\mathrm{\wedge}(x,y) = x^y \] +`r since("2.5")` ### Unary prefix operators @@ -647,12 +666,14 @@ Return x raised to the power of y. \[ (x^\mathrm{\wedge}y) = `real` **`operator-`**`(real x)`
\newline Return the negation of the subtrahend x. \[ \text{operator-}(x) = (-x) \] +`r since("2.0")` \index{{\tt \bfseries operator\_add }!{\tt (real x): real}|hyperpage} `real` **`operator+`**`(real x)`
\newline Return the value of x. \[ \text{operator+}(x) = x \] +`r since("2.0")` ## Step-like functions {#step-functions} @@ -671,6 +692,7 @@ used in the data, transformed data, or generated quantities blocks.* `R` **`fabs`**`(T x)`
\newline absolute value of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries fdim }!{\tt (real x, real y): real}|hyperpage} @@ -680,12 +702,14 @@ Return the positive difference between x and y, which is x - y if x is greater than y and 0 otherwise; see warning above. \[ \text{fdim}(x,y) = \begin{cases} x-y & \text{if } x \geq y \\ 0 & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries fdim }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`fdim`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `fdim` function +`r since("2.25")` ### Bounds functions @@ -696,12 +720,15 @@ Vectorized implementation of the `fdim` function Return the minimum of x and y; see warning above. \[ \text{fmin}(x,y) = \begin{cases} x & \text{if } x \leq y \\ y & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries fmin }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`fmin`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `fmin` function +`r since("2.25")` + \index{{\tt \bfseries fmax }!{\tt (real x, real y): real}|hyperpage} @@ -709,12 +736,14 @@ Vectorized implementation of the `fmin` function Return the maximum of x and y; see warning above. \[ \text{fmax}(x,y) = \begin{cases} x & \text{if } x \geq y \\ y & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries fmax }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`fmax`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `fmax` function +`r since("2.25")` ### Arithmetic functions @@ -725,12 +754,14 @@ Vectorized implementation of the `fmax` function Return the real value remainder after dividing x by y; see warning above. \[ \text{fmod}(x,y) = x - \left\lfloor \frac{x}{y} \right\rfloor \, y \] The operator $\lfloor u \rfloor$ is the floor operation; see below. +`r since("2.0")` \index{{\tt \bfseries fmod }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`fmod`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `fmod` function +`r since("2.25")` ### Rounding functions @@ -753,6 +784,7 @@ of these in the future, but as of now, there is no good workaround. floor of x, which is the largest integer less than or equal to x, converted to a real value; see warning at start of section [step-like functions](#step-functions) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries ceil }!{\tt (T x): R}|hyperpage} @@ -761,6 +793,7 @@ converted to a real value; see warning at start of section ceiling of x, which is the smallest integer greater than or equal to x, converted to a real value; see warning at start of section [step-like functions](#step-functions) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries round }!{\tt (T x): R}|hyperpage} @@ -768,6 +801,7 @@ x, converted to a real value; see warning at start of section `R` **`round`**`(T x)`
\newline nearest integer to x, converted to a real value; see warning at start of section [step-like functions](#step-functions) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries trunc }!{\tt (T x): R}|hyperpage} @@ -775,6 +809,7 @@ of section [step-like functions](#step-functions) `R` **`trunc`**`(T x)`
\newline integer nearest to but no larger in magnitude than x, converted to a double value; see warning at start of section [step-like functions](#step-functions) +`r since("2.0, vectorized in 2.13")` ## Power and logarithm functions @@ -783,77 +818,91 @@ double value; see warning at start of section [step-like functions](#step-functi `R` **`sqrt`**`(T x)`
\newline square root of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries cbrt }!{\tt (T x): R}|hyperpage} `R` **`cbrt`**`(T x)`
\newline cube root of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries square }!{\tt (T x): R}|hyperpage} `R` **`square`**`(T x)`
\newline square of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries exp }!{\tt (T x): R}|hyperpage} `R` **`exp`**`(T x)`
\newline natural exponential of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries exp2 }!{\tt (T x): R}|hyperpage} `R` **`exp2`**`(T x)`
\newline base-2 exponential of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log }!{\tt (T x): R}|hyperpage} `R` **`log`**`(T x)`
\newline natural logarithm of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log2 }!{\tt (T x): R}|hyperpage} `R` **`log2`**`(T x)`
\newline base-2 logarithm of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log10 }!{\tt (T x): R}|hyperpage} `R` **`log10`**`(T x)`
\newline base-10 logarithm of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries pow }!{\tt (real x, real y): real}|hyperpage} `real` **`pow`**`(real x, real y)`
\newline Return x raised to the power of y. \[ \text{pow}(x,y) = x^y \] +`r since("2.0")` \index{{\tt \bfseries pow }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`pow`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `pow` function +`r since("2.25")` + \index{{\tt \bfseries inv }!{\tt (T x): R}|hyperpage} `R` **`inv`**`(T x)`
\newline inverse of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries inv\_sqrt }!{\tt (T x): R}|hyperpage} `R` **`inv_sqrt`**`(T x)`
\newline inverse of the square root of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries inv\_square }!{\tt (T x): R}|hyperpage} `R` **`inv_square`**`(T x)`
\newline inverse of the square of x +`r since("2.0, vectorized in 2.13")` ## Trigonometric functions @@ -864,43 +913,49 @@ inverse of the square of x Return the length of the hypotenuse of a right triangle with sides of length x and y. \[ \text{hypot}(x,y) = \begin{cases} \sqrt{x^2+y^2} & \text{if } x,y\geq 0 \\ \textrm{NaN} & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries hypot }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`hypot`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `hypot` function - +`r since("2.25")` \index{{\tt \bfseries cos }!{\tt (T x): R}|hyperpage} `R` **`cos`**`(T x)`
\newline cosine of the angle x (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries sin }!{\tt (T x): R}|hyperpage} `R` **`sin`**`(T x)`
\newline sine of the angle x (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries tan }!{\tt (T x): R}|hyperpage} `R` **`tan`**`(T x)`
\newline tangent of the angle x (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries acos }!{\tt (T x): R}|hyperpage} `R` **`acos`**`(T x)`
\newline principal arc (inverse) cosine (in radians) of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries asin }!{\tt (T x): R}|hyperpage} `R` **`asin`**`(T x)`
\newline principal arc (inverse) sine (in radians) of x +`r since("2.0")` \index{{\tt \bfseries atan }!{\tt (T x): R}|hyperpage} @@ -908,6 +963,7 @@ principal arc (inverse) sine (in radians) of x `R` **`atan`**`(T x)`
\newline principal arc (inverse) tangent (in radians) of x, with values from $-\pi/2$ to $\pi/2$ +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries atan2 }!{\tt (real y, real x): real}|hyperpage} @@ -915,6 +971,7 @@ $-\pi/2$ to $\pi/2$ `real` **`atan2`**`(real y, real x)`
\newline Return the principal arc (inverse) tangent (in radians) of y divided by x, \[ \text{atan2}(y, x) = \arctan\left(\frac{y}{x}\right) \] +`r since("2.0, vectorized in 2.13")` ## Hyperbolic trigonometric functions @@ -923,36 +980,42 @@ by x, \[ \text{atan2}(y, x) = \arctan\left(\frac{y}{x}\right) \] `R` **`cosh`**`(T x)`
\newline hyperbolic cosine of x (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries sinh }!{\tt (T x): R}|hyperpage} `R` **`sinh`**`(T x)`
\newline hyperbolic sine of x (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries tanh }!{\tt (T x): R}|hyperpage} `R` **`tanh`**`(T x)`
\newline hyperbolic tangent of x (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries acosh }!{\tt (T x): R}|hyperpage} `R` **`acosh`**`(T x)`
\newline inverse hyperbolic cosine (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries asinh }!{\tt (T x): R}|hyperpage} `R` **`asinh`**`(T x)`
\newline inverse hyperbolic cosine (in radians) +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries atanh }!{\tt (T x): R}|hyperpage} `R` **`atanh`**`(T x)`
\newline inverse hyperbolic tangent (in radians) of x +`r since("2.0, vectorized in 2.13")` ## Link functions {#link-functions} @@ -965,18 +1028,21 @@ as a link function (see section [probability-related functions](#Phi-function)). `R` **`logit`**`(T x)`
\newline log odds, or logit, function applied to x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries inv\_logit }!{\tt (T x): R}|hyperpage} `R` **`inv_logit`**`(T x)`
\newline logistic sigmoid function applied to x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries inv\_cloglog }!{\tt (T x): R}|hyperpage} `R` **`inv_cloglog`**`(T x)`
\newline inverse of the complementary log-log function applied to x +`r since("2.0, vectorized in 2.13")` ## Probability-related functions {#Phi-function} @@ -992,18 +1058,21 @@ distribution function (and its complement). `R` **`erf`**`(T x)`
\newline error function, also known as the Gauss error function, of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries erfc }!{\tt (T x): R}|hyperpage} `R` **`erfc`**`(T x)`
\newline complementary error function of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries phi }!{\tt (T x): R}|hyperpage} `R` **`Phi`**`(T x)`
\newline standard normal cumulative distribution function of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries inv\_phi }!{\tt (T x): R}|hyperpage} @@ -1012,6 +1081,7 @@ standard normal cumulative distribution function of x Return the value of the inverse standard normal cdf $\Phi^{-1}$ at the specified quantile `x`. The details of the algorithm can be found in [@Wichura:1988]. Quantile arguments below 1e-16 are untested; quantiles above 0.999999999 result in increasingly large errors. +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries phi\_approx }!{\tt (T x): R}|hyperpage} @@ -1020,6 +1090,7 @@ Quantile arguments below 1e-16 are untested; quantiles above 0.999999999 result fast approximation of the unit (may replace `Phi` for probit regression with maximum absolute error of 0.00014, see [@BowlingEtAl:2009] for details) +`r since("2.0, vectorized in 2.13")` ### Other probability-related functions @@ -1032,12 +1103,14 @@ for boolean outcome $y \in \{0,1\}$. \[ \mathrm{binary\_log\_loss}(y,\hat{y}) = \begin{cases} -\log \hat{y} & \text{if } y = 0\\ -\log (1 - \hat{y}) & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries binary\_log\_loss }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`binary_log_loss`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `binary_log_loss` function +`r since("2.25")` \index{{\tt \bfseries owens\_t }!{\tt (real h, real a): real}|hyperpage} @@ -1047,12 +1120,14 @@ Return the Owen's T function for the probability of the event $X > h$ and $0 \index{{\tt \bfseries owens\_t }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`owens_t`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `owens_t` function +`r since("2.25")` ## Combinatorial functions {#betafun} @@ -1064,12 +1139,14 @@ Return the beta function applied to alpha and beta. The beta function, $\text{B}(\alpha,\beta)$, computes the normalizing constant for the beta distribution, and is defined for $\alpha > 0$ and $\beta > 0$. See section [appendix](#beta-appendix) for definition of $\text{B}(\alpha, \beta)$. +`r since("2.25")` \index{{\tt \bfseries beta }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`beta`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `beta` function +`r since("2.25")` \index{{\tt \bfseries inc\_beta }!{\tt (real alpha, real beta, real x): real}|hyperpage} @@ -1077,6 +1154,7 @@ Vectorized implementation of the `beta` function `real` **`inc_beta`**`(real alpha, real beta, real x)`
\newline Return the regularized incomplete beta function up to x applied to alpha and beta. See section [appendix](#inc-beta-appendix) for a definition. +`r since("2.10")` \index{{\tt \bfseries lbeta }!{\tt (real alpha, real beta): real}|hyperpage} @@ -1088,12 +1166,14 @@ normalizing constant for the beta distribution, and is defined for $\alpha > 0$ and $\beta > 0$. \[ \text{lbeta}(\alpha,\beta) = \log \Gamma(a) + \log \Gamma(b) - \log \Gamma(a+b) \] See section [appendix](#beta-appendix) for definition of $\text{B}(\alpha, \beta)$. +`r since("2.0")` \index{{\tt \bfseries lbeta }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`lbeta`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `lbeta` function +`r since("2.25")` \index{{\tt \bfseries tgamma }!{\tt (T x): R}|hyperpage} @@ -1104,12 +1184,14 @@ of the factorial function to continuous variables, defined so that $\Gamma(n+1) = n!$. See for a full definition of $\Gamma(x)$. The function is defined for positive numbers and non-integral negative numbers, +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries lgamma }!{\tt (T x): R}|hyperpage} `R` **`lgamma`**`(T x)`
\newline natural logarithm of the gamma function applied to x, +`r since("2.0, vectorized in 2.15")` \index{{\tt \bfseries digamma }!{\tt (T x): R}|hyperpage} @@ -1118,6 +1200,7 @@ natural logarithm of the gamma function applied to x, digamma function applied to x. The digamma function is the derivative of the natural logarithm of the Gamma function. The function is defined for positive numbers and non-integral negative numbers +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries trigamma }!{\tt (T x): R}|hyperpage} @@ -1125,6 +1208,7 @@ defined for positive numbers and non-integral negative numbers `R` **`trigamma`**`(T x)`
\newline trigamma function applied to x. The trigamma function is the second derivative of the natural logarithm of the Gamma function +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries lmgamma }!{\tt (int n, real x): real}|hyperpage} @@ -1136,12 +1220,14 @@ $\Gamma_n$ with n dimensions applied to x. \[ \text{lmgamma}(n,x) = \Gamma\left(x + \frac{1 - j}{2}\right) & \text{if } x\not\in \{\dots,-3,-2,-1,0\}\\ \textrm{error} & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries lmgamma }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`lmgamma`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `lmgamma` function +`r since("2.25")` \index{{\tt \bfseries gamma\_p }!{\tt (real a, real z): real}|hyperpage} @@ -1151,12 +1237,14 @@ Return the normalized lower incomplete gamma function of a and z defined for positive a and nonnegative z. \[ \mathrm{gamma\_p}(a,z) = \begin{cases} \frac{1}{\Gamma(a)}\int_0^zt^{a-1}e^{-t}dt & \text{if } a > 0, z \geq 0 \\ \textrm{error} & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries gamma\_p }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`gamma_p`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `gamma_p` function +`r since("2.25")` \index{{\tt \bfseries gamma\_q }!{\tt (real a, real z): real}|hyperpage} @@ -1167,12 +1255,14 @@ defined for positive a and nonnegative z. \[ \mathrm{gamma\_q}(a,z) = \begin{cases} \frac{1}{\Gamma(a)}\int_z^\infty t^{a-1}e^{-t}dt & \text{if } a > 0, z \geq 0 \\[6pt] \textrm{error} & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries gamma\_q }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`gamma_q`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `gamma_q` function +`r since("2.25")` \index{{\tt \bfseries binomial\_coefficient\_log }!{\tt (real x, real y): real}|hyperpage} @@ -1185,12 +1275,14 @@ function is written as $\binom{x}{y}$ and pronounced "x choose y." This function generalizes to real numbers using the gamma function. For $0 \leq y \leq x$, \[ \mathrm{binomial\_coefficient\_log}(x,y) = \log\Gamma(x+1) - \log\Gamma(y+1) - \log\Gamma(x-y+1). \] +`r since("2.0, deprecated since 2.10")` \index{{\tt \bfseries binomial\_coefficient\_log }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`binomial_coefficient_log`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `binomial_coefficient_log` function +`r since("2.25")` \index{{\tt \bfseries choose }!{\tt (int x, int y): int}|hyperpage} @@ -1203,12 +1295,14 @@ function but returns an integer rather than a real number with no non-zero decimal places. For $0 \leq y \leq x$, the binomial coefficient function can be defined via the factorial function \[ \text{choose}(x,y) = \frac{x!}{\left(y!\right)\left(x - y\right)!}. \] +`r since("2.14")` \index{{\tt \bfseries choose }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`choose`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `choose` function +`r since("2.25")` \index{{\tt \bfseries bessel\_first\_kind }!{\tt (int v, real x): real}|hyperpage} @@ -1218,12 +1312,14 @@ Return the Bessel function of the first kind with order v applied to x. \[ \mathrm{bessel\_first\_kind}(v,x) = J_v(x), \] where \[ J_v(x)=\left(\frac{1}{2}x\right)^v \sum_{k=0}^\infty \frac{\left(-\frac{1}{4}x^2\right)^k}{k!\, \Gamma(v+k+1)} \] +`r since("2.5")` \index{{\tt \bfseries bessel\_first\_kind }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`bessel_first_kind`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `bessel_first_kind` function +`r since("2.25")` \index{{\tt \bfseries bessel\_second\_kind }!{\tt (int v, real x): real}|hyperpage} @@ -1234,12 +1330,14 @@ x defined for positive x and v. For $x,v > 0$, \[ \mathrm{bessel\_second\_kind}(v,x) = \begin{cases} Y_v(x) & \text{if } x > 0 \\ \textrm{error} & \text{otherwise} \end{cases} \] where \[ Y_v(x)=\frac{J_v(x)\cos(v\pi)-J_{-v}(x)}{\sin(v\pi)} \] +`r since("2.5")` \index{{\tt \bfseries bessel\_second\_kind }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`bessel_second_kind`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `bessel_second_kind` function +`r since("2.25")` \index{{\tt \bfseries modified\_bessel\_first\_kind }!{\tt (int v, real z): real}|hyperpage} @@ -1250,12 +1348,14 @@ applied to z defined for all z and integer v. \[ \mathrm{modified\_bessel\_first\_kind}(v,z) = I_v(z) \] where \[ {I_v}(z) = \left(\frac{1}{2}z\right)^v\sum_{k=0}^\infty \frac{\left(\frac{1}{4}z^2\right)^k}{k!\Gamma(v+k+1)} \] +`r since("2.1")` \index{{\tt \bfseries modified\_bessel\_first\_kind }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`modified_bessel_first_kind`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `modified_bessel_first_kind` function +`r since("2.25")` \index{{\tt \bfseries log\_modified\_bessel\_first\_kind }!{\tt (real v, real z): real}|hyperpage} @@ -1263,12 +1363,14 @@ Vectorized implementation of the `modified_bessel_first_kind` function `real` **`log_modified_bessel_first_kind`**`(real v, real z)`
\newline Return the log of the modified Bessel function of the first kind. v does not have to be an integer. +`r since("2.26")` \index{{\tt \bfseries log\_modified\_bessel\_first\_kind }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`log_modified_bessel_first_kind`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `log_modified_bessel_first_kind` function +`r since("2.26")` \index{{\tt \bfseries modified\_bessel\_second\_kind }!{\tt (int v, real z): real}|hyperpage} @@ -1280,12 +1382,14 @@ applied to z defined for positive z and integer v. \[ \text{if } z > 0 \\ \textrm{error} & \text{if } z \leq 0 \end{cases} \] where \[ {K_v}(z) = \frac{\pi}{2}\cdot\frac{I_{-v}(z) - I_{v}(z)}{\sin(v\pi)} \] +`r since("2.1")` \index{{\tt \bfseries modified\_bessel\_second\_kind }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`modified_bessel_second_kind`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `modified_bessel_second_kind` function +`r since("2.25")` \index{{\tt \bfseries falling\_factorial }!{\tt (real x, real n): real}|hyperpage} @@ -1295,12 +1399,14 @@ Return the falling factorial of x with power n defined for positive x and real n. \[ \mathrm{falling\_factorial}(x,n) = \begin{cases} (x)_n & \text{if } x > 0 \\ \textrm{error} & \text{if } x \leq 0 \end{cases} \] where \[ (x)_n=\frac{\Gamma(x+1)}{\Gamma(x-n+1)} \] +`r since("2.0")` \index{{\tt \bfseries falling\_factorial }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`falling_factorial`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `falling_factorial` function +`r since("2.25")` \index{{\tt \bfseries lchoose }!{\tt (real x, real y): real}|hyperpage} @@ -1312,6 +1418,7 @@ function is written as $\binom{x}{y}$ and pronounced "x choose y." This function generalizes to real numbers using the gamma function. For $0 \leq y \leq x$, \[ \mathrm{binomial\_coefficient\_log}(x,y) = \log\Gamma(x+1) - \log\Gamma(y+1) - \log\Gamma(x-y+1). \] +`r since("2.10")` \index{{\tt \bfseries log\_falling\_factorial }!{\tt (real x, real n): real}|hyperpage} @@ -1321,6 +1428,7 @@ Return the log of the falling factorial of x with power n defined for positive x and real n. \[ \mathrm{log\_falling\_factorial}(x,n) = \begin{cases} \log (x)_n & \text{if } x > 0 \\ \textrm{error} & \text{if } x \leq 0 \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries rising\_factorial }!{\tt (real x, int n): real}|hyperpage} @@ -1330,12 +1438,14 @@ Return the rising factorial of x with power n defined for positive x and integer n. \[ \mathrm{rising\_factorial}(x,n) = \begin{cases} x^{(n)} & \text{if } x > 0 \\ \textrm{error} & \text{if } x \leq 0 \end{cases} \] where \[ x^{(n)}=\frac{\Gamma(x+n)}{\Gamma(x)} \] +`r since("2.20")` \index{{\tt \bfseries rising\_factorial }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`rising_factorial`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `rising_factorial` function +`r since("2.25")` \index{{\tt \bfseries log\_rising\_factorial }!{\tt (real x, real n): real}|hyperpage} @@ -1345,12 +1455,14 @@ Return the log of the rising factorial of x with power n defined for positive x and real n. \[ \mathrm{log\_rising\_factorial}(x,n) = \begin{cases} \log x^{(n)} & \text{if } x > 0 \\ \textrm{error} & \text{if } x \leq 0 \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries log\_rising\_factorial }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`log_rising_factorial`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `log_rising_factorial` function +`r since("2.25")` ## Composed functions {#composed-functions} @@ -1364,6 +1476,7 @@ using more basic Stan functions. `R` **`expm1`**`(T x)`
\newline natural exponential of x minus 1 +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries fma }!{\tt (real x, real y, real z): real}|hyperpage} @@ -1371,6 +1484,7 @@ natural exponential of x minus 1 `real` **`fma`**`(real x, real y, real z)`
\newline Return z plus the result of x multiplied by y. \[ \text{fma}(x,y,z) = (x \times y) + z \] +`r since("2.0")` \index{{\tt \bfseries multiply\_log }!{\tt (real x, real y): real}|hyperpage} @@ -1381,12 +1495,14 @@ _**Warning:**_ This function is deprecated and should be replaced with \[ \mathrm{multiply\_log}(x,y) = \begin{cases} 0 & \text{if } x = y = 0 \\ x \log y & \text{if } x, y \neq 0 \\ \text{NaN} & \text{otherwise} \end{cases} \] +`r since("2.0, deprecated in 2.10")` \index{{\tt \bfseries multiply\_log }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`multiply_log`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `multiply_log` function +`r since("2.25")` \index{{\tt \bfseries ldexp }!{\tt (real x, int y): real}|hyperpage} @@ -1394,12 +1510,14 @@ Vectorized implementation of the `multiply_log` function `real` **`ldexp`**`(real x, int y)`
\newline Return the product of x and two raised to the y power. \[ \text{ldexp}(x,y) = x 2^y \] +`r since("2.25")` \index{{\tt \bfseries ldexp }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`ldexp`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `ldexp` function +`r since("2.25")` \index{{\tt \bfseries lmultiply }!{\tt (real x, real y): real}|hyperpage} @@ -1409,36 +1527,42 @@ Return the product of x and the natural logarithm of y. \[ \text{lmultiply}(x,y) = \begin{cases} 0 & \text{if } x = y = 0 \\ x \log y & \text{if } x, y \neq 0 \\ \text{NaN} & \text{otherwise} \end{cases} \] +`r since("2.10")` \index{{\tt \bfseries lmultiply }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`lmultiply`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `lmultiply` function +`r since("2.25")` \index{{\tt \bfseries log1p }!{\tt (T x): R}|hyperpage} `R` **`log1p`**`(T x)`
\newline natural logarithm of 1 plus x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log1m }!{\tt (T x): R}|hyperpage} `R` **`log1m`**`(T x)`
\newline natural logarithm of 1 minus x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log1p\_exp }!{\tt (T x): R}|hyperpage} `R` **`log1p_exp`**`(T x)`
\newline natural logarithm of one plus the natural exponentiation of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log1m\_exp }!{\tt (T x): R}|hyperpage} `R` **`log1m_exp`**`(T x)`
\newline logarithm of one minus the natural exponentiation of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log\_diff\_exp }!{\tt (real x, real y): real}|hyperpage} @@ -1449,12 +1573,14 @@ exponentiation of x and the natural exponentiation of y. \[ \mathrm{log\_diff\_exp}(x,y) = \begin{cases} \log(\exp(x)-\exp(y)) & \text{if } x > y \\[6pt] \textrm{NaN} & \text{otherwise} \end{cases} \] +`r since("2.0")` \index{{\tt \bfseries log\_diff\_exp }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`log_diff_exp`**`(T1 x, T2 y)`
\newline Vectorized implementation of the `log_diff_exp` function +`r since("2.25")` \index{{\tt \bfseries log\_mix }!{\tt (real theta, real lp1, real lp2): real}|hyperpage} @@ -1466,6 +1592,7 @@ proportion theta, defined by \begin{eqnarray*} \theta \exp(\lambda_1) + \left( 1 - \theta \right) \exp(\lambda_2) \right) \\[3pt] & = & \mathrm{log\_sum\_exp}\!\left(\log(\theta) + \lambda_1, \ \log(1 - \theta) + \lambda_2\right). \end{eqnarray*} +`r since("2.6")` \index{{\tt \bfseries log\_sum\_exp }!{\tt (real x, real y): real}|hyperpage} @@ -1474,24 +1601,28 @@ proportion theta, defined by \begin{eqnarray*} Return the natural logarithm of the sum of the natural exponentiation of x and the natural exponentiation of y. \[ \mathrm{log\_sum\_exp}(x,y) = \log(\exp(x)+\exp(y)) \] +`r since("2.0")` \index{{\tt \bfseries log\_inv\_logit }!{\tt (T x): R}|hyperpage} `R` **`log_inv_logit`**`(T x)`
\newline natural logarithm of the inverse logit function of x +`r since("2.0, vectorized in 2.13")` \index{{\tt \bfseries log\_inv\_logit\_diff }!{\tt (T1 x, T2 y): R}|hyperpage} `R` **`log_inv_logit_diff`**`(T1 x, T2 y)`
\newline natural logarithm of the difference of the inverse logit function of x and the inverse logit function of y +`r since("2.25")` \index{{\tt \bfseries log1m\_inv\_logit }!{\tt (T x): R}|hyperpage} `R` **`log1m_inv_logit`**`(T x)`
\newline natural logarithm of 1 minus the inverse logit function of x +`r since("2.0, vectorized in 2.13")` ## Special functions {#special-functions} @@ -1501,9 +1632,11 @@ natural logarithm of 1 minus the inverse logit function of x `R` **`lambert_w0`**`(T x)`
\newline Implementation of the $W_0$ branch of the Lambert W function, i.e., solution to the function $W_0(x) \exp^{ W_0(x)} = x$ +`r since("2.25")` \index{{\tt \bfseries lambert\_wm1 }!{\tt (T x): R}|hyperpage} `R` **`lambert_wm1`**`(T x)`
\newline Implementation of the $W_{-1}$ branch of the Lambert W function, i.e., solution to the function $W_{-1}(x) \exp^{W_{-1}(x)} = x$ +`r since("2.25")` diff --git a/src/functions-reference/simplex_distributions.Rmd b/src/functions-reference/simplex_distributions.Rmd index a875bf2e0..e200e92da 100644 --- a/src/functions-reference/simplex_distributions.Rmd +++ b/src/functions-reference/simplex_distributions.Rmd @@ -92,6 +92,7 @@ $\alpha = 1000$, `theta ~ ` **`dirichlet`**`(alpha)` Increment target log probability density with `dirichlet_lupdf(theta | alpha)`. +`r since("2.0")` \index{{\tt \bfseries dirichlet }!sampling statement|hyperpage} @@ -103,6 +104,7 @@ Increment target log probability density with `dirichlet_lupdf(theta | alpha)`. `real` **`dirichlet_lpdf`**`(vector theta | vector alpha)`
\newline The log of the Dirichlet density for simplex theta given prior counts (plus one) alpha +`r since("2.12")` \index{{\tt \bfseries dirichlet\_lupdf }!{\tt (vector theta | vector alpha): real}|hyperpage} @@ -110,6 +112,7 @@ The log of the Dirichlet density for simplex theta given prior counts `real` **`dirichlet_lupdf`**`(vector theta | vector alpha)`
\newline The log of the Dirichlet density for simplex theta given prior counts (plus one) alpha dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries dirichlet\_rng }!{\tt (vector alpha): vector}|hyperpage} @@ -117,3 +120,4 @@ The log of the Dirichlet density for simplex theta given prior counts `vector` **`dirichlet_rng`**`(vector alpha)`
\newline Generate a Dirichlet variate with prior counts (plus one) alpha; may only be used in transformed data and generated quantities blocks +`r since("2.0")` diff --git a/src/functions-reference/sparse_matrix_operations.Rmd b/src/functions-reference/sparse_matrix_operations.Rmd index ef16b79e5..6ef5aef69 100644 --- a/src/functions-reference/sparse_matrix_operations.Rmd +++ b/src/functions-reference/sparse_matrix_operations.Rmd @@ -67,6 +67,7 @@ vector $w$ and two integer arrays, $u$ and $v$. `vector` **`csr_extract_w`**`(matrix a)`
\newline Return non-zero values in matrix a; see section [compressed row storage](#CSR). +`r since("2.8")` \index{{\tt \bfseries csr\_extract\_v }!{\tt (matrix a): array[] int}|hyperpage} @@ -74,6 +75,7 @@ Return non-zero values in matrix a; see section [compressed row storage](#CSR). `array[] int` **`csr_extract_v`**`(matrix a)`
\newline Return column indices for values in `csr_extract_w(a)`; see [compressed row storage](#CSR). +`r since("2.8")` \index{{\tt \bfseries csr\_extract\_u }!{\tt (matrix a): array[] int}|hyperpage} @@ -82,6 +84,7 @@ Return column indices for values in `csr_extract_w(a)`; see Return array of row starting indices for entries in `csr_extract_w(a)` followed by the size of `csr_extract_w(a)` plus one; see section [compressed row storage](#CSR). +`r since("2.8")` ### Sparse to dense conversion @@ -100,6 +103,7 @@ by m, array u must have length equal to m + 1 and contain index values bounded by the number of nonzeros (except for the last entry, which must be equal to the number of nonzeros plus one). See section [compressed row storage](#CSR) for more details. +`r since("2.10")` ## Sparse matrix arithmetic @@ -119,3 +123,4 @@ rather than $A$ as a sparse matrix. Multiply the $\text{m} \times \text{n}$ matrix represented by values w, column indices v, and row start indices u by the vector b; see [compressed row storage](#CSR). +`r since("2.18")` diff --git a/src/functions-reference/unbounded_continuous_distributions.Rmd b/src/functions-reference/unbounded_continuous_distributions.Rmd index 1971d9198..468bec93f 100644 --- a/src/functions-reference/unbounded_continuous_distributions.Rmd +++ b/src/functions-reference/unbounded_continuous_distributions.Rmd @@ -32,6 +32,7 @@ If $\mu \in \mathbb{R}$ and $\sigma \in \mathbb{R}^+$, then for $y \in `y ~ ` **`normal`**`(mu, sigma)` Increment target log probability density with `normal_lupdf(y | mu, sigma)`. +`r since("2.0")` \index{{\tt \bfseries normal }!sampling statement|hyperpage} @@ -42,6 +43,7 @@ Increment target log probability density with `normal_lupdf(y | mu, sigma)`. `real` **`normal_lpdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the normal density of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries normal\_lupdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -49,6 +51,7 @@ The log of the normal density of y given location mu and scale sigma `real` **`normal_lupdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the normal density of y given location mu and scale sigma dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries normal\_cdf }!{\tt (reals y, reals mu, reals sigma): real}|hyperpage} @@ -59,6 +62,7 @@ sigma; normal_cdf will underflow to 0 for $\frac{{y}-{\mu}}{{\sigma}}$ below -37.5 and overflow to 1 for $\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; the function `Phi_approx` is more robust in the tails, but must be scaled and translated for anything other than a standard normal. +`r since("2.0")` \index{{\tt \bfseries normal\_lcdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -70,6 +74,7 @@ $\frac{{y}-{\mu}}{{\sigma}}$ below -37.5 and overflow to 0 for $\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; `log(Phi_approx(...))` is more robust in the tails, but must be scaled and translated for anything other than a standard normal. +`r since("2.12")` \index{{\tt \bfseries normal\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -81,6 +86,7 @@ $\frac{{y}-{\mu}}{{\sigma}}$ below -37.5 and underflow to $-\infty$ for $\frac{{y}-{\mu}}{{\sigma}}$ above 8.25; `log1m(Phi_approx(...))` is more robust in the tails, but must be scaled and translated for anything other than a standard normal. +`r since("2.15")` \index{{\tt \bfseries normal\_rng }!{\tt (reals mu, reals sigma): R}|hyperpage} @@ -90,6 +96,7 @@ Generate a normal variate with location mu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ### Standard normal distribution @@ -111,6 +118,7 @@ normal log density with constant location $0$ and scale $1$. `y ~ ` **`std_normal`**`()` Increment target log probability density with `std_normal_lupdf(y)`. +`r since("2.19")` \index{{\tt \bfseries std\_normal }!sampling statement|hyperpage} @@ -122,6 +130,7 @@ Increment target log probability density with `std_normal_lupdf(y)`. `real` **`std_normal_lpdf`**`(reals y)`
\newline The standard normal (location zero, scale one) log probability density of y. +`r since("2.18")` \index{{\tt \bfseries std\_normal\_lupdf }!{\tt (reals y): real}|hyperpage} @@ -129,6 +138,7 @@ of y. `real` **`std_normal_lupdf`**`(reals y)`
\newline The standard normal (location zero, scale one) log probability density of y dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries std\_normal\_cdf }!{\tt (reals y): real}|hyperpage} @@ -137,6 +147,7 @@ of y dropping constant additive terms. The cumulative standard normal distribution of y; std_normal_cdf will underflow to 0 for $y$ below -37.5 and overflow to 1 for $y$ above 8.25; the function `Phi_approx` is more robust in the tails. +`r since("2.21")` \index{{\tt \bfseries std\_normal\_lcdf }!{\tt (reals y): real}|hyperpage} @@ -145,6 +156,7 @@ the function `Phi_approx` is more robust in the tails. The log of the cumulative standard normal distribution of y; std_normal_lcdf will underflow to $-\infty$ for $y$ below -37.5 and overflow to 0 for $y$ above 8.25; `log(Phi_approx(...))` is more robust in the tails. +`r since("2.21")` \index{{\tt \bfseries std\_normal\_lccdf }!{\tt (reals y): real}|hyperpage} @@ -154,6 +166,7 @@ The log of the complementary cumulative standard normal distribution of y; std_normal_lccdf will overflow to 0 for $y$ below -37.5 and underflow to $-\infty$ for $y$ above 8.25; `log1m(Phi_approx(...))` is more robust in the tails. +`r since("2.21")` \index{{\tt \bfseries std\_normal\_rng }!{\tt (): real}|hyperpage} @@ -161,6 +174,7 @@ tails. `real` **`std_normal_rng`**`()`
\newline Generate a normal variate with location zero and scale one; may only be used in transformed data and generated quantities blocks. +`r since("2.21")` ## Normal-id generalized linear model (linear regression) {#normal-id-glm} @@ -183,6 +197,7 @@ If $x\in \mathbb{R}^{n\cdot m}, \alpha \in \mathbb{R}^n, \beta\in `y ~ ` **`normal_id_glm`**`(x, alpha, beta, sigma)` Increment target log probability density with `normal_id_glm_lupdf(y | x, alpha, beta, sigma)`. +`r since("2.19")` \index{{\tt \bfseries normal\_id\_glm }!sampling statement|hyperpage} @@ -194,6 +209,7 @@ Increment target log probability density with `normal_id_glm_lupdf(y | x, alpha, `real` **`normal_id_glm_lpdf`**`(real y | matrix x, real alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma`. +`r since("2.23")` \index{{\tt \bfseries normal\_id\_glm\_lupdf }!{\tt (real y \textbar\ matrix x, real alpha, vector beta, real sigma): real}|hyperpage} @@ -201,6 +217,7 @@ and scale `sigma`. `real` **`normal_id_glm_lupdf`**`(real y | matrix x, real alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (real y \textbar\ matrix x, vector alpha, vector beta, real sigma): real}|hyperpage} @@ -208,6 +225,7 @@ and scale `sigma` dropping constant additive terms. `real` **`normal_id_glm_lpdf`**`(real y | matrix x, vector alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma`. +`r since("2.23")` \index{{\tt \bfseries normal\_id\_glm\_lupdf }!{\tt (real y \textbar\ matrix x, vector alpha, vector beta, real sigma): real}|hyperpage} @@ -215,6 +233,7 @@ and scale `sigma`. `real` **`normal_id_glm_lupdf`**`(real y | matrix x, vector alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ row\_vector x, real alpha, vector beta, real sigma): real}|hyperpage} @@ -222,6 +241,7 @@ and scale `sigma` dropping constant additive terms. `real` **`normal_id_glm_lpdf`**`(vector y | row_vector x, real alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma`. +`r since("2.23")` \index{{\tt \bfseries normal\_id\_glm\_lupdf }!{\tt (vector y \textbar\ row\_vector x, real alpha, vector beta, real sigma): real}|hyperpage} @@ -229,6 +249,7 @@ and scale `sigma`. `real` **`normal_id_glm_lupdf`**`(vector y | row_vector x, real alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ row\_vector x, vector alpha, vector beta, real sigma): real}|hyperpage} @@ -236,6 +257,7 @@ and scale `sigma` dropping constant additive terms. `real` **`normal_id_glm_lpdf`**`(vector y | row_vector x, vector alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma`. +`r since("2.23")` \index{{\tt \bfseries normal\_id\_glm\_lupdf }!{\tt (vector y \textbar\ row\_vector x, vector alpha, vector beta, real sigma): real}|hyperpage} @@ -243,6 +265,7 @@ and scale `sigma`. `real` **`normal_id_glm_lupdf`**`(vector y | row_vector x, vector alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ matrix x, real alpha, vector beta, real sigma): real}|hyperpage} @@ -250,6 +273,7 @@ and scale `sigma` dropping constant additive terms. `real` **`normal_id_glm_lpdf`**`(vector y | matrix x, real alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma`. +`r since("2.20")` \index{{\tt \bfseries normal\_id\_glm\_lupdf }!{\tt (vector y \textbar\ matrix x, real alpha, vector beta, real sigma): real}|hyperpage} @@ -257,6 +281,7 @@ and scale `sigma`. `real` **`normal_id_glm_lupdf`**`(vector y | matrix x, real alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries normal\_id\_glm\_lpdf }!{\tt (vector y \textbar\ matrix x, vector alpha, vector beta, real sigma): real}|hyperpage} @@ -264,6 +289,7 @@ and scale `sigma` dropping constant additive terms. `real` **`normal_id_glm_lpdf`**`(vector y | matrix x, vector alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma`. +`r since("2.20")` \index{{\tt \bfseries normal\_id\_glm\_lupdf }!{\tt (vector y \textbar\ matrix x, vector alpha, vector beta, real sigma): real}|hyperpage} @@ -271,6 +297,7 @@ and scale `sigma`. `real` **`normal_id_glm_lupdf`**`(vector y | matrix x, vector alpha, vector beta, real sigma)`
\newline The log normal probability density of `y` given location `alpha + x * beta` and scale `sigma` dropping constant additive terms. +`r since("2.25")` ## Exponentially modified normal distribution @@ -288,6 +315,7 @@ y}{\sqrt{2}\sigma}\right) . \] `y ~ ` **`exp_mod_normal`**`(mu, sigma, lambda)` Increment target log probability density with `exp_mod_normal_lupdf(y | mu, sigma, lambda)`. +`r since("2.0")` \index{{\tt \bfseries exp\_mod\_normal }!sampling statement|hyperpage} @@ -299,6 +327,7 @@ Increment target log probability density with `exp_mod_normal_lupdf(y | mu, sigm `real` **`exp_mod_normal_lpdf`**`(reals y | reals mu, reals sigma, reals lambda)`
\newline The log of the exponentially modified normal density of y given location mu, scale sigma, and shape lambda +`r since("2.18")` \index{{\tt \bfseries exp\_mod\_normal\_lupdf }!{\tt (reals y | reals mu, reals sigma, reals lambda): real}|hyperpage} @@ -306,6 +335,7 @@ location mu, scale sigma, and shape lambda `real` **`exp_mod_normal_lupdf`**`(reals y | reals mu, reals sigma, reals lambda)`
\newline The log of the exponentially modified normal density of y given location mu, scale sigma, and shape lambda dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries exp\_mod\_normal\_cdf }!{\tt (reals y, reals mu, reals sigma, reals lambda): real}|hyperpage} @@ -313,6 +343,7 @@ location mu, scale sigma, and shape lambda dropping constant additive terms `real` **`exp_mod_normal_cdf`**`(reals y, reals mu, reals sigma, reals lambda)`
\newline The exponentially modified normal cumulative distribution function of y given location mu, scale sigma, and shape lambda +`r since("2.0")` \index{{\tt \bfseries exp\_mod\_normal\_lcdf }!{\tt (reals y | reals mu, reals sigma, reals lambda): real}|hyperpage} @@ -320,6 +351,7 @@ y given location mu, scale sigma, and shape lambda `real` **`exp_mod_normal_lcdf`**`(reals y | reals mu, reals sigma, reals lambda)`
\newline The log of the exponentially modified normal cumulative distribution function of y given location mu, scale sigma, and shape lambda +`r since("2.18")` \index{{\tt \bfseries exp\_mod\_normal\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma, reals lambda): real}|hyperpage} @@ -328,6 +360,7 @@ function of y given location mu, scale sigma, and shape lambda The log of the exponentially modified normal complementary cumulative distribution function of y given location mu, scale sigma, and shape lambda +`r since("2.18")` \index{{\tt \bfseries exp\_mod\_normal\_rng }!{\tt (reals mu, reals sigma, reals lambda): R}|hyperpage} @@ -337,6 +370,7 @@ Generate a exponentially modified normal variate with location mu, scale sigma, and shape lambda; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Skew normal distribution @@ -354,6 +388,7 @@ If $\xi \in \mathbb{R}$, $\omega \in \mathbb{R}^+$, and $\alpha \in `y ~ ` **`skew_normal`**`(xi, omega, alpha)` Increment target log probability density with `skew_normal_lupdf(y | xi, omega, alpha)`. +`r since("2.0")` \index{{\tt \bfseries skew\_normal }!sampling statement|hyperpage} @@ -365,6 +400,7 @@ Increment target log probability density with `skew_normal_lupdf(y | xi, omega, `real` **`skew_normal_lpdf`**`(reals y | reals xi, reals omega, reals alpha)`
\newline The log of the skew normal density of y given location xi, scale omega, and shape alpha +`r since("2.16")` \index{{\tt \bfseries skew\_normal\_lupdf }!{\tt (reals y \textbar\ reals xi, reals omega, reals alpha): real}|hyperpage} @@ -372,6 +408,7 @@ omega, and shape alpha `real` **`skew_normal_lupdf`**`(reals y | reals xi, reals omega, reals alpha)`
\newline The log of the skew normal density of y given location xi, scale omega, and shape alpha dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries skew\_normal\_cdf }!{\tt (reals y, reals xi, reals omega, reals alpha): real}|hyperpage} @@ -379,6 +416,7 @@ omega, and shape alpha dropping constant additive terms `real` **`skew_normal_cdf`**`(reals y, reals xi, reals omega, reals alpha)`
\newline The skew normal distribution function of y given location xi, scale omega, and shape alpha +`r since("2.16")` \index{{\tt \bfseries skew\_normal\_lcdf }!{\tt (reals y \textbar\ reals xi, reals omega, reals alpha): real}|hyperpage} @@ -386,6 +424,7 @@ omega, and shape alpha `real` **`skew_normal_lcdf`**`(reals y | reals xi, reals omega, reals alpha)`
\newline The log of the skew normal cumulative distribution function of y given location xi, scale omega, and shape alpha +`r since("2.18")` \index{{\tt \bfseries skew\_normal\_lccdf }!{\tt (reals y \textbar\ reals xi, reals omega, reals alpha): real}|hyperpage} @@ -393,6 +432,7 @@ location xi, scale omega, and shape alpha `real` **`skew_normal_lccdf`**`(reals y | reals xi, reals omega, reals alpha)`
\newline The log of the skew normal complementary cumulative distribution function of y given location xi, scale omega, and shape alpha +`r since("2.18")` \index{{\tt \bfseries skew\_normal\_rng }!{\tt (reals xi, reals omega, real alpha): R}|hyperpage} @@ -402,6 +442,7 @@ Generate a skew normal variate with location xi, scale omega, and shape alpha; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Student-t distribution @@ -419,6 +460,7 @@ If $\nu \in \mathbb{R}^+$, $\mu \in \mathbb{R}$, and $\sigma \in `y ~ ` **`student_t`**`(nu, mu, sigma)` Increment target log probability density with `student_t_lupdf(y | nu, mu, sigma)`. +`r since("2.0")` \index{{\tt \bfseries student\_t }!sampling statement|hyperpage} @@ -430,6 +472,7 @@ Increment target log probability density with `student_t_lupdf(y | nu, mu, sigma `real` **`student_t_lpdf`**`(reals y | reals nu, reals mu, reals sigma)`
\newline The log of the Student-$t$ density of y given degrees of freedom nu, location mu, and scale sigma +`r since("2.12")` \index{{\tt \bfseries student\_t\_lupdf }!{\tt (reals y \textbar\ reals nu, reals mu, reals sigma): real}|hyperpage} @@ -437,6 +480,7 @@ location mu, and scale sigma `real` **`student_t_lupdf`**`(reals y | reals nu, reals mu, reals sigma)`
\newline The log of the Student-$t$ density of y given degrees of freedom nu, location mu, and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries student\_t\_cdf }!{\tt (reals y, reals nu, reals mu, reals sigma): real}|hyperpage} @@ -444,6 +488,7 @@ location mu, and scale sigma dropping constant additive terms `real` **`student_t_cdf`**`(reals y, reals nu, reals mu, reals sigma)`
\newline The Student-$t$ cumulative distribution function of y given degrees of freedom nu, location mu, and scale sigma +`r since("2.0")` \index{{\tt \bfseries student\_t\_lcdf }!{\tt (reals y \textbar\ reals nu, reals mu, reals sigma): real}|hyperpage} @@ -451,6 +496,7 @@ freedom nu, location mu, and scale sigma `real` **`student_t_lcdf`**`(reals y | reals nu, reals mu, reals sigma)`
\newline The log of the Student-$t$ cumulative distribution function of y given degrees of freedom nu, location mu, and scale sigma +`r since("2.12")` \index{{\tt \bfseries student\_t\_lccdf }!{\tt (reals y \textbar\ reals nu, reals mu, reals sigma): real}|hyperpage} @@ -459,6 +505,7 @@ degrees of freedom nu, location mu, and scale sigma The log of the Student-$t$ complementary cumulative distribution function of y given degrees of freedom nu, location mu, and scale sigma +`r since("2.12")` \index{{\tt \bfseries student\_t\_rng }!{\tt (reals nu, reals mu, reals sigma): R}|hyperpage} @@ -468,6 +515,7 @@ Generate a Student-$t$ variate with degrees of freedom nu, location mu, and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Cauchy distribution @@ -482,6 +530,7 @@ If $\mu \in \mathbb{R}$ and $\sigma \in \mathbb{R}^+$, then for $y \in `y ~ ` **`cauchy`**`(mu, sigma)` Increment target log probability density with `cauchy_lupdf(y | mu, sigma)`. +`r since("2.0")` \index{{\tt \bfseries cauchy }!sampling statement|hyperpage} @@ -492,6 +541,7 @@ Increment target log probability density with `cauchy_lupdf(y | mu, sigma)`. `real` **`cauchy_lpdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the Cauchy density of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries cauchy\_lupdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -499,6 +549,7 @@ The log of the Cauchy density of y given location mu and scale sigma `real` **`cauchy_lupdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the Cauchy density of y given location mu and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries cauchy\_cdf }!{\tt (reals y, reals mu, reals sigma): real}|hyperpage} @@ -506,6 +557,7 @@ dropping constant additive terms `real` **`cauchy_cdf`**`(reals y, reals mu, reals sigma)`
\newline The Cauchy cumulative distribution function of y given location mu and scale sigma +`r since("2.0")` \index{{\tt \bfseries cauchy\_lcdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -513,6 +565,7 @@ scale sigma `real` **`cauchy_lcdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the Cauchy cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries cauchy\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -520,6 +573,7 @@ location mu and scale sigma `real` **`cauchy_lccdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the Cauchy complementary cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries cauchy\_rng }!{\tt (reals mu, reals sigma): R}|hyperpage} @@ -529,6 +583,7 @@ Generate a Cauchy variate with location mu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Double exponential (Laplace) distribution @@ -559,6 +614,7 @@ a non-centered parameterization by taking \[ \beta^{\text{raw}} \sim `y ~ ` **`double_exponential`**`(mu, sigma)` Increment target log probability density with `double_exponential_lupdf(y | mu, sigma)`. +`r since("2.0")` \index{{\tt \bfseries double\_exponential }!sampling statement|hyperpage} @@ -570,6 +626,7 @@ Increment target log probability density with `double_exponential_lupdf(y | mu, `real` **`double_exponential_lpdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the double exponential density of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries double\_exponential\_lupdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -577,6 +634,7 @@ scale sigma `real` **`double_exponential_lupdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the double exponential density of y given location mu and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries double\_exponential\_cdf }!{\tt (reals y, reals mu, reals sigma): real}|hyperpage} @@ -584,6 +642,7 @@ scale sigma dropping constant additive terms `real` **`double_exponential_cdf`**`(reals y, reals mu, reals sigma)`
\newline The double exponential cumulative distribution function of y given location mu and scale sigma +`r since("2.0")` \index{{\tt \bfseries double\_exponential\_lcdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -591,6 +650,7 @@ location mu and scale sigma `real` **`double_exponential_lcdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the double exponential cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries double\_exponential\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -598,6 +658,7 @@ y given location mu and scale sigma `real` **`double_exponential_lccdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the double exponential complementary cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries double\_exponential\_rng }!{\tt (reals mu, reals sigma): R}|hyperpage} @@ -607,6 +668,7 @@ Generate a double exponential variate with location mu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Logistic distribution @@ -622,6 +684,7 @@ If $\mu \in \mathbb{R}$ and $\sigma \in \mathbb{R}^+$, then for $y \in `y ~ ` **`logistic`**`(mu, sigma)` Increment target log probability density with `logistic_lupdf(y | mu, sigma)`. +`r since("2.0")` \index{{\tt \bfseries logistic }!sampling statement|hyperpage} @@ -632,6 +695,7 @@ Increment target log probability density with `logistic_lupdf(y | mu, sigma)`. `real` **`logistic_lpdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the logistic density of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries logistic\_lupdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -639,6 +703,7 @@ The log of the logistic density of y given location mu and scale sigma `real` **`logistic_lupdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the logistic density of y given location mu and scale sigma dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries logistic\_cdf }!{\tt (reals y, reals mu, reals sigma): real}|hyperpage} @@ -646,6 +711,7 @@ dropping constant additive terms `real` **`logistic_cdf`**`(reals y, reals mu, reals sigma)`
\newline The logistic cumulative distribution function of y given location mu and scale sigma +`r since("2.0")` \index{{\tt \bfseries logistic\_lcdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -653,6 +719,7 @@ and scale sigma `real` **`logistic_lcdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the logistic cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries logistic\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma): real}|hyperpage} @@ -660,6 +727,7 @@ location mu and scale sigma `real` **`logistic_lccdf`**`(reals y | reals mu, reals sigma)`
\newline The log of the logistic complementary cumulative distribution function of y given location mu and scale sigma +`r since("2.12")` \index{{\tt \bfseries logistic\_rng}!{\tt (reals mu, reals sigma): R}|hyperpage} @@ -669,6 +737,7 @@ Generate a logistic variate with location mu and scale sigma; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Gumbel distribution @@ -684,6 +753,7 @@ If $\mu \in \mathbb{R}$ and $\beta \in \mathbb{R}^+$, then for $y \in `y ~ ` **`gumbel`**`(mu, beta)` Increment target log probability density with `gumbel_lupdf(y | mu, beta)`. +`r since("2.0")` \index{{\tt \bfseries gumbel }!sampling statement|hyperpage} @@ -694,6 +764,7 @@ Increment target log probability density with `gumbel_lupdf(y | mu, beta)`. `real` **`gumbel_lpdf`**`(reals y | reals mu, reals beta)`
\newline The log of the gumbel density of y given location mu and scale beta +`r since("2.12")` \index{{\tt \bfseries gumbel\_lupdf }!{\tt (reals y \textbar\ reals mu, reals beta): real}|hyperpage} @@ -701,6 +772,7 @@ The log of the gumbel density of y given location mu and scale beta `real` **`gumbel_lupdf`**`(reals y | reals mu, reals beta)`
\newline The log of the gumbel density of y given location mu and scale beta dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries gumbel\_cdf }!{\tt (reals y, reals mu, reals beta): real}|hyperpage} @@ -708,6 +780,7 @@ dropping constant additive terms `real` **`gumbel_cdf`**`(reals y, reals mu, reals beta)`
\newline The gumbel cumulative distribution function of y given location mu and scale beta +`r since("2.0")` \index{{\tt \bfseries gumbel\_lcdf }!{\tt (reals y \textbar\ reals mu, reals beta): real}|hyperpage} @@ -715,6 +788,7 @@ scale beta `real` **`gumbel_lcdf`**`(reals y | reals mu, reals beta)`
\newline The log of the gumbel cumulative distribution function of y given location mu and scale beta +`r since("2.12")` \index{{\tt \bfseries gumbel\_lccdf }!{\tt (reals y \textbar\ reals mu, reals beta): real}|hyperpage} @@ -722,6 +796,7 @@ location mu and scale beta `real` **`gumbel_lccdf`**`(reals y | reals mu, reals beta)`
\newline The log of the gumbel complementary cumulative distribution function of y given location mu and scale beta +`r since("2.12")` \index{{\tt \bfseries gumbel\_rng }!{\tt (reals mu, reals beta): R}|hyperpage} @@ -731,15 +806,16 @@ Generate a gumbel variate with location mu and scale beta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.18")` ## Skew double exponential distribution ### Probability density function If $\mu \in \mathbb{R}$, $\sigma \in \mathbb{R}^+$ and $\tau \in [0, 1]$, -then for $y \in \mathbb{R}$, -$$\begin{aligned} -& \text{SkewDoubleExponential} (y|\mu,\sigma, \tau) = \\ +then for $y \in \mathbb{R}$, +$$\begin{aligned} +& \text{SkewDoubleExponential} (y|\mu,\sigma, \tau) = \\ & \qquad \qquad \frac{2 \tau (1 - \tau) }{\sigma} \exp \left[ - \frac{2}{\sigma} \left[ \left(1 - \tau \right) I(y < \mu) (\mu - y) + \tau I(y > \mu)(y-\mu) \right] \right] \end{aligned}$$ @@ -749,6 +825,7 @@ $$\begin{aligned} `y ~ ` **`skew_double_exponential`**`(mu, sigma, tau)` Increment target log probability density with `skew_double_exponential(y | mu, sigma, tau)` +`r since("2.28")` \index{{\tt \bfseries skew\_double\_exponential }!sampling statement|hyperpage} @@ -759,12 +836,14 @@ Increment target log probability density with `skew_double_exponential(y | mu, s `real` **`skew_double_exponential_lpdf`**`(reals y | reals mu, reals sigma, reals tau)`
\newline The log of the skew double exponential density of y given location mu, scale sigma and skewness tau +`r since("2.28")` \index{{\tt \bfseries skew\_double\_exponential\_lupdf }!{\tt (reals y \textbar\ reals mu, reals sigma, reals tau): real}|hyperpage} `real` **`skew_double_exponential_lupdf`**`(reals y | reals mu, reals sigma, reals tau)`
\newline The log of the skew double exponential density of y given location mu, scale sigma and skewness tau dropping constant additive terms +`r since("2.28")` \index{{\tt \bfseries skew\_double\_exponential\_cdf }!{\tt (reals y, reals mu, reals sigma, reals tau): real}|hyperpage} @@ -772,6 +851,7 @@ The log of the skew double exponential density of y given location mu, scale sig `real` **`skew_double_exponential_cdf`**`(reals y, reals mu, reals sigma, reals tau)`
\newline The skew double exponential cumulative distribution function of y given location mu, scale sigma and skewness tau +`r since("2.28")` \index{{\tt \bfseries skew\_double\_exponential\_lcdf }!{\tt (reals y \textbar\ reals mu, reals sigma, reals tau): real}|hyperpage} @@ -779,6 +859,7 @@ location mu, scale sigma and skewness tau `real` **`skew_double_exponential_lcdf`**`(reals y | reals mu, reals sigma, reals tau)`
\newline The log of the skew double exponential cumulative distribution function of y given location mu, scale sigma and skewness tau +`r since("2.28")` \index{{\tt \bfseries skew\_double\_exponential\_lccdf }!{\tt (reals y \textbar\ reals mu, reals sigma, reals tau): real}|hyperpage} @@ -786,6 +867,7 @@ y given location mu, scale sigma and skewness tau `real` **`skew_double_exponential_lccdf`**`(reals y | reals mu, reals sigma, reals tau)`
\newline The log of the skew double exponential complementary cumulative distribution function of y given location mu, scale sigma and skewness tau +`r since("2.28")` \index{{\tt \bfseries skew\_double\_exponential\_rng }!{\tt (reals mu, reals sigma, reals tau): R}|hyperpage} @@ -795,3 +877,4 @@ Generate a skew double exponential variate with location mu, scale sigma and skewness tau; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section [vectorized PRNG functions](#prng-vectorization). +`r since("2.28")` diff --git a/src/functions-reference/unbounded_discrete_distributions.Rmd b/src/functions-reference/unbounded_discrete_distributions.Rmd index 64aedcab4..de9cef0d5 100644 --- a/src/functions-reference/unbounded_discrete_distributions.Rmd +++ b/src/functions-reference/unbounded_discrete_distributions.Rmd @@ -38,6 +38,7 @@ The mean and variance of a random variable $n \sim `n ~ ` **`neg_binomial`**`(alpha, beta)` Increment target log probability density with `neg_binomial_lupmf(n | alpha, beta)`. +`r since("2.0")` \index{{\tt \bfseries neg\_binomial }!sampling statement|hyperpage} @@ -49,6 +50,7 @@ Increment target log probability density with `neg_binomial_lupmf(n | alpha, bet `real` **`neg_binomial_lpmf`**`(ints n | reals alpha, reals beta)`
\newline The log negative binomial probability mass of `n` given shape `alpha` and inverse scale `beta` +`r since("2.12")` \index{{\tt \bfseries neg\_binomial\_lupmf }!{\tt (ints n \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -56,6 +58,7 @@ inverse scale `beta` `real` **`neg_binomial_lupmf`**`(ints n | reals alpha, reals beta)`
\newline The log negative binomial probability mass of `n` given shape `alpha` and inverse scale `beta` dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_cdf }!{\tt (ints n, reals alpha, reals beta): real}|hyperpage} @@ -63,6 +66,7 @@ inverse scale `beta` dropping constant additive terms `real` **`neg_binomial_cdf`**`(ints n, reals alpha, reals beta)`
\newline The negative binomial cumulative distribution function of `n` given shape `alpha` and inverse scale `beta` +`r since("2.0")` \index{{\tt \bfseries neg\_binomial\_lcdf }!{\tt (ints n \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -70,6 +74,7 @@ shape `alpha` and inverse scale `beta` `real` **`neg_binomial_lcdf`**`(ints n | reals alpha, reals beta)`
\newline The log of the negative binomial cumulative distribution function of `n` given shape `alpha` and inverse scale `beta` +`r since("2.12")` \index{{\tt \bfseries neg\_binomial\_lccdf }!{\tt (ints n \textbar\ reals alpha, reals beta): real}|hyperpage} @@ -77,6 +82,7 @@ given shape `alpha` and inverse scale `beta` `real` **`neg_binomial_lccdf`**`(ints n | reals alpha, reals beta)`
\newline The log of the negative binomial complementary cumulative distribution function of `n` given shape `alpha` and inverse scale `beta` +`r since("2.12")` \index{{\tt \bfseries neg\_binomial\_rng }!{\tt (reals alpha, reals beta): R}|hyperpage} @@ -86,6 +92,7 @@ Generate a negative binomial variate with shape `alpha` and inverse scale `beta`; may only be used in transformed data and generated quantities blocks. `alpha` $/$ `beta` must be less than $2 ^ {29}$. For a description of argument and return types, see section [vectorized function signatures](#prob-vectorization). +`r since("2.18")` ## Negative binomial distribution (alternative parameterization) {#nbalt} @@ -116,6 +123,7 @@ the overdispersion, scaled by the square of the mean, $\mu^2$. `n ~ ` **`neg_binomial_2`**`(mu, phi)` Increment target log probability density with `neg_binomial_2_lupmf(n | mu, phi)`. +`r since("2.3")` \index{{\tt \bfseries neg\_binomial\_2 }!sampling statement|hyperpage} @@ -127,6 +135,7 @@ Increment target log probability density with `neg_binomial_2_lupmf(n | mu, phi) `real` **`neg_binomial_2_lpmf`**`(ints n | reals mu, reals phi)`
\newline The negative binomial probability mass of `n` given location `mu` and precision `phi`. +`r since("2.20")` \index{{\tt \bfseries neg\_binomial\_2\_lupmf }!{\tt (ints n \textbar\ reals mu, reals phi): real}|hyperpage} @@ -134,6 +143,7 @@ precision `phi`. `real` **`neg_binomial_2_lupmf`**`(ints n | reals mu, reals phi)`
\newline The negative binomial probability mass of `n` given location `mu` and precision `phi` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_2\_cdf }!{\tt (ints n, reals mu, reals phi): real}|hyperpage} @@ -141,6 +151,7 @@ precision `phi` dropping constant additive terms. `real` **`neg_binomial_2_cdf`**`(ints n, reals mu, reals phi)`
\newline The negative binomial cumulative distribution function of `n` given location `mu` and precision `phi`. +`r since("2.6")` \index{{\tt \bfseries neg\_binomial\_2\_lcdf }!{\tt (ints n \textbar\ reals mu, reals phi): real}|hyperpage} @@ -148,6 +159,7 @@ location `mu` and precision `phi`. `real` **`neg_binomial_2_lcdf`**`(ints n | reals mu, reals phi)`
\newline The log of the negative binomial cumulative distribution function of `n` given location `mu` and precision `phi`. +`r since("2.12")` \index{{\tt \bfseries neg\_binomial\_2\_lccdf }!{\tt (ints n \textbar\ reals mu, reals phi): real}|hyperpage} @@ -155,6 +167,7 @@ given location `mu` and precision `phi`. `real` **`neg_binomial_2_lccdf`**`(ints n | reals mu, reals phi)`
\newline The log of the negative binomial complementary cumulative distribution function of `n` given location `mu` and precision `phi`. +`r since("2.12")` \index{{\tt \bfseries neg\_binomial\_2\_rng }!{\tt (reals mu, reals phi): R}|hyperpage} @@ -164,6 +177,7 @@ Generate a negative binomial variate with location `mu` and precision `phi`; may only be used in transformed data and generated quantities blocks. `mu` must be less than $2 ^ {29}$. For a description of argument and return types, see section [vectorized function signatures](#prob-vectorization). +`r since("2.18")` ## Negative binomial distribution (log alternative parameterization) {#neg-binom-2-log} @@ -181,6 +195,7 @@ for log-linear negative binomial regressions. `n ~ ` **`neg_binomial_2_log`**`(eta, phi)` Increment target log probability density with `neg_binomial_2_log_lupmf(n | eta, phi)`. +`r since("2.3")` \index{{\tt \bfseries neg\_binomial\_2\_log }!sampling statement|hyperpage} @@ -192,6 +207,7 @@ Increment target log probability density with `neg_binomial_2_log_lupmf(n | eta, `real` **`neg_binomial_2_log_lpmf`**`(ints n | reals eta, reals phi)`
\newline The log negative binomial probability mass of `n` given log-location `eta` and inverse overdispersion parameter `phi`. +`r since("2.20")` \index{{\tt \bfseries neg\_binomial\_2\_log\_lupmf }!{\tt (ints n \textbar\ reals eta, reals phi): real}|hyperpage} @@ -199,6 +215,7 @@ and inverse overdispersion parameter `phi`. `real` **`neg_binomial_2_log_lupmf`**`(ints n | reals eta, reals phi)`
\newline The log negative binomial probability mass of `n` given log-location `eta` and inverse overdispersion parameter `phi` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_2\_log\_rng }!{\tt (reals eta, reals phi): R}|hyperpage} @@ -208,6 +225,7 @@ Generate a negative binomial variate with log-location `eta` and inverse overdispersion control `phi`; may only be used in transformed data and generated quantities blocks. `eta` must be less than $29 \log 2$. For a description of argument and return types, see section [vectorized function signatures](#prob-vectorization). +`r since("2.18")` ## Negative-binomial-2-log generalized linear model (negative binomial regression) {#neg-binom-2-log-glm} @@ -231,6 +249,7 @@ If $x\in \mathbb{R}^{n\cdot m}, \alpha \in \mathbb{R}^n, \beta\in `y ~ ` **`neg_binomial_2_log_glm`**`(x, alpha, beta, phi)` Increment target log probability density with `neg_binomial_2_log_glm_lupmf(y | x, alpha, beta, phi)`. +`r since("2.19")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm }!sampling statement|hyperpage} @@ -242,6 +261,7 @@ Increment target log probability density with `neg_binomial_2_log_glm_lupmf(y | `real` **`neg_binomial_2_log_glm_lpmf`**`(int y | matrix x, real alpha, vector beta, real phi)`
\newline The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi`. +`r since("2.23")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, real alpha, vector beta, real phi): real}|hyperpage} @@ -250,6 +270,7 @@ The log negative binomial probability mass of `y` given log-location The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lpmf }!{\tt (int y \textbar\ matrix x, vector alpha, vector beta, real phi): real}|hyperpage} @@ -257,6 +278,7 @@ dropping constant additive terms. `real` **`neg_binomial_2_log_glm_lpmf`**`(int y | matrix x, vector alpha, vector beta, real phi)`
\newline The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi`. +`r since("2.23")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, vector alpha, vector beta, real phi): real}|hyperpage} @@ -265,6 +287,7 @@ The log negative binomial probability mass of `y` given log-location The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, real alpha, vector beta, real phi): real}|hyperpage} @@ -272,6 +295,7 @@ dropping constant additive terms. `real` **`neg_binomial_2_log_glm_lpmf`**`(array[] int y | row_vector x, real alpha, vector beta, real phi)`
\newline The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi`. +`r since("2.23")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, real alpha, vector beta, real phi): real}|hyperpage} @@ -280,6 +304,7 @@ The log negative binomial probability mass of `y` given log-location The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, vector beta, real phi): real}|hyperpage} @@ -287,6 +312,7 @@ dropping constant additive terms. `real` **`neg_binomial_2_log_glm_lpmf`**`(array[] int y | row_vector x, vector alpha, vector beta, real phi)`
\newline The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi`. +`r since("2.23")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, vector beta, real phi): real}|hyperpage} @@ -295,6 +321,7 @@ The log negative binomial probability mass of `y` given log-location The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ matrix x, real alpha, vector beta, real phi): real}|hyperpage} @@ -302,6 +329,7 @@ dropping constant additive terms. `real` **`neg_binomial_2_log_glm_lpmf`**`(array[] int y | matrix x, real alpha, vector beta, real phi)`
\newline The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi`. +`r since("2.18")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, real alpha, vector beta, real phi): real}|hyperpage} @@ -310,6 +338,7 @@ The log negative binomial probability mass of `y` given log-location The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, vector beta, real phi): real}|hyperpage} @@ -317,6 +346,7 @@ dropping constant additive terms. `real` **`neg_binomial_2_log_glm_lpmf`**`(array[] int y | matrix x, vector alpha, vector beta, real phi)`
\newline The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi`. +`r since("2.18")` \index{{\tt \bfseries neg\_binomial\_2\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, vector beta, real phi): real}|hyperpage} @@ -325,6 +355,7 @@ The log negative binomial probability mass of `y` given log-location The log negative binomial probability mass of `y` given log-location `alpha + x * beta` and inverse overdispersion parameter `phi` dropping constant additive terms. +`r since("2.25")` ## Poisson distribution {#poisson} @@ -339,6 +370,7 @@ If $\lambda \in \mathbb{R}^+$, then for $n \in \mathbb{N}$, \[ `n ~ ` **`poisson`**`(lambda)` Increment target log probability density with `poisson_lupmf(n | lambda)`. +`r since("2.0")` \index{{\tt \bfseries poisson }!sampling statement|hyperpage} @@ -349,6 +381,7 @@ Increment target log probability density with `poisson_lupmf(n | lambda)`. `real` **`poisson_lpmf`**`(ints n | reals lambda)`
\newline The log Poisson probability mass of n given rate lambda +`r since("2.12")` \index{{\tt \bfseries poisson\_lupmf }!{\tt (ints n | reals lambda): real}|hyperpage} @@ -356,12 +389,14 @@ The log Poisson probability mass of n given rate lambda `real` **`poisson_lupmf`**`(ints n | reals lambda)`
\newline The log Poisson probability mass of n given rate lambda dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries poisson\_cdf }!{\tt (ints n, reals lambda): real}|hyperpage} `real` **`poisson_cdf`**`(ints n, reals lambda)`
\newline The Poisson cumulative distribution function of n given rate lambda +`r since("2.0")` \index{{\tt \bfseries poisson\_lcdf }!{\tt (ints n \textbar\ reals lambda): real}|hyperpage} @@ -369,6 +404,7 @@ The Poisson cumulative distribution function of n given rate lambda `real` **`poisson_lcdf`**`(ints n | reals lambda)`
\newline The log of the Poisson cumulative distribution function of n given rate lambda +`r since("2.12")` \index{{\tt \bfseries poisson\_lccdf }!{\tt (ints n \textbar\ reals lambda): real}|hyperpage} @@ -376,6 +412,7 @@ rate lambda `real` **`poisson_lccdf`**`(ints n | reals lambda)`
\newline The log of the Poisson complementary cumulative distribution function of n given rate lambda +`r since("2.12")` \index{{\tt \bfseries poisson\_rng }!{\tt (reals lambda): R}|hyperpage} @@ -385,6 +422,7 @@ Generate a Poisson variate with rate lambda; may only be used in transformed data and generated quantities blocks. lambda must be less than $2^{30}$. For a description of argument and return types, see section [vectorized function signatures](#prob-vectorization). +`r since("2.18")` ## Poisson distribution, log parameterization @@ -405,6 +443,7 @@ If $\alpha \in \mathbb{R}$, then for $n \in \mathbb{N}$, \[ `n ~ ` **`poisson_log`**`(alpha)` Increment target log probability density with `poisson_log_lupmf(n | alpha)`. +`r since("2.0")` \index{{\tt \bfseries poisson\_log }!sampling statement|hyperpage} @@ -415,6 +454,7 @@ Increment target log probability density with `poisson_log_lupmf(n | alpha)`. `real` **`poisson_log_lpmf`**`(ints n | reals alpha)`
\newline The log Poisson probability mass of n given log rate alpha +`r since("2.12")` \index{{\tt \bfseries poisson\_log\_lupmf }!{\tt (ints n \textbar\ reals alpha): real}|hyperpage} @@ -422,6 +462,7 @@ The log Poisson probability mass of n given log rate alpha `real` **`poisson_log_lupmf`**`(ints n | reals alpha)`
\newline The log Poisson probability mass of n given log rate alpha dropping constant additive terms +`r since("2.25")` \index{{\tt \bfseries poisson\_log\_rng }!{\tt (reals alpha): R}|hyperpage} @@ -431,6 +472,7 @@ Generate a Poisson variate with log rate alpha; may only be used in transformed data and generated quantities blocks. alpha must be less than $30 \log 2$. For a description of argument and return types, see section [vectorized function signatures](#prob-vectorization). +`r since("2.18")` ## Poisson-log generalized linear model (Poisson regression) {#poisson-log-glm} @@ -452,6 +494,7 @@ n}\text{Poisson}(y_i|\exp(\alpha_i + x_i\cdot \beta)). \] `y ~ ` **`poisson_log_glm`**`(x, alpha, beta)` Increment target log probability density with `poisson_log_glm_lupmf(y | x, alpha, beta)`. +`r since("2.19")` \index{{\tt \bfseries poisson\_log\_glm }!sampling statement|hyperpage} @@ -462,6 +505,7 @@ Increment target log probability density with `poisson_log_glm_lupmf(y | x, alph `real` **`poisson_log_glm_lpmf`**`(int y | matrix x, real alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries poisson\_log\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, real alpha, vector beta): real}|hyperpage} @@ -469,12 +513,14 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. `real` **`poisson_log_glm_lupmf`**`(int y | matrix x, real alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries poisson\_log\_glm\_lpmf }!{\tt (int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} `real` **`poisson_log_glm_lpmf`**`(int y | matrix x, vector alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries poisson\_log\_glm\_lupmf }!{\tt (int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} @@ -482,12 +528,14 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. `real` **`poisson_log_glm_lupmf`**`(int y | matrix x, vector alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries poisson\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, real alpha, vector beta): real}|hyperpage} `real` **`poisson_log_glm_lpmf`**`(array[] int y | row_vector x, real alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries poisson\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, real alpha, vector beta): real}|hyperpage} @@ -495,12 +543,14 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. `real` **`poisson_log_glm_lupmf`**`(array[] int y | row_vector x, real alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries poisson\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, vector beta): real}|hyperpage} `real` **`poisson_log_glm_lpmf`**`(array[] int y | row_vector x, vector alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. +`r since("2.23")` \index{{\tt \bfseries poisson\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ row\_vector x, vector alpha, vector beta): real}|hyperpage} @@ -508,12 +558,14 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. `real` **`poisson_log_glm_lupmf`**`(array[] int y | row_vector x, vector alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries poisson\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ matrix x, real alpha, vector beta): real}|hyperpage} `real` **`poisson_log_glm_lpmf`**`(array[] int y | matrix x, real alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. +`r since("2.18")` \index{{\tt \bfseries poisson\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, real alpha, vector beta): real}|hyperpage} @@ -521,12 +573,14 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. `real` **`poisson_log_glm_lupmf`**`(array[] int y | matrix x, real alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` \index{{\tt \bfseries poisson\_log\_glm\_lpmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} `real` **`poisson_log_glm_lpmf`**`(array[] int y | matrix x, vector alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. +`r since("2.18")` \index{{\tt \bfseries poisson\_log\_glm\_lupmf }!{\tt (array[] int y \textbar\ matrix x, vector alpha, vector beta): real}|hyperpage} @@ -534,3 +588,4 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`. `real` **`poisson_log_glm_lupmf`**`(array[] int y | matrix x, vector alpha, vector beta)`
\newline The log Poisson probability mass of `y` given the log-rate `alpha + x * beta` dropping constant additive terms. +`r since("2.25")` diff --git a/src/functions-reference/void_functions.Rmd b/src/functions-reference/void_functions.Rmd index b55d5e97f..79fd4394d 100644 --- a/src/functions-reference/void_functions.Rmd +++ b/src/functions-reference/void_functions.Rmd @@ -41,6 +41,8 @@ line feed (LF; Unicode U+000A; C++ literal `'\n'`) is inserted at the end of the printed line. The types `T1` through `TN` can be any of Stan's built-in numerical types or double quoted strings of characters (bytes). +`r since("2.1")` + ## Reject statement @@ -61,3 +63,4 @@ spaces between items in the print, but a line feed (LF; Unicode U+000A; C++ literal `'\n'`) is inserted at the end of the printed line. The types `T1` through `TN` can be any of Stan's built-in numerical types or double quoted strings of characters (bytes). +`r since("2.18")`