@@ -10,9 +10,9 @@ cat(' * <a href="binomial-distribution-logit-parameterization.html">Binomial Dis
1010cat(' * <a href="beta-binomial-distribution.html">Beta-Binomial Distribution</a>\n')
1111cat(' * <a href="hypergeometric-distribution.html">Hypergeometric Distribution</a>\n')
1212cat(' * <a href="categorical-distribution.html">Categorical Distribution</a>\n')
13- cat(' * <a href="categorical-logit-glm.html">Categorical Logit Generalised Linear Model (Softmax Regression)</a>\n')
13+ cat(' * <a href="categorical-logit-glm.html">Categorical Logit generalized Linear Model (Softmax Regression)</a>\n')
1414cat(' * <a href="ordered-logistic-distribution.html">Ordered Logistic Distribution</a>\n')
15- cat(' * <a href="ordered-logistic-glm.html">Ordered Logistic Generalised Linear Model (Ordinal Regression)</a>\n')
15+ cat(' * <a href="ordered-logistic-glm.html">Ordered Logistic generalized Linear Model (Ordinal Regression)</a>\n')
1616cat(' * <a href="ordered-probit-distribution.html">Ordered Probit Distribution</a>\n')
1717}
1818```
@@ -240,8 +240,8 @@ an $N$-simplex (i.e., has nonnegative entries summing to one), then
240240for $y \in \{ 1,\ldots,N\} $, \[ \text{Categorical}(y~ |~ \theta) =
241241\theta_y. \] In addition, Stan provides a log-odds scaled categorical
242242distribution, \[ \text{CategoricalLogit}(y~ |~ \beta) =
243- \text{Categorical}(y~ |~ \text{softmax}(\beta)). \] See section
244- [ softmax] ( #softmax ) for the definition of the softmax function.
243+ \text{Categorical}(y~ |~ \text{softmax}(\beta)). \]
244+ See [ the definition of softmax] ( #softmax ) for the definition of the softmax function.
245245
246246### Sampling Statement
247247
@@ -298,24 +298,24 @@ Generate a categorical variate with outcome in range $1:N$ from
298298log-odds vector beta; may only be used in transformed data and generated
299299quantities blocks
300300
301- ## Categorical Logit Generalised Linear Model (Softmax Regression) {#categorical-logit-glm}
301+ ## Categorical Logit Generalized Linear Model (Softmax Regression) {#categorical-logit-glm}
302302
303- Stan also supplies a single primitive for a Generalised Linear Model
304- with Categorical likelihood and logit link function, i.e. a primitive
305- for a softmax regression. This should provide a more efficient
303+ Stan also supplies a single function for a generalized linear model
304+ with categorical likelihood and logit link function, i.e. a function
305+ for a softmax regression. This provides a more efficient
306306implementation of softmax regression than a manually written
307307regression in terms of a Categorical likelihood and matrix
308308multiplication.
309309
310- Note that the implementation does not put any restrictions on the coefficient matrix $\beta$. It is up to the user to use a reference category, a suitable prior or some other means of avoiding non- identifiability. See Multi-logit in the [ Stan User's Guide] ( https://mc-stan.org/docs/2_21/stan- users-guide/multi-logit-section.html ) .
310+ Note that the implementation does not put any restrictions on the coefficient matrix $\beta$. It is up to the user to use a reference category, a suitable prior or some other means of identifiability. See Multi-logit in the [ Stan User's Guide] ( https://mc-stan.org/users/documentation/ ) .
311311
312312### Probability Mass Functions
313313
314314If $N,M,K \in \mathbb{N}$, $N,M,K > 0$, and if $x\in \mathbb{R}^{M\cdot K}, \alpha \in \mathbb{R}^N, \beta\in \mathbb{R}^{K\cdot N}$, then for $y \in \{ 1,\ldots,N\} ^M$,
315315\[ \text{CategoricalLogitGLM}(y~ |~ x,\alpha,\beta) = \\ [ 5pt]
316316\prod_ {1\leq i \leq M}\text{CategoricalLogit}(y_i~ |~ \alpha+x_i\cdot\beta) = \\ [ 15pt]
317317\prod_ {1\leq i \leq M}\text{Categorical}(y_i~ |~ softmax(\alpha+x_i\cdot\beta)). \]
318- See section [ softmax] ( #softmax ) for the definition of the softmax function.
318+ See [ the definition of softmax] ( #softmax ) for the definition of the softmax function.
319319
320320### Sampling Statement
321321
@@ -335,44 +335,44 @@ dropping constant additive terms.
335335` real ` ** ` categorical_logit_glm_lpmf ` ** ` (int y | row_vector x, vector alpha, matrix beta) ` <br >\newline
336336The log categorical probability mass function with outcome ` y ` in
337337$1: N $ given $N$-vector of log-odds of outcomes ` alpha + x * beta ` .
338- The size of independent variable row vector ` x ` needs to match the number of rows of the
339- weight matrix ` beta ` . The size of intercept vector ` alpha ` must match number
340- of columns of the weight matrix ` beta ` .
338+ The size of the independent variable row vector ` x ` needs to match the number of rows of the
339+ coefficient matrix ` beta ` . The size of the intercept vector ` alpha ` must match the number
340+ of columns of the coefficient matrix ` beta ` .
341341
342342<!-- real; categorical_logit_glm_lpmf; (int y | matrix x, vector alpha, matrix beta); -->
343343\index{{\tt \bfseries categorical\_ logit\_ glm\_ lpmf }!{\tt (int y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage}
344344
345345` real ` ** ` categorical_logit_glm_lpmf ` ** ` (int y | matrix x, vector alpha, matrix beta) ` <br >\newline
346346The log categorical probability mass function with outcomes ` y ` in
347347$1: N $ given $N$-vector of log-odds of outcomes ` alpha + x * beta ` .
348- Same vector of intercepts ` alpha ` and same dependant variable value ` y ` are used for all instances.
349- The number of columns of independent variable ` x ` needs to match the number of rows of the
350- weight matrix ` beta ` . The size of intercept vector ` alpha ` must match number
351- of columns of the weight matrix ` beta ` . If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
348+ The same vector of intercepts ` alpha ` and the same dependent variable value ` y ` are used for all instances.
349+ The number of columns of the independent variable ` x ` needs to match the number of rows of the
350+ coefficient matrix ` beta ` . The size of the intercept vector ` alpha ` must match the number
351+ of columns of the coefficient matrix ` beta ` . If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
352352
353353<!-- real; categorical_logit_glm_lpmf; (int[] y | vector theta); -->
354354\index{{\tt \bfseries categorical\_ logit\_ glm\_ lpmf }!{\tt (int[ ] y \textbar\ row\_ vector x, vector alpha, matrix beta): real}|hyperpage}
355355
356356` real ` ** ` categorical_logit_glm_lpmf ` ** ` (int[] y | row_vector x, vector alpha, matrix beta) ` <br >\newline
357357The log categorical probability mass function with outcomes ` y ` in
358358$1: N $ given $N$-vector of log-odds of outcomes ` alpha + x * beta ` .
359- Same vector of intercepts ` alpha ` and same row vector of independent variables ` x ` are used for all instances.
360- The size of independent variable matrix ` x ` needs to match the number of rows of the
361- weight vector ` beta ` . The size of intercept vector ` alpha ` must match number
362- of columns of the weight vector ` beta ` .
359+ The same vector of intercepts ` alpha ` and same row vector of the independent variables ` x ` are used for all instances.
360+ The size of the independent variable matrix ` x ` needs to match the number of rows of the
361+ coefficient vector ` beta ` . The size of the intercept vector ` alpha ` must match the number
362+ of columns of the coefficient vector ` beta ` .
363363
364364<!-- real; categorical_logit_glm_lpmf; (int[] y | vector theta); -->
365365\index{{\tt \bfseries categorical\_ logit\_ glm\_ lpmf }!{\tt (int[ ] y \textbar\ matrix x, vector alpha, matrix beta): real}|hyperpage}
366366
367367` real ` ** ` categorical_logit_glm_lpmf ` ** ` (int[] y | matrix x, vector alpha, matrix beta) ` <br >\newline
368368The log categorical probability mass function with outcomes ` y ` in
369369$1: N $ given $N$-vector of log-odds of outcomes ` alpha + x * beta ` .
370- Same vector of intercepts ` alpha ` is used for all instances.
370+ The same vector of intercepts ` alpha ` is used for all instances.
371371The number of rows of the independent variable
372- matrix ` x ` needs to match the length of the dependent variable vector
372+ matrix ` x ` needs to match the size of the dependent variable vector
373373` y ` . The number of columns of independnt variable ` x ` needs to match the number of rows of the
374- weight matrix ` beta ` . The size of intercept vector ` alpha ` must match number
375- of columns of the weight matrix ` beta ` . If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
374+ coefficient matrix ` beta ` . The size of the intercept vector ` alpha ` must match the number
375+ of columns of the coefficient matrix ` beta ` . If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
376376
377377
378378## Ordered Logistic Distribution
@@ -409,16 +409,16 @@ dropping constant additive terms.
409409
410410` real ` ** ` ordered_logistic_lpmf ` ** ` (ints k | vector eta, vectors c) ` <br >\newline
411411The log ordered logistic probability mass of k given linear predictors
412- eta, and cutpoints c .
412+ ` eta ` , and cutpoints ` c ` .
413413
414414<!-- int; ordered_logistic_rng; (real eta, vector c); -->
415415\index{{\tt \bfseries ordered\_ logistic\_ rng }!{\tt (real eta, vector c): int}|hyperpage}
416416
417417` int ` ** ` ordered_logistic_rng ` ** ` (real eta, vector c) ` <br >\newline
418- Generate an ordered logistic variate with linear predictor eta and
419- cutpoints c ; may only be used in transformed data and generated quantities blocks
418+ Generate an ordered logistic variate with linear predictor ` eta ` and
419+ cutpoints ` c ` ; may only be used in transformed data and generated quantities blocks
420420
421- ## Ordered Logistic Generalised Linear Model (Ordinal Regression)
421+ ## Ordered Logistic Generalized Linear Model (Ordinal Regression)
422422
423423### Probability Mass Function
424424
@@ -453,36 +453,36 @@ dropping constant additive terms.
453453
454454` real ` ** ` ordered_logistic_glm_lpmf ` ** ` (int y | row_vector x, vector beta, vector c) ` <br >\newline
455455The log ordered logistic probability mass of y, given linear predictors ` x * beta ` , and cutpoints c.
456- The size of independent variable row vector ` x ` needs to match the size of the weight vector ` beta ` .
457- Cutpoints ` c ` must be ordered.
456+ The size of the independent variable row vector ` x ` needs to match the size of the coefficient vector ` beta ` .
457+ The cutpoints ` c ` must be ordered.
458458
459459<!-- real; ordered_logistic_glm_lpmf; (int y | matrix x, vector beta, vector c); -->
460460\index{{\tt \bfseries ordered\_ logistic\_ glm\_ lpmf }!{\tt (int y \textbar\ matrix x, vector beta, vector c): real}|hyperpage}
461461
462462` real ` ** ` ordered_logistic_glm_lpmf ` ** ` (int y | matrix x, vector beta, vector c) ` <br >\newline
463463The log ordered logistic probability mass of y, given linear predictors ` x * beta ` , and cutpoints c.
464- Same value of independent variable ` y ` is used for all instances.
465- The number of columns of independent variable row vector ` x ` needs to match the size of the weight vector ` beta ` .
466- Cutpoints ` c ` must be ordered. If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
464+ The same value of the independent variable ` y ` is used for all instances.
465+ The number of columns of the independent variable row vector ` x ` needs to match the size of the coefficient vector ` beta ` .
466+ The cutpoints ` c ` must be ordered. If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
467467
468468<!-- real; ordered_logistic_glm_lpmf; (int[] y | row_vector x, vector beta, vector c); -->
469469\index{{\tt \bfseries ordered\_ logistic\_ glm\_ lpmf }!{\tt (int[ ] y \textbar\ row\_ vector x, vector beta, vector c): real}|hyperpage}
470470
471471` real ` ** ` ordered_logistic_glm_lpmf ` ** ` (int[] y | row_vector x, vector beta, vector c) ` <br >\newline
472472The log ordered logistic probability mass of y, given linear predictors ` x * beta ` , and cutpoints c.
473- Same row vector of independent variables ` x ` is used for all instances.
474- The size of independent variable row vector ` x ` needs to match the size of the weight vector ` beta ` .
475- Cutpoints ` c ` must be ordered.
473+ The same row vector of the independent variables ` x ` is used for all instances.
474+ The size of the independent variable row vector ` x ` needs to match the size of the coefficient vector ` beta ` .
475+ The cutpoints ` c ` must be ordered.
476476
477477<!-- real; ordered_logistic_glm_lpmf; (int[] y | matrix x, vector beta, vector c); -->
478478\index{{\tt \bfseries ordered\_ logistic\_ glm\_ lpmf }!{\tt (int[ ] y \textbar\ matrix x, vector beta, vector c): real}|hyperpage}
479479
480480` real ` ** ` ordered_logistic_glm_lpmf ` ** ` (int[] y | matrix x, vector beta, vector c) ` <br >\newline
481481The log ordered logistic probability mass of y, given linear predictors
482482` x * beta ` , and cutpoints c.
483- The number of rows of the independent variable matrix ` x ` needs to match the length of the dependent variable vector ` y ` .
484- The number of columns of independent variable row vector ` x ` needs to match the size of the weight vector ` beta ` .
485- Cutpoints ` c ` must be ordered. If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
483+ The number of rows of the independent variable matrix ` x ` needs to match the size of the dependent variable vector ` y ` .
484+ The number of columns of the independent variable row vector ` x ` needs to match the size of the coefficient vector ` beta ` .
485+ The cutpoints ` c ` must be ordered. If ` x ` and ` y ` are data (not parameters) this function can be executed on a GPU.
486486
487487
488488## Ordered Probit Distribution
0 commit comments