Ordered logistic model
Description
The ordinal model is a model of ordered discrete data.
Definition
For discrete ordered outcome \(y\) and predictors \(x\), the model is:
\[ \begin{align} y_i \sim \text{orderedLogistic}(\eta_i, c) \\ \eta_i = \alpha + \beta \cdot x_i \end{align} \]
Parameters needing priors
- \(\alpha\) (intercept)
- \(\beta\) (predictor weights)
- \(c\) (cutpoints)
Prior for \(\alpha\)
Prior for \(\beta\)
Prior for \(c\)
Induced Dirichlet prior
Betancourt (2019) suggests using an induced Dirichlet prior on the cutpoint \(c\).
Stan code:
// Copyright 2019 Michael Betancourt (BSD-3)
functions {
real induced_dirichlet_lpdf(vector c, vector alpha, real phi) {
int K = num_elements(c) + 1;
vector[K - 1] sigma = inv_logit(phi - c);
vector[K] p;
matrix[K, K] J = rep_matrix(0, K, K);
// Induced ordinal probabilities
1] = 1 - sigma[1];
p[for (k in 2:(K - 1))
1] - sigma[k];
p[k] = sigma[k - 1];
p[K] = sigma[K -
// Baseline column of Jacobian
for (k in 1:K) J[k, 1] = 1;
// Diagonal entries of Jacobian
for (k in 2:K) {
real rho = sigma[k - 1] * (1 - sigma[k - 1]);
J[k, k] = - rho;1, k] = rho;
J[k -
}
return dirichlet_lpdf(p | alpha)
+ log_determinant(J);
} }
See also
References
Betancourt, Michael. 2019. “Ordinal Regression.” https://betanalpha.github.io/assets/case_studies/ordinal_regression.html.