13.8 Ordered Logistic Generalized Linear Model (Ordinal Regression)
13.8.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.8.2 Sampling Statement
y ~
ordered_logistic_glm
(x, beta, c)
Increment target log probability density with ordered_logistic_lupmf(y | x, beta, c)
.
13.8.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.