I have a dataset of informations about students and the last column is the target variable which is the final note. My goal is to make logistic regression and ordinal regression models to see whether for a given student, they will either pass or not.

There are two features which behave the same way if one is 0 the other one is "in progress" and if one is 1 the other is "complete". Are such correlations automatically learned by both the logistic and ordinal regression or should I explicitly give it to the model ? (And I am sure there are other "linked" features that behave like that.)


1 Answer 1


An ordinal logistic regression is not so different from other GLMs. In any other GLM, if you want an interaction between features, you must specify that interaction. The same applies to the ordinal model.

Perhaps check out this simulation to see what happens when you do not include the interaction term vs when you do.

N <- 1000
x <- rnorm(N, 0, 3)
x <- runif(N, -10, 10)
g <- rbinom(N, 1, 0.5)
Ey <- x - 2*x*g 
e <- rnorm(N, 0, 1)
y <- Ey + e
d1 <- data.frame(
  X = x,
  Y = y,
  Group = as.factor(g)
L_null <- rms::orm(y ~ x + g)
L_full <- rms::orm(y ~ x + g + x*g)
preds_null <- predict(L_null)
preds_full <- predict(L_full)
ggplot(d1, aes(x = X, y = Y, col = Group)) +
  geom_point() +
  theme(legend.position = "bottom")
d2 <- data.frame(
  X = c(x, x),
  YHat = c(preds_null, preds_full),
  Group = as.factor(c(g, g)),
  Model = as.factor(rep(c("Without Interaction", "With Interaction"), c(N, N)))
ggplot(d2, aes(x = X, y = YHat, col = Group)) +
  geom_point() +
  facet_grid(cols = vars(Model)) +
  theme(legend.position = "bottom")

Here is a plot of the points, where Y depends on X, the group, and the interaction.

True values


The predictions from the model with the interaction explicitly modeled picks up on the interaction. Without the interaction explicitly modeled, the ordinal logistic regression in rms::orm cannot figure it out on its own.


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.