13.8 Ordered Logistic Generalized Linear Model (Ordinal Regression)
13.8.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.8.2 Sampling Statement
y ~
ordered_logistic_glm
(x, beta, c)
Increment target log probability density with ordered_logistic_lpmf(y | x, beta, c)
dropping constant additive terms.
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 size of the independent variable row vector x
needs to match the size of the coefficient vector beta
.
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 same value of the independent variable y
is used for all instances.
The number of columns of the independent variable row vector x
needs to match the size of the coefficient vector beta
.
The cutpoints c
must be ordered. If x
and y
are data (not parameters) this function can be executed on a GPU.
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 same row vector of the independent variables x
is used for all instances.
The size of the independent variable row vector x
needs to match the size of the coefficient vector beta
.
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 number of rows of the independent variable matrix x
needs to match the size of the dependent variable vector y
.
The number of columns of the independent variable row vector x
needs to match the size of the coefficient vector beta
.
The cutpoints c
must be ordered. If x
and y
are data (not parameters) this function can be executed on a GPU.