I am trying to do some logistic regression, and having heard that the command logistic
in Stata can be used to present the coefficient on the OR scale, and logit
for the same thing in ln(OR) scale. Is there anything equivalent for R? I used glm
and the output is only ln(OR), so I need to do the calculation all by myself and I am afraid that I may somehow miscalculate something.
Asked
Active
Viewed 532 times
1
2 Answers
3
You should read the help page for predict.glm. Set type="response".
If your interest is only in calculating the OR you would simply enter:
exp(coef(fit))

IRTFM
- 258,963
- 21
- 364
- 487
-
`type=response` gives you probabilities not the odds ratio. You also need to remember to add the intercept coefficient to the variable coefficients before transforming to get the overall prediction. – James Jan 24 '11 at 10:38
-
The follow on question to getting the odds ratios is often how to get the probabilities. And you are right in pointing out that the R default is to present in the form of treatment contrasts, so that the Intercept is the estimate of the log-odds for the base group, which would be a subject with continuous covariates all = 0 and the factor variables at their lowest levels. – IRTFM Jan 24 '11 at 12:14
0
Are you looking for plogis
(logistic) and qlogis
(logit)? e.g. qlogis(0.5)==0
, plogis(0)==0.5

Ben Bolker
- 211,554
- 25
- 370
- 453