Skip to content

Commit 675eb98

Browse files
authored
Merge branch 'master' into functions-reference/link-to-to_int
2 parents 634e515 + c2180ce commit 675eb98

17 files changed

+344
-152
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/functions-reference/functions_index.qmd linguist-generated=true

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,3 @@ Describe the issue as clearly as possible.
88

99
#### Additional Information:
1010
Provide any additional information here.
11-
12-
#### Current Version:
13-
v2.18.0

src/bibtex/all.bib

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,3 +1845,29 @@ @article{Timonen+etal:2023:ODE-PSIS
18451845
pages = {e614}
18461846
}
18471847

1848+
@article{egozcue+etal:2003,
1849+
title={Isometric logratio transformations for compositional data analysis},
1850+
author={Egozcue, Juan Jos{\'e} and Pawlowsky-Glahn, Vera and Mateu-Figueras, Gl{\`o}ria and Barcelo-Vidal, Carles},
1851+
journal={Mathematical Geology},
1852+
volume={35},
1853+
number={3},
1854+
pages={279--300},
1855+
year={2003}
1856+
}
1857+
1858+
@book{filzmoser+etal:2018,
1859+
title={Geometrical properties of compositional data},
1860+
author={Filzmoser, Peter and Hron, Karel and Templ, Matthias},
1861+
booktitle={Applied Compositional Data Analysis: With Worked Examples in R},
1862+
pages={35--68},
1863+
year={2018},
1864+
publisher={Springer}
1865+
}
1866+
1867+
@misc{seyboldt:2024,
1868+
author="Seyboldt, Adrian",
1869+
title="Add ZeroSumNormal distribution",
1870+
note="pyro-ppl GitHub repository issue \#1751",
1871+
year = "2024",
1872+
url ="https://github.com/pyro-ppl/numpyro/pull/1751#issuecomment-1980569811"
1873+
}

src/cmdstan-guide/installation.qmd

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ Python bindings to CmdStan seamlessly. Additionally, it provides the
2727
command `cmdstan_model` to activate the CmdStan makefile from anywhere.
2828

2929
_Note_: This requires that conda has been installed already on your machine.
30-
You can either install [miniconda](https://docs.conda.io/en/latest/miniconda.html), a free, minimal installer for conda
31-
or you can get the full [Anaconda](https://docs.continuum.io/anaconda/) system
32-
which provides graphical installer wizards for [MacOS](https://www.anaconda.com/products/distribution#macos)
33-
and [Windows](https://www.anaconda.com/products/distribution#windows) users.
30+
We recommend using the [miniforge](https://github.com/conda-forge/miniforge)
31+
distribution.
3432

3533
We recommend installing CmdStan in a new conda environment:
3634

@@ -353,36 +351,39 @@ or cluster administrator to install these tools for you.
353351

354352
#### MacOS
355353

356-
To install a C++ development
357-
environment on a Mac, use Apple's Xcode development environment
358-
https://developer.apple.com/xcode/.
359-
360-
From the [Xcode home page](https://developer.apple.com/xcode/)
361-
`View in Mac App Store`.
362-
363-
- From the App Store, click `Install`, enter an Apple ID, and wait
364-
for Xcode to finish installing.
365-
- Open the Xcode application, click top-level menu `Preferences`,
366-
click top-row button `Downloads`, click button for
367-
`Components`, click on the `Install` button to the right of
368-
the `Command Line Tools` entry, then wait for it to finish
369-
installing.
370-
- Click the top-level menu item `Xcode`, then click item `Quit
371-
Xcode` to quit.
372-
373-
To test, open the Terminal application and enter:
354+
To check if you already already have an appropriate toolchain
355+
installed, open the Terminal application and enter:
374356
```
375357
clang++ --version
376358
make --version
377359
```
378360

379-
If you have installed XCode, but don't have `make`, you can install the
380-
XCode command-line tools via command:
361+
If either of these commands prints the message
362+
`command not found`, you will need to install Xcode's
363+
command line tools.
364+
365+
Open the Terminal application and enter:
366+
381367
```
382368
xcode-select --install
383369
```
384370

371+
Select "Install" in the window that opens.
372+
373+
After the installation completes, you can double check that
374+
installation was successful by reopening the Terminal and
375+
running:
376+
```
377+
clang++ --version
378+
make --version
379+
```
380+
381+
You can read more about Xcode on its site:
382+
[https://developer.apple.com/xcode/](https://developer.apple.com/xcode/)
385383

384+
We don't recommend trying to use the GNU C++ compiler, available via Homebrew,
385+
based on the number of reports of installation difficulties from Mac users on GitHub
386+
as well as the Stan forums.
386387

387388
#### Windows {#windows}
388389

src/functions-reference/functions_index.qmd

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions-reference/real-valued_basic_functions.qmd

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,11 +1630,27 @@ proportion theta, defined by \begin{eqnarray*}
16301630
\lambda_1, \ \log(1 - \theta) + \lambda_2\right). \end{eqnarray*}
16311631
{{< since 2.6 >}}
16321632

1633-
<!-- R; log_mix; (T1 theta, T2 lp1, T3 lp2); -->
1634-
\index{{\tt \bfseries log\_mix }!{\tt (T1 theta, T2 lp1, T3 lp2): real}|hyperpage}
1633+
<!-- R; log_mix; (T1 thetas, T2 lps); -->
1634+
\index{{\tt \bfseries log\_mix }!{\tt (T1 thetas, T2 lps): real}|hyperpage}
1635+
1636+
`R` **`log_mix`**`(T1 thetas, T2 lps)`<br>\newline
1637+
1638+
Calculates the log mixture density given `thetas`,
1639+
mixing proportions which should be between 0 and 1 and sum to 1,
1640+
and `lps`, log densities.
1641+
The `lps` variable must be either a 1-d container of the same
1642+
length as `thetas`, or an array of such.
1643+
1644+
\begin{eqnarray*}
1645+
\mathrm{log\_mix}(\theta, \lambda)
1646+
& = & \log \!\left( \sum_{n=1}^N \theta_n * \exp(\lambda_n) \right) \\[3pt]
1647+
& = & \mathrm{log\_sum\_exp}\!\left(\log(\theta) + \lambda\right).
1648+
\end{eqnarray*}
1649+
1650+
This is a generalization of the above signature of three arguments to
1651+
more than two densities.
1652+
For example, `log_mix(lambda, lp1, lp2) == log_mix({lambda, 1 - lambda}, {lp1, lp2})`.
16351653

1636-
`R` **`log_mix`**`(T1 theta, T2 lp1, T3 lp2)`<br>\newline
1637-
Vectorized implementation of the `log_mix` function
16381654
{{< since 2.26 >}}
16391655

16401656
<!-- R; log_sum_exp; (T1 x, T2 y); -->

src/functions-reference/unbounded_discrete_distributions.qmd

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,3 +586,36 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`.
586586
The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`
587587
dropping constant additive terms.
588588
{{< since 2.25 >}}
589+
590+
## Beta negative binomial distribution {#beta-neg-binomial}
591+
592+
### Probability mass function
593+
594+
If $r \in \mathbb{R}^+$, $\alpha \in \mathbb{R}^+$, and $\beta \in \mathbb{R}^+$, then for $n \in \mathbb{N}$, \begin{equation*}
595+
\text{BetaNegBinomial}(n|r,\alpha,\beta) = \frac {\Gamma (n+r )}{n!\;\Gamma (r )}
596+
\frac {\mathrm {B} (\beta+n,\alpha +r )}{\mathrm {B} (\beta,\alpha )}. \end{equation*}
597+
598+
### Distribution statement
599+
600+
`n ~ ` **`beta_neg_binomial`**`(r,alpha,beta)`
601+
602+
Increment target log probability density with `beta_neg_binomial_lupmf(n | r, alpha, beta)`.
603+
{{< since 2.36 >}}
604+
<!-- real; beta_neg_binomial ~; -->
605+
\index{{\tt \bfseries beta\_neg\_binomial }!sampling statement|hyperpage}
606+
607+
### Stan functions
608+
609+
<!-- real; beta_neg_binomial_lpmf; (ints n | reals r, reals alpha, reals beta); -->
610+
\index{{\tt \bfseries beta\_neg\_binomial\_lpmf }!{\tt (ints n \textbar\ reals r, reals alpha, reals beta): real}|hyperpage}
611+
612+
`real` **`beta_neg_binomial_lpmf`**`(ints n | reals r, reals alpha, reals beta)`<br>\newline
613+
The log beta negative binomial probability mass of `n` given parameters `r`, `alpha` and `beta`.
614+
{{< since 2.36 >}}
615+
616+
<!-- real; beta_neg_binomial_lupmf; (ints n | reals r, reals alpha, reals beta); -->
617+
\index{{\tt \bfseries beta\_neg\_binomial\_lupmf }!{\tt (ints n \textbar\ reals r, reals alpha, reals beta): real}|hyperpage}
618+
619+
`real` **`beta_neg_binomial_lupmf`**`(ints n | reals r, reals alpha, reals beta)`<br>\newline
620+
The log beta negative binomial probability mass of `n` given parameters `r`, `alpha` and `beta` dropping constant additive terms.
621+
{{< since 2.36 >}}

src/reference-manual/expressions.qmd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ any of the following.
149149

150150
```
151151
int, real, complex, vector, simplex, unit_vector,
152-
ordered, positive_ordered, row_vector, matrix,
153-
cholesky_factor_corr, cholesky_factor_cov,
154-
corr_matrix, cov_matrix, array
152+
sum_to_zero_vector, ordered, positive_ordered,
153+
row_vector, matrix, cholesky_factor_corr,
154+
cholesky_factor_cov, corr_matrix, cov_matrix, array
155155
```
156156

157157
The following built in functions are also reserved and
@@ -810,9 +810,9 @@ In addition to single integer indexes, as described in
810810
[the language indexing section](#language-indexing.section), Stan supports multiple indexing.
811811
Multiple indexes can be integer arrays of indexes, lower
812812
bounds, upper bounds, lower and upper bounds, or simply shorthand for
813-
all of the indexes. If the upper bound is smaller than the lower bound,
814-
the range is empty (unlike, e.g., in R). The upper bound and lower bound can be
815-
expressions that evaluate to integer. A complete list of index types is
813+
all of the indexes. If the upper bound is smaller than the lower bound,
814+
the range is empty (unlike, e.g., in R). The upper bound and lower bound can be
815+
expressions that evaluate to integer. A complete list of index types is
816816
given in the following table.
817817

818818
##### Indexing Options Table {- #index-types-table}
@@ -1078,6 +1078,7 @@ the following table shows the mapping from types to their primitive types.
10781078
| `vector` | `vector` |
10791079
| `simplex` | `vector` |
10801080
| `unit_vector` | `vector` |
1081+
| `sum_to_zero_vector` | `vector` |
10811082
| `ordered` | `vector` |
10821083
| `positive_ordered` | `vector` |
10831084
| `row_vector` | `row_vector` |
@@ -1378,7 +1379,7 @@ model {
13781379
}
13791380
```
13801381

1381-
Algebraically,
1382+
Algebraically,
13821383
[the distribution statement](statements.qmd#distribution-statements.section)
13831384
in the model could be reduced to
13841385

src/reference-manual/grammar.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
<identifier> ::= IDENTIFIER
2626
| TRUNCATE
27+
| JACOBIAN
2728

2829
<decl_identifier> ::= <identifier>
2930
| <reserved_word>
@@ -57,10 +58,13 @@
5758
| POSITIVEORDERED
5859
| SIMPLEX
5960
| UNITVECTOR
61+
| SUMTOZERO
6062
| CHOLESKYFACTORCORR
6163
| CHOLESKYFACTORCOV
6264
| CORRMATRIX
6365
| COVMATRIX
66+
| STOCHASTICCOLUMNMATRIX
67+
| STOCHASTICROWMATRIX
6468
| PRINT
6569
| REJECT
6670
| FATAL_ERROR
@@ -165,11 +169,16 @@
165169
| POSITIVEORDERED LBRACK <expression> RBRACK
166170
| SIMPLEX LBRACK <expression> RBRACK
167171
| UNITVECTOR LBRACK <expression> RBRACK
172+
| SUMTOZERO LBRACK <expression> RBRACK
168173
| CHOLESKYFACTORCORR LBRACK <expression> RBRACK
169174
| CHOLESKYFACTORCOV LBRACK <expression> [COMMA <expression>]
170175
RBRACK
171176
| CORRMATRIX LBRACK <expression> RBRACK
172177
| COVMATRIX LBRACK <expression> RBRACK
178+
| STOCHASTICCOLUMNMATRIX LBRACK <expression> COMMA
179+
<expression> RBRACK
180+
| STOCHASTICROWMATRIX LBRACK <expression> COMMA <expression>
181+
RBRACK
173182

174183
<type_constraint> ::= [LABRACK <range> RABRACK]
175184
| LABRACK <offset_mult> RABRACK

src/reference-manual/syntax.qmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ The raw output is available [here](https://raw.githubusercontent.com/stan-dev/do
113113
```
114114
<identifier> ::= IDENTIFIER
115115
| TRUNCATE
116+
| JACOBIAN
116117
117118
<decl_identifier> ::= <identifier>
118119
@@ -175,11 +176,16 @@ The raw output is available [here](https://raw.githubusercontent.com/stan-dev/do
175176
| POSITIVEORDERED LBRACK <expression> RBRACK
176177
| SIMPLEX LBRACK <expression> RBRACK
177178
| UNITVECTOR LBRACK <expression> RBRACK
179+
| SUMTOZERO LBRACK <expression> RBRACK
178180
| CHOLESKYFACTORCORR LBRACK <expression> RBRACK
179181
| CHOLESKYFACTORCOV LBRACK <expression> [COMMA <expression>]
180182
RBRACK
181183
| CORRMATRIX LBRACK <expression> RBRACK
182184
| COVMATRIX LBRACK <expression> RBRACK
185+
| STOCHASTICCOLUMNMATRIX LBRACK <expression> COMMA
186+
<expression> RBRACK
187+
| STOCHASTICROWMATRIX LBRACK <expression> COMMA <expression>
188+
RBRACK
183189
184190
<type_constraint> ::= [LABRACK <range> RABRACK]
185191
| LABRACK <offset_mult> RABRACK

0 commit comments

Comments
 (0)