Skip to content

Fitting a mulitlevel ordered categorical regression

Tom Clark writes:

I am trying to fit a multilevel ordered categorical regression. I have been looking at the example in chapter 15 of your book (Data Analysis Using….). On page 331, you note that you fit a multilevel model of the storable votes data. On your website, I cannot find the code to replicate that model (the data are there, but I did not see the code).

I am somewhat familiar with bayespolr, but am not sure if/how I can use it to estimate a model if modeled intercepts and slopes. Did you instead program the model in BUGS? Is there a canned function for R? To give you a sense of what I am looking for, I have a series of individual-level responses to a survey question. I want to explain the responses modeled intercepts for state and year. I have group-level predictors for state and year, which are my primary predictors of interest.

My reply:

I fit the model a long time ago and the code is so messy I didn’t put it in the book. There were lots of different little data sets in that example and I kept having to screw with the code. I fit the models in Bugs (called from R). Modifying bayespolr to do this would be possible but not trivial; it would require iteration to estimate the group-level variance parameters. So I guess my advice to you is to do it in Bugs. Bugs is great for complicated models on small datasets. Attached is some bugs code to get you started. The other thing you could try if you have multilevel ordered outcomes is to just model them as continuous. I bet that would work just fine, and then you could check things using some binary splits. And then you could use glmer.


  1. Manolo says:

    Could us, the readers, also get the "bugs code to get us started".

  2. Ed says:

    I've not tried it myself, but I've heard that the MCMCglmm package in R would handle ordinal response variables.

  3. Grince-Mince says:

    aML (available for free at can handle multilevel ordinal logit and probit models. As its name suggests, it uses maximum likelihood.