Logistic Regression – Using Contrast for Logistic Regression in R with RMS

contrastslogisticrregression

I am conducting a logistic regression with an interaction term involving two categorical variables. One variable (variable a) has 7 values and the other has 3 (variable b). I want to run a contrast and jointly test for differences in variable b at each value of variable a. In other words I want to run 7 separate contrast. I am using the contrast function in rms. I can't quite understand what the contrast is testing when I provide only one list to the function

E.g.

contrast(fit = model1, a = list(variableA = "one", 
         variableB=c("one", "two"', "three"), type = "joint").

I have read the documentation but any help interpreting would be most appreciated.

Best Answer

This would have more more appropriate for here.

I spent a great deal of time writing the documentation for the function so I'd be interested to know what is not in the documentation.

type='joint' will provide the combined test for the joint null hypothesis that all of the listed contrasts are zero. The alternative hypothesis is that at least one of them is non-zero. You can use this approach to get ANOVA-like tests but the tests do not have to involve all the levels of the variables (unlike ANOVA which tests for all possible group differences).

To shorten the notation suppose you have two predictors x1 (having values A and B) and x2 (having values a, b, c). If you run

contrast(fit, x1='A', x2=c('a','b','c'), type='joint')

you'll get these estimated differences in log odds, and their individual confidence intervals (there is an option to instead get simultaneous confidence intervals): A-a, A-b, A-c. Then you'll get a 3 d.f. Wald $\chi^2$ test to bring evidence against the supposition that all three of these differences in log odds are zero.

But when you provide only one list to the function you are not doing contrasts at all but are just getting predicted values (non-differences). If you paste in the output you got we can take a further look.

Related Question