Skip to content

Odds ratios in logistic regression models with interaction

1 message · Laviolette, Michael

#
Thanks. I ended up doing it as a contrast directly from the covariance matrix. There's probably a package that provides a better way, maybe the "contrast" package. For now, this works.

a <- 25   # age
# contrast for estimating OR's for given age
d <- c(1, 1, a, a) - c(1, 0, a, 0)
# estimate of log OR with standard error 
est.ln.or <- crossprod(coef(fit3.14c), d)
se.ln.or <- sqrt(t(d) %*% vcov(fit3.14c) %*% d)
# exponentiate for OR and CI
est.or <- exp(est.ln.or)
lci.or <- exp(est.ln.or - 1.96 * se.ln.or)
uci.or <- exp(est.ln.or + 1.96 * se.ln.or)


-----Original Message-----
From: Michael Dewey [mailto:lists at dewey.myzen.co.uk] 
Sent: Thursday, August 04, 2016 8:32 AM
To: Laviolette, Michael; r-help at r-project.org
Subject: Re: [R] Odds ratios in logistic regression models with interaction

Laviolette, Michael <Michael.Laviolette at dhhs.nh.gov> wrote :
There is always confint. Not sure if you need MASS first from memory, not got a copy of R running to hand.


 Thanks. -Mike L.