Skip to content

Commit

Permalink
Capitalisation and eqn formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jan 12, 2024
1 parent 9f7e9a5 commit ba7cdc2
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/functions-reference/bounded_discrete_distributions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ logit-scaled chance of success alpha dropping constant additive terms
## Binomial-logit generalized linear model (Logistic Regression) {#binomial-logit-glm}

Stan also supplies a single function for a generalized linear model
with Binomial likelihood and logit link function, i.e. a function
with binomial likelihood and logit link function, i.e., a function
for logistic regression with aggregated outcomes. This provides a more efficient
implementation of logistic regression than a manually written
regression in terms of a Binomial likelihood and matrix
Expand All @@ -167,10 +167,11 @@ multiplication.
### Probability mass function

Suppose $N \in \mathbb{N}$, $x\in \mathbb{R}^{n\cdot m}, \alpha \in \mathbb{R}^n, \beta \in \mathbb{R}^m$, and $n \in
\{0,\ldots,N\}$. Then \begin{align*}
&\text{BinomialLogitGLM}(n~|~N, x, \alpha, \beta) = \text{Binomial}(n~|~N,\text{logit}^{-1}(\alpha_i + x_i\cdot
\beta)) \\ &= \binom{N}{n} \left( \text{logit}^{-1}(\alpha_i + \sum_{1\leq j\leq m}x_{ij}\cdot \beta_j) \right)^{n} \left( 1 -
\text{logit}^{-1}(\alpha_i + \sum_{1\leq j\leq m}x_{ij}\cdot \beta_j) \right)^{N - n}. \end{align*}
\{0,\ldots,N\}$. Then
\begin{align*}
&\text{BinomialLogitGLM}(n~|~N, x, \alpha, \beta) = \text{Binomial}(n~|~N,\text{logit}^{-1}(\alpha_i + x_i \cdot \beta)) \\
&= \binom{N}{n} \left( \text{logit}^{-1}(\alpha_i + \sum_{1\leq j\leq m}x_{ij}\cdot \beta_j) \right)^{n} \left( 1 - \text{logit}^{-1}(\alpha_i + \sum_{1\leq j\leq m}x_{ij}\cdot \beta_j) \right)^{N - n}.
\end{align*}

### Sampling statement

Expand All @@ -188,63 +189,63 @@ Increment target log probability density with `binomial_logit_glm_lupmf(n | N, x
\index{{\tt \bfseries binomial\_logit\_glm\_lpmf }!{\tt (int n \textbar\ int N, matrix x, real alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lpmf`**`(int n | int N, matrix x, real alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)`.
`r since("2.34")`

<!-- real; binomial_logit_glm_lupmf; (int n | int N, matrix x, real alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lupmf }!{\tt (int n \textbar\ int N, matrix x, real alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lupmf`**`(int n | int N, matrix x, real alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)` dropping constant additive terms.
`r since("2.34")`

<!-- real; binomial_logit_glm_lpmf; (int n | int N, matrix x, vector alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lpmf }!{\tt (int n \textbar\ int N, matrix x, vector alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lpmf`**`(int n | int N, matrix x, vector alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)`.
`r since("2.34")`

<!-- real; binomial_logit_glm_lupmf; (int n | int N, matrix x, vector alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lupmf }!{\tt (int n \textbar\ int N, matrix x, vector alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lupmf`**`(int n | int N, matrix x, vector alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)` dropping constant additive terms.
`r since("2.34")`

<!-- real; binomial_logit_glm_lpmf; (array[] int n | array[] int N, row_vector x, real alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lpmf }!{\tt (array[] int n \textbar\ array[] int N, row\_vector x, real alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lpmf`**`(array[] int n | array[] int N, row_vector x, real alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)`.
`r since("2.34")`

<!-- real; binomial_logit_glm_lupmf; (array[] int n | array[] int N, row_vector x, real alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lupmf }!{\tt (array[] int n \textbar\ array[] int N, row\_vector x, real alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lupmf`**`(array[] int n | array[] int N, row_vector x, real alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)` dropping constant additive terms.
`r since("2.34")`

<!-- real; binomial_logit_glm_lpmf; (array[] int n | array[] int N, row_vector x, vector alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lpmf }!{\tt (array[] int n \textbar\ array[] int N, row\_vector x, vector alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lpmf`**`(array[] int n | array[] int N, row_vector x, vector alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)`.
`r since("2.34")`

<!-- real; binomial_logit_glm_lupmf; (array[] int n | array[] int N, row_vector x, vector alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lupmf }!{\tt (array[] int n \textbar\ array[] int N, row\_vector x, vector alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lupmf`**`(array[] int n | array[] int N, row_vector x, vector alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)` dropping constant additive terms.
`r since("2.34")`

Expand All @@ -253,31 +254,31 @@ The log Binomial probability mass of n given N trials and chance of success
\index{{\tt \bfseries binomial\_logit\_glm\_lpmf }!{\tt (array[] int n \textbar\ array[] int N, matrix x, real alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lpmf`**`(array[] int n | array[] int N, matrix x, real alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)`.
`r since("2.34")`

<!-- real; binomial_logit_glm_lupmf; (array[] int n | array[] int N, matrix x, real alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lupmf }!{\tt (array[] int n \textbar\ array[] int N, matrix x, real alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lupmf`**`(array[] int n | array[] int N, matrix x, real alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)` dropping constant additive terms.
`r since("2.34")`

<!-- real; binomial_logit_glm_lpmf; (array[] int n | array[] int N, matrix x, vector alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lpmf }!{\tt (array[] int n \textbar\ array[] int N, matrix x, vector alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lpmf`**`(array[] int n | array[] int N, matrix x, vector alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)`.
`r since("2.34")`

<!-- real; binomial_logit_glm_lupmf; (array[] int n | array[] int N, matrix x, vector alpha, vector beta); -->
\index{{\tt \bfseries binomial\_logit\_glm\_lupmf }!{\tt (array[] int n \textbar\ array[] int N, matrix x, vector alpha, vector beta): real}|hyperpage}

`real` **`binomial_logit_glm_lupmf`**`(array[] int n | array[] int N, matrix x, vector alpha, vector beta)`<br>\newline
The log Binomial probability mass of n given N trials and chance of success
The log binomial probability mass of n given N trials and chance of success
`inv_logit(alpha + x * beta)` dropping constant additive terms.
`r since("2.34")`

Expand Down

0 comments on commit ba7cdc2

Please sign in to comment.