This is an old version, view current version.

13.8 Ordered Logistic Generalized Linear Model (Ordinal Regression)

13.8.1 Probability Mass Function

If N,M,KN with N,M>0, K>2, cRK1 such that ck<ck+1 for k{1,,K2}, and xRNM,βRM, then for y{1,,K}N, OrderedLogisticGLM(y | x,β,c)=1iNOrderedLogistic(yi | xiβ,c)=1iN{1logit1(xiβc1)if y=1,logit1(xiβcy1)logit1(xiβcy)if 1<y<K,andlogit1(xiβcK1)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 logit1()=0 and logit1()=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.