Hi Guoya, One more option, using Joshua's example, would be:
# install.packages('epicalc') require(epicalc) logistic.display(my.glm) HTH, Jorge On Fri, Sep 24, 2010 at 1:50 PM, Li, Guoya <> wrote: > Hi, I am new to R. Anyone can explain the following from R-help or > anyone can direct me how to calculate odds ratio from logistic model in > R. Thank you very much. Guoya > > > > > > Stefano <stecalza at tiscalinet.it > <https://stat.ethz.ch/mailman/listinfo/r-help> > writes: > >Hi all. > > > >A simple question. > >Is there a function to compute the Odds Ratio and its confidence > intervall, from > >a logistic model (glm(.......,family=binomial....). I've written my > own, but > >certainly someone did a better job. > > I show a simple function to do this in my introductory notes available > from: > > http://www.myatt.demon.co.uk > > basically it is: > > lreg.or <- function(model) > { > lreg.coeffs <- coef(summary(salex.lreg)) > lci <- exp(lreg.coeffs[ ,1] - 1.96 * lreg.coeffs[ ,2]) > or <- exp(lreg.coeffs[ ,1]) > uci <- exp(lreg.coeffs[ ,1] + 1.96 * lreg.coeffs[ ,2]) > lreg.or <- cbind(lci, or, uci) > lreg.or > } > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.