 # Ordered logistic and probit regression

#1

I’m trying to implement an ordered probit regression, but I frequently get an error that reads:

``````Chain 1: Rejecting initial value:
Chain 1:   Log probability evaluates to log(0), i.e. negative infinity.
Chain 1:   Stan can't start sampling from this initial value.
``````

Sometimes it works, and sometimes not.

With the logistic version, however, I run into no such problems at all. I wonder if there’s a better way to implement the probit version so I don’t run into these problems. The probit and logistic implementations are below:

``````  // Probit
pi = Phi((kappa - y_star)/tau_j[j[m]]);
for(c in 2:(n_categories - 1))
pi[c] = Phi((kappa[c] - y_star)/tau_j[j[m]]) - Phi((kappa[c - 1] - y_star)/tau_j[j[m]]);
pi[n_categories] = 1 - sum(pi[1:(n_categories-1)]);

y[m] ~ categorical(pi);

// Logistic
y[m] ~ ordered_logistic(y_star / tau_j[j[m]], kappa / tau_j[j[m]]);``````

#2

Just going to reply to my own thread here for anyone else who runs into this problem. Setting the argument `init_r` to a lower value helps this a lot (`init_r` sets the range of random values to select initializations from, which defaults to -2 to +2). I still get a few “Rejecting initial value” warnings, but it never fails more than 100 times such that the sampler doesn’t run get to run at all. With simulated data, all the parameters are retrieved as expected.

#3

The ordered probit distribution can be a bit difficult, because the log-probability requires calculating `log(Phi(x))`, and the `Phi()` function will underflow to 0 at values lower than -37.5. This means that can be very easy to end up with `log(0)` if you’re not careful.

As an fyi, Stan also has a built-in `ordered_probit` function now as well, so you can just write:

``````y[m] ~ ordered_probit(y_star / tau_j[j[m]], kappa / tau_j[j[m]]);
``````