3
$\begingroup$

I have a logistic regression model with several categorical explanatory variables and one interaction term (between two binary variables, named A and B). I know how to calculate the odds ratios for the different levels of A and B (for A=1, e.g., I need to add the coeff for A and coeff for A*B, then exponentiate), but how do I get a confidence interval for this OR? I need to do this in R please, this is the only statistical package I have access to.

$\endgroup$
2
$\begingroup$

You can get confidence intervals for the parameters in a logistic regression with confint(). E.g.

set.seed(938838210)
x1 <- rnorm(1000)
x2 <- rnorm(1000)
ylat <- 3*x1 + 2*x2 + x1*x2 + rnorm(1000, 0, 5)
y <- ylat > 0
m1 <- glm(y ~ x1 + x2 + x1*x2, family = "binomial")
summary(m1)
confint(m1)

However, the odds ratios and their confidence intervals are not unique; they depend on the values of the ivs. I wrote about this (using SAS, but the ideas are the same) in this paper (see "Gotcha 5"). In SAS 9.2 they've implemented a simple solution, but I don't know of an easy one in R.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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