Skip to content

Commit

Permalink
Merge pull request #821 from lingium/add-beta-neg-binomial-lpmf
Browse files Browse the repository at this point in the history
add beta_neg_binomail_lpmf
  • Loading branch information
WardBrian authored Oct 7, 2024
2 parents cfa1989 + bf7aad2 commit e02baa9
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/functions-reference/unbounded_discrete_distributions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -586,3 +586,36 @@ The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`.
The log Poisson probability mass of `y` given the log-rate `alpha + x * beta`
dropping constant additive terms.
{{< since 2.25 >}}

## Beta negative binomial distribution {#beta-neg-binomial}

### Probability mass function

If $r \in \mathbb{R}^+$, $\alpha \in \mathbb{R}^+$, and $\beta \in \mathbb{R}^+$, then for $n \in \mathbb{N}$, \begin{equation*}
\text{BetaNegBinomial}(n|r,\alpha,\beta) = \frac {\Gamma (n+r )}{n!\;\Gamma (r )}
\frac {\mathrm {B} (\beta+n,\alpha +r )}{\mathrm {B} (\beta,\alpha )}. \end{equation*}

### Distribution statement

`n ~ ` **`beta_neg_binomial`**`(r,alpha,beta)`

Increment target log probability density with `beta_neg_binomial_lupmf(n | r, alpha, beta)`.
{{< since 2.36 >}}
<!-- real; beta_neg_binomial ~; -->
\index{{\tt \bfseries beta\_neg\_binomial }!sampling statement|hyperpage}

### Stan functions

<!-- real; beta_neg_binomial_lpmf; (ints n | reals r, reals alpha, reals beta); -->
\index{{\tt \bfseries beta\_neg\_binomial\_lpmf }!{\tt (ints n \textbar\ reals r, reals alpha, reals beta): real}|hyperpage}

`real` **`beta_neg_binomial_lpmf`**`(ints n | reals r, reals alpha, reals beta)`<br>\newline
The log beta negative binomial probability mass of `n` given parameters `r`, `alpha` and `beta`.
{{< since 2.36 >}}

<!-- real; beta_neg_binomial_lupmf; (ints n | reals r, reals alpha, reals beta); -->
\index{{\tt \bfseries beta\_neg\_binomial\_lupmf }!{\tt (ints n \textbar\ reals r, reals alpha, reals beta): real}|hyperpage}

`real` **`beta_neg_binomial_lupmf`**`(ints n | reals r, reals alpha, reals beta)`<br>\newline
The log beta negative binomial probability mass of `n` given parameters `r`, `alpha` and `beta` dropping constant additive terms.
{{< since 2.36 >}}

0 comments on commit e02baa9

Please sign in to comment.