[R] Odds ratios for categorical variable
Roger D. Peng
rpeng at jhsph.edu
Fri Dec 5 20:09:39 CET 2003
Is hab coded as a factor or a numeric variable?
-roger
Sabrina Russo wrote:
> Dear R-users:
> How does one calculate in R the odds ratios for a CATEGORICAL predictor
> variable that has 4 levels. I see r-help inquiries regarding odds ratios
> for what looked like a continuous predictor variable. I was wondering how
> to get the pairwise odds ratios for comparisons of levels of a categorical
> predictor variable. I can't seem to get the correct output using:
> > sp.glm=glm(cohort$logreg~cohort$hab, family=binomial)
> > summary(sp.glm)
>
> This gives me the coefficient for the effect of hab overall, but not the
> coefficients for the comparisons of each of the levels. I suspect this has
> something to do with the contrasts statement, but I can't figure it out,
> and would be very appreciative of any help you can provide.
> Thank you,
> Sabrina
>
> ______________________________________________________________
> Sabrina E. Russo
> Postdoctoral Fellow
> Center for Tropical Forest Science - Arnold Arboretum Asia Program
> Harvard University
> 22 Divinity Avenue
> Cambridge, MA 02138 USA
>
> 617-496-2380 phone
> 617-495-9484 FAX
> srusso at oeb.harvard.edu
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list