13.9 Ordered logistic generalized linear model (ordinal regression)
13.9.1 Probability mass function
If \(N,M,K \in \mathbb{N}\) with \(N, M > 0\), \(K > 2\), \(c \in \mathbb{R}^{K-1}\) such that \(c_k < c_{k+1}\) for \(k \in \{1,\ldots,K-2\}\), and \(x\in \mathbb{R}^{N\cdot M}, \beta\in \mathbb{R}^M\), then for \(y \in \{1,\ldots,K\}^N\), \[\text{OrderedLogisticGLM}(y~|~x,\beta,c) = \\[4pt] \prod_{1\leq i \leq N}\text{OrderedLogistic}(y_i~|~x_i\cdot \beta,c) = \\[17pt] \prod_{1\leq i \leq N}\left\{ \begin{array}{ll} 1 - \text{logit}^{-1}(x_i\cdot \beta - c_1) & \text{if } y = 1, \\[4pt] \text{logit}^{-1}(x_i\cdot \beta - c_{y-1}) - \text{logit}^{-1}(x_i\cdot \beta - c_{y}) & \text{if } 1 < y < K, \text{and} \\[4pt] \text{logit}^{-1}(x_i\cdot \beta - c_{K-1}) - 0 & \text{if } y = K. \end{array} \right. \] The \(k=K\) case is written with the redundant subtraction of zero to illustrate the parallelism of the cases; the \(y=1\) and \(y=K\) edge cases can be subsumed into the general definition by setting \(c_0 = -\infty\) and \(c_K = +\infty\) with \(\text{logit}^{-1}(-\infty) = 0\) and \(\text{logit}^{-1}(\infty) = 1\).
13.9.2 Sampling statement
y ~
ordered_logistic_glm
(x, beta, c)
Increment target log probability density with ordered_logistic_lupmf(y | x, beta, c)
.
13.9.3 Stan functions
real
ordered_logistic_glm_lpmf
(int y | row_vector x, vector beta, vector c)
The log ordered logistic probability mass of y, given linear predictors x * beta
, and cutpoints c.
The cutpoints c
must be ordered.
real
ordered_logistic_glm_lupmf
(int y | row_vector x, vector beta, vector c)
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.
real
ordered_logistic_glm_lpmf
(int y | matrix x, vector beta, vector c)
The log ordered logistic probability mass of y, given linear predictors x * beta
, and cutpoints c.
The cutpoints c
must be ordered.
real
ordered_logistic_glm_lupmf
(int y | matrix x, vector beta, vector c)
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.
real
ordered_logistic_glm_lpmf
(int[] y | row_vector x, vector beta, vector c)
The log ordered logistic probability mass of y, given linear predictors x * beta
, and cutpoints c.
The cutpoints c
must be ordered.
real
ordered_logistic_glm_lupmf
(int[] y | row_vector x, vector beta, vector c)
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.
real
ordered_logistic_glm_lpmf
(int[] y | matrix x, vector beta, vector c)
The log ordered logistic probability mass of y, given linear predictors
x * beta
, and cutpoints c. The cutpoints c
must be ordered.
real
ordered_logistic_glm_lupmf
(int[] y | matrix x, vector beta, vector c)
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.