I ran an ordinal regression in R with the polr function from the MASS package as described in this tutorial, which is very good. However, the tutorial does not include interaction effects. Here another tutorial I found useful for the interpretation of main effects, but again, it does not explain interaction effects.

Of course I googled around a bit and found an explanation for interaction effects with another binary predictor and a tutorial. My predictors are ordinal or categorical with more than two categories. This question has no answer yet. In my desperation I started to read posts from the Stata forum (either no answer or the model is wrongly specified) and SPSS.

The data: the dependent variable (DV) ranges from 1 (not probable) to 7 (highly probable) to do action X. There are 1197 observations in the dataset. The predictor that interests the most is a categorical with 8 levels (different nudge types, unordered).
The approach is building a base model with probability to carry out action X as outcome (DV) and nudge types as predictor (IV) and then adding a another predictor to check for an interaction effect. The dataset has additional predictors about socio-demographics and attitudes. They are categorical, ordinal or interval scaled. Below an example output for nudge type and sustainability values: enter image description here

EinstNH_RCBS_UmweltMean stands for sustainability values and is based on existing scale items. Higher sustainability values increase the probability of study participants to carry out action X.

My questions:

  1. How much do sustainability values influence the different nudge types?
    I would expect that this influence varies.
  2. Is is possible to make a statement about how much the interaction effect influences log odds-ratio of participants selecting 5,6 or 7 on the outcome, i.e. for which nudge type sustainability values are particularly effective?

According to the SPSS tutorial ordinal regression is based on logistic regression and thus the computation of interaction effects is the same. Knowing that there are ordinal regression experts on SE, I like to double check this and learn how I would proceed to calculate how much sustainability values impact nudge type? (preferably in R either the the MASS or rms package)

This post mentions the contrast function from the rms package. Googling around and reading the CRAN vignette has not given me much explanation how I could proceed to answer my question, because:
a) I don't know whether I the coefficient are already log odd-ratios or not (in polr the estimate values are not)
b) how I would get from the summary output to a contrast analysis?
This post mentions the package and refers to the vignette.

Thanks for the advice!

Up-date 2023/10/11 As suggested by Frank Harell I computed the ordinal (logistic) regression with the orm function from rms. This gives me values, but I am not clear how to correctly interpret them. enter image description here

Can I say that:
a) Nudge 1 results in a 4.611255 log odds ratio (or 361% higher likelihood) of carrying out action X in comparison to the base condition (Nudge 0)
b) Higher sustainability values (variable EinstNH_SVAL_UmweltMean) results in a 2.22 log odds ratio (or 122% higher likelihood) of carrying out action X.
c) For individuals seeing Nudge 1, a unit increase in sustainability values decreases the likelihood of carrying out action X by 10% (log odds ratio 0.8991549)

Below the summary statistics and a contrast for Nudge 0 and Nudge 7. Why are the results different?
enter image description here enter image description here

Below the code I have written that produced above results (and more plots). It might be useful to others.


dd <- datadist(data) #get data distribution. 
options(datadist = 'dd') # set to data distribution of current data

#compute ordinal logistic regression
ord_Reg1 <- orm(outcome ~ predictor1*predictor2, data = data, se.fit = TRUE, y = TRUE)
options(prType = 'html') #set display options 
#display table with model summary, coefficients and p-values
print(ord_Reg1, digits = 3, coefs= TRUE, title = 'table title') 
#get log odds ratio

Here are a couple of functions for visualisation:

p <- Predict(ord_Reg1) #plot log odds per IV
plot(p, ylab=expression(hat(P)))#plot Probability instead of log odds on ylab
#plot interaction between 2 categorical predictors
p <- Predict(ord_Reg1, predictor1, predictor2) 

#groups can only be used for categorical predictor. So if you have
#a continuous predictor put it where predictor 2 is 
plot(p, ~ predictor2, groups = 'predictor1', nlines = TRUE)

#check proportional odds assumption. by default plots category level 
#with most value. If categorical has 8 levels specify topcat = 7 to plot
#all levels of categorical variable
plot.xmean.ordinaly(DV ~ predictor1*predictor2, data, topcat = 7, cr = F)


1 Answer 1


Questions specific to the rms package are slightly better addressed at datamethods.org/rms . The contrast function gives you differences and double differences (interaction effects) and also antilogs those to present odds ratios. Partial effects interaction plots are also important. These are other displays are covered here. Interactions are not difficult once you frame them in terms of predicted values. Besides default partial effects plots on the log odds scale you can predict $\Pr(Y \geq y |X)$ as a function of $X$ for specific $y$.

  • $\begingroup$ Thanks for the response! The link describes how to assess the fir of a linear model, which is not my question. On the website hbiostat.org I found a subpage on ordinal regression. Unfortunately, said page does not answer my question about interaction effects neither. Could you please update your response to address my questions? thanks. $\endgroup$
    – Simone
    Oct 6, 2023 at 13:27
  • $\begingroup$ In the rms manual I found the contrast.rms function on page 32. is this what you are referring to? <br> Also not being a trained statistician, it is helpful to me to know whether ordinal regression is conceptually an extension of logistic regression and the computation method for main and interaction effect is thus similar. I am more familiar with logistic regression :-) $\endgroup$
    – Simone
    Oct 6, 2023 at 13:28
  • $\begingroup$ Yes. This allows you to get true interaction contrasts as well as single differences a la main effects. But keep in mind the use of ggplot(Predict(…)) to get full interaction plots. $\endgroup$ Oct 6, 2023 at 13:31
  • $\begingroup$ O.k. thanks. Will I also get the coefficients for each level of the categorical predictor? I guess I would need this to compute the interaction effect. We need a quantification for our report (and possibly peer reviewed paper) That said, the visualisation will be beneficial for the presentation of the project to our industry partners. $\endgroup$
    – Simone
    Oct 6, 2023 at 13:35
  • 1
    $\begingroup$ By giving a single list() to contrast you are asking for predictions. You need to give it 2 list for differences or 4 lists for double differences (and ratios of odds ratios). If you omit an interacting factor from a list() you’ll get a difference at the median (if continuous) or mode (if categorical) level of the unnamed interacting factor. $\endgroup$ Oct 11, 2023 at 12:49

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.