13.9 Ordered logistic generalized linear model (ordinal regression)
13.9.1 Probability mass function
If N,M,K∈N with N,M>0, K>2, c∈RK−1 such that ck<ck+1 for k∈{1,…,K−2}, and x∈RN⋅M,β∈RM, then for y∈{1,…,K}N, OrderedLogisticGLM(y | x,β,c)=∏1≤i≤NOrderedLogistic(yi | xi⋅β,c)=∏1≤i≤N{1−logit−1(xi⋅β−c1)if y=1,logit−1(xi⋅β−cy−1)−logit−1(xi⋅β−cy)if 1<y<K,andlogit−1(xi⋅β−cK−1)−0if y=K. 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 c0=−∞ and cK=+∞ with logit−1(−∞)=0 and logit−1(∞)=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.