Just wanted to share a small trick for modelling cutpoints in ordinal models. I’ve seen the suggestion before that we can model cutpoints as transformed from simplex (theta), a scale (kappa) and a location (mu):
data{
int N;
int response[N];
vector[N] x;
parameters{
simplex[5] theta;
real<lower=0> kappa;
real mu;
real beta;
}
transformed parameters{
ordered[5] cutoffs;
cutoffs=cumulative_sum(theta)*kappa+mu;
}
model{
theta~dirichlet(rep_vector(1, 5));
kappa~exponential(.1);
for (n in 1:N){
response[n]~ordered_logistic(x[n]*beta , cutoffs );
}
…but this has the annoying feature that the prior center for the cutoffs is a hodgepodge function of theta, kappa and mu. So how about removing the median from the cum-sum, such that the parameter mu is the center of the cutpoint vector?:
functions{
real median(vector ordered_vector){
int midpoint;
midpoint = rows(ordered_vector)/2;
if(2*midpoint<rows(ordered_vector)){
return ordered_vector[midpoint+1];
}
else{
return (ordered_vector[midpoint]+ordered_vector[midpoint+1])/2;
}
}
vector cumsum_de_median(vector par_vector){
return cumulative_sum(par_vector)-median(cumulative_sum(par_vector));
}
}
data{
int N;
int response[N];
vector[N] x;
parameters{
simplex[5] theta;
real<lower=0> kappa;
real mu;
real beta;
}
transformed parameters{
ordered[5] cutoffs;
cutoffs=cumsum_de_median(theta)*kappa+mu;
}
model{
theta~dirichlet(rep_vector(1, 5));
kappa~exponential(.1);
for (n in 1:N){
response[n]~ordered_logistic(x[n]*beta , cutoffs );
}
The interpretation of the parameters makes more sense here (to me, anyways…):
mu is the center of the cutpoint vector
theta is the normalized distance between cutpoints
hm - so the linear predictor can take any real value, and cutpoints should be an ordered vector spread on the real line.
First, theta is a (0,1) simplex vector. Kappa is positive. So cumsum(theta)*kappa creates values spread over positive values. Adding mu then give an ordered cutpoint vector spread over the real line.
My point in this post was just to center the cumsum-part, such that mu controls the center of the cutpoints.
Well, the simplex elements can be interpreted as probabilities of falling in that category (for observations with average X values) if you put them through the inverse CDF of the CDF that you use for the linear predictor. That is what we do in stan_polr in rstanarm.
Interesting - never tried rstanarm. Looks like stan_polr handles a binary outcome only?
Model above is an extension of the ordinal logistic model from section 9.8 in the Stan manual, with an ordinal dependent variable with >2 levels (in model above six ordered possible responses). But by changing priors as above you can use similar prior for the mean of the cutpoint for an outcome variable with just two levels.
sorry for resurrecting an old thread, but I was wondering if there is a better solution to this problem?
In my current work, I am simply using a normal(0, 1) prior which seems to work well enough, but I’m not sure how to carry out a prior predictive check using this specificaiton?
The latest version of the Stan manual simply says: “If the cutpoints were assigned independent priors, the constraint effectively truncates the joint prior to support over points that satisfy the ordering constraint.”
You can derive the cutpoints from baseline probabilities or model them directly with an induced-Dirichlet prior model. See my reply here with example code of the former including a prior predictive check.
See Ordinal Modeling for an excellent look at ordinal models with explanation, examples, and Stan code examples that include both deriving the cutpoints from baseline probabilities with Dirichlet prior over the probabilities or modeling cutpoints directly with induced-Dirichlet prior model.