Hi, I am currently doing logistic regression analyses and I am trying to get confidence intervals for my partial logistic regression coefficients. Supposing I am right in assuming that the formula to estimate a 95% CI for a log odds coefficient is the following: log odds - 1.96*SE to log odds + 1.96*SE then I am not getting the right CI. For instance, this is a summary of my model: Estimate Std. Error z value Pr(>|z|) (Intercept) -0.06106 0.29808 -0.205 0.8377 pSusSD 0.21184 0.36886 0.574 0.5658 pBenSD 1.20255 0.52271 2.301 0.0214 * pBarSD -0.08654 0.48749 -0.178 0.8591 pSevSD 0.99759 0.44795 2.227 0.0259 * And this is are the corresponding CI when I call the confint function: 2.5 % 97.5 % (Intercept) -0.6548023 0.5264357 pSusSD -0.4980888 0.9733975 pBenSD 0.2665235 2.3495259 pBarSD -1.0695945 0.8740359 pSevSD 0.1877044 1.9747499 Utilizing the formula I mentioned above, the correct CI for pSusSD would actually be:> .21184-1.96*.36886[1] -0.5111256> .21184+1.96*.36886[1] 0.9348056 That is: 2.5 % 97.5 % pSusSD -0.5111256 0.9348056 I am wondering if there is a bug in the code or if there is another way to calculate a 95% CI for a logistic regression coefficient that I am not aware of? Thanks! -- All the best!, ~Joaquin A. Aguilar A. - aka Kino [[alternative HTML version deleted]]
Dear Kino, The confidence intervals that you've computed yourself are based on the Wald statistic, while confint() computes confidence intervals based on the likelihood-ratio statistic, by profiling the likelihood (see ?confint and click on the link for confint.glm). Basing confidence intervals on the likelihood is more computationally intensive but should be more accurate. I hope this helps, John -------------------------------- John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox> -----Original Message----- > From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r- > project.org] On Behalf Of Kino Aguilar > Sent: February-11-11 1:26 PM > To: R-devel at r-project.org > Subject: [Rd] Problem with confint function > > Hi, > > I am currently doing logistic regression analyses and I am trying to get > confidence intervals for my partial logistic regression coefficients. > Supposing I am right in assuming that the formula to estimate a 95% CI > for a log odds coefficient is the following: > > log odds - 1.96*SE to log odds + 1.96*SE > > then I am not getting the right CI. > > For instance, this is a summary of my model: > Estimate Std. Error z value Pr(>|z|) > (Intercept) -0.06106 0.29808 -0.205 0.8377 > pSusSD 0.21184 0.36886 0.574 0.5658 > pBenSD 1.20255 0.52271 2.301 0.0214 * > pBarSD -0.08654 0.48749 -0.178 0.8591 > pSevSD 0.99759 0.44795 2.227 0.0259 * > > And this is are the corresponding CI when I call the confint function: > 2.5 % 97.5 % > (Intercept) -0.6548023 0.5264357 > pSusSD -0.4980888 0.9733975 > pBenSD 0.2665235 2.3495259 > pBarSD -1.0695945 0.8740359 > pSevSD 0.1877044 1.9747499 > > Utilizing the formula I mentioned above, the correct CI for pSusSD would > actually be: > > .21184-1.96*.36886 > [1] -0.5111256 > > .21184+1.96*.36886 > [1] 0.9348056 > > That is: > 2.5 % 97.5 % > pSusSD -0.5111256 0.9348056 > > I am wondering if there is a bug in the code or if there is another way > to calculate a 95% CI for a logistic regression coefficient that I am > not aware of? > > Thanks! > > -- > All the best!, > ~Joaquin A. Aguilar A. - aka Kino > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
On Feb 11, 2011, at 19:25 , Kino Aguilar wrote:> Hi, > > I am currently doing logistic regression analyses and I am trying to get > confidence intervals for my partial logistic regression coefficients. > Supposing I am right in assuming that the formula to estimate a 95% CI for a > log odds coefficient is the following: > > log odds - 1.96*SE to log odds + 1.96*SE > > then I am not getting the right CI. > > For instance, this is a summary of my model: > Estimate Std. Error z value Pr(>|z|) > (Intercept) -0.06106 0.29808 -0.205 0.8377 > pSusSD 0.21184 0.36886 0.574 0.5658 > pBenSD 1.20255 0.52271 2.301 0.0214 * > pBarSD -0.08654 0.48749 -0.178 0.8591 > pSevSD 0.99759 0.44795 2.227 0.0259 * > > And this is are the corresponding CI when I call the confint function: > 2.5 % 97.5 % > (Intercept) -0.6548023 0.5264357 > pSusSD -0.4980888 0.9733975 > pBenSD 0.2665235 2.3495259 > pBarSD -1.0695945 0.8740359 > pSevSD 0.1877044 1.9747499 > > Utilizing the formula I mentioned above, the correct CI for pSusSD would > actually be: >> .21184-1.96*.36886 > [1] -0.5111256 >> .21184+1.96*.36886 > [1] 0.9348056 > > That is: > 2.5 % 97.5 % > pSusSD -0.5111256 0.9348056 > > I am wondering if there is a bug in the code or if there is another way to > calculate a 95% CI for a logistic regression coefficient that I am not aware > of? >confint.glm computes using likelihood profiling (i.e., it inverts the likelihood ratio test criterion for a parameter). This is considered somewhat more accurate than the Wald approximation implied by +/- 1.96*SE. If you insist on the latter, try confint.default. (This *is* all on the help page for confint()!).> Thanks! > > -- > All the best!, > ~Joaquin A. Aguilar A. - aka Kino > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com