Skip to content
Prev 363150 / 398502 Next

Odds ratios in logistic regression models with interaction

For full generality contrasts, it doesn't really get much simpler that what you do below. Any "smart" way of specifying your "d" vector ends up with some "d" not specifiable.

The only neat thing I can think of is that you can do multiple contrasts with a matrix D instead of a vector D as

z <- D %*% coef(fit)

and then, although correct, you do not want to get se.fit as sqrt(diag(D %*% vcov(fit) %*% t(D))) if D has a substantial number of rows. Rather, you do it as 

rowSums((D %*% vcov(fit)) * D).

-ps