In my study I will be measuring workload with several metrics. With heart-rate variability (HRV), electrodermal activity (EDA) and with a subjective scale (IWS). After normalization the IWS has three values:

  1. Workload lower than normal
  2. Workload is average
  3. Workload is higher than normal.

I want to see how well the physiological measures can predict subjective workload.

Therefore I want to use ratio data to predict ordinal values. According to: How do I run Ordinal Logistic Regression analysis in R with both numerical / categorical values? this is easily done by using the MASS:polr function.

However, I also want to account for random effects such as between-subject differences, gender, smoking etc. Looking at this tutorial, I don't see how I can add random effects to MASS:polr. Alternatively lme4:glmer would then be an option, but this function only allows the prediction of binary data.

Is it possible to add random effects to an ordinal logistic regression?

  • $\begingroup$ You are not obliged to use proportional odds for this sort of outcome, you can use continuation ratio models and others. You could investigate the ordinal package available from CRAN. $\endgroup$
    – mdewey
    Oct 5, 2016 at 12:54
  • 1
    $\begingroup$ @RobinKramer Please clarify what you think you mean by random effects. When statisticians say random effects, they usually want to account for clustering among different observations. For example, say you had repeated measures on the same individuals, so each obs is one person at a certain time, and you had 4 observations per person. You arguably should fit a random effects model; each person has a person-specific random effect (usually assumed to be from a normal distribution). When you say gender, smoking, etc, those can usually be modeled as fixed effects. So, what do you mean? $\endgroup$
    – Weiwen Ng
    May 9, 2017 at 15:24
  • 1
    $\begingroup$ @WeiwenNg the question is rather old, but I was used to use LME regressions in which I placed variables, in which I was not interested (but did have an effect on the DV), as random effects. I attempted to do the same with this project. $\endgroup$ May 9, 2017 at 15:55
  • $\begingroup$ @RobinKramer My bad, I failed to note the date! That said, I still think there is some confusion here. Do you have repeated measures on the individuals? If so, then you should probably include a random intercept by person. If you're interested in the effect of gender on the DV, then you would probably only need to model it as a normal covariate. Some would say model it as a fixed effect (because you're treating its effect on the DV as fixed). Treating gender as a random effect would really be ontologically confusing. $\endgroup$
    – Weiwen Ng
    May 9, 2017 at 16:26

2 Answers 2


In principle you can make the machinery of any logistic mixed model software perform ordinal logistic regression by expanding the ordinal response variable into a series of binary contrasts between successive levels (e.g. see Dobson and Barnett Introduction to Generalized Linear Models section 8.4.6). However, this is a pain, and luckily there are a few options in R:

  • the ordinal package, via the clmm and clmm2 functions (clmm = Cumulative Link Mixed Model)
  • the mixor package, via the mixor function (Note that as of 31/7/21 this has been removed from CRAN)
  • the MCMCglmm package, via family="ordinal" (see ?MCMCglmm)
  • the brms package, e.g. via family="cumulative" (see ?brmsfamily)

The latter two options are implemented within Bayesian MCMC frameworks. As far as I know, all of the functions quoted (with the exception of ordinal::clmm2) can handle multiple random effects (intercepts, slopes, etc.); most of them (maybe not MCMCglmm?) can handle choices of link function (logit, probit, etc.).

(If I have time I will come back and revise this answer with a worked example of setting up ordinal models from scratch using lme4)

  • $\begingroup$ Thank you for your answer. As a matter of fact, I've seen someone using a series of binary contrasts indeed, but with a "general estimating equation". How does that relate to the methods you mentioned? Moreover, when making several comparisons, don't you need to correct for the multiple comparison problem? $\endgroup$ Oct 6, 2016 at 6:07
  • 1
    $\begingroup$ Another way to estimate a mixed effects model with ordinal response in R is via the mixor function of the mixor package. This function allows for random slopes and intercepts and provides some choice over the link function (you are not restricted to ordered logistic regression but can also use the probit, log-log, and complementary log-log link functions). $\endgroup$
    – user206892
    Jul 30, 2019 at 20:36
  • 4
    $\begingroup$ Want to come back and add a worked example? $\endgroup$
    – Ben
    Oct 28, 2019 at 0:11
  • 1
    $\begingroup$ it's probably harder than I want it to be ... $\endgroup$
    – Ben Bolker
    Oct 28, 2019 at 1:13
  • $\begingroup$ I've had some convergence problems with mixor. Bayesian random effects ordinal models tend to behave better in my limited experience. $\endgroup$ Jul 15, 2023 at 11:32

Yes, it is possible to include random effects in an ordinal regression model. Conceptually, this is the same as including random effects in a linear mixed model. Although the UCLA site only demonstrates the polr() function in the MASS package, there are a number of facilities for fitting ordinal models in R. There is a broader (but less detailed) overview here. The only way I know of to include random effects in R uses the ordinal package, though. I work through an example here: Is there a two-way Friedman's test?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.