-
Notifications
You must be signed in to change notification settings - Fork 35
Odds ratios to interpret a multinomial regression model #575
Description
Hello and thank you for creating this package. I found a small problem with the calculation of odds ratios to interpret explanatory variables in a multinomial regression model. I have verified that version 1.8.8 of emmeans does the calculation correctly, but version 2.0.2 does not. The problem is simply the newer version does not apply the exponential function to the difference of two log odds.
Below is code that estimates a multinomial regression model to the classic pneumoconiosis data (see the pneumo data frame of the VGAM package and exercise 23 of Bilder and Loughin, 2024). A modified format version of the data set is at chrisbilder.com/stat875/graded/project4.csv. The purpose is to use time (years in coal mine) to estimate resp (normal, mild, or severe pneumoconiosis). Version 1.8.8 estimates the odds ratios for time correctly, such as 0.658 for the mild vs. normal comparison with a 5-year reduction in time. Version 2.0.2 returns the difference in the log odds for mild vs. normal. While one can simply use exp() to obtain the odds ratio, this was not needed with earlier versions of the package.
Thank you,
Chris
project4 <- read.csv(file = 'https://chrisbilder.com/stat875/graded/project4.csv')
head(project4, n = 3)
library(nnet)
mod.fit.nom <- multinom(formula = resp ~ time, data = project4, weights = count)
summary(mod.fit.nom)
library(emmeans)
calc.est <- emmeans(object = mod.fit.nom, specs = ~ resp + time, mode = "latent", at = list(time = c(15, 20)))
test.info <- contrast(object = calc.est, interaction = list("pairwise", "pairwise"))
confint(object = test.info, df = Inf, type = "response", level = 0.95)