I'm trying to undertake a logistic regression analysis in R
. I have attended courses covering this material using STATA. I am finding it very difficult to replicate functionality in R
. Is it mature in this area? There seems to be little documentation or guidance available. Producing odds ratio output seems to require installing epicalc
and/or epitools
and/or others, none of which I can get to work, are outdated or lack documentation. I've used glm
to do the logistic regression. Any suggestions would be welcome.
I'd better make this a real question. How do I run a logistic regression and produce odds rations in R
?
Here's what I've done for a univariate analysis:
x = glm(Outcome ~ Age, family=binomial(link="logit"))
And for multivariate:
y = glm(Outcome ~ Age + B + C, family=binomial(link="logit"))
I've then looked at x
, y
, summary(x)
and summary(y)
.
Is x$coefficients
of any value?
Best Answer
if you want to interpret the estimated effects as relative odds ratios, just do
exp(coef(x))
(gives you $e^\beta$, the multiplicative change in the odds ratio for $y=1$ if the covariate associated with $\beta$ increases by 1). For profile likelihood intervals for this quantity, you can doEDIT: @caracal was quicker...