Dear all, I am struggling with the calculation of standard error of the coefficient in Binary logistic regression analysis. I built a binary logsitic regression model as follows and got confused since the calculation of standard error of coefficients of X1, X2 and X3 are not the same as the Linear regression.> fit4 <-glm(Y~X1+X2+X3,data=d4,family=binomial("logit"))Warning message: In glm.fit(x = X, y = Y, weights = weights, start = start, etastart etastart, : fitted probabilities numerically 0 or 1 occurred> summary(fit4)Call: glm(formula = Y ~ X1 + X2 + X3, family = binomial("logit"), data = d4) Deviance Residuals: Min 1Q Median 3Q Max -1.641483e+00 -8.421161e-05 0.000000e+00 1.349398e-03 1.417550e+00 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -10.1534523 10.8397717 -0.93669 0.348921 X1 0.3312469 0.3007324 1.10147 0.270693 X2 0.1808757 0.1069222 1.69166 0.090711 . X3 5.0874665 5.0820163 1.00107 0.316792 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 91.4954278 on 65 degrees of freedom Residual deviance: 5.8129055 on 62 degrees of freedom AIC: 13.812906 Number of Fisher Scoring iterations: 12 Could somebody suggest the calculation of standard error of X1, X2 and X3 in the output of my model, please? Any suggestions will be really appreciated. Kind Regards Bessy -- View this message in context: http://r.789695.n4.nabble.com/standard-error-of-Binary-logistic-regression-coefficient-tp2303716p2303716.html Sent from the R help mailing list archive at Nabble.com.
John Sorkin
2010-Jul-27 16:37 UTC
[R] standard error of Binary logistic regression coefficient.
Do not worry about the SE. The SE listed on the output is the SE of the log odds. You can use the estimate (beta) and SE from the listing to compute a confidence interval (CI)as follows: CI exp(beta-1.96*SE) to exp(beta-1.96*SE) John John Sorkin Chief Biostatistics and Informatics Univ. of Maryland School of Medicine Division of Gerontology and Geriatric Medicine JSorkin at grecc.umaryland.edu -----Original Message----- From: Bessy <piglet630 at hotmail.com> To: <r-help at r-project.org> Sent: 7/27/2010 11:40:33 AM Subject: [R] standard error of Binary logistic regression coefficient. Dear all, I am struggling with the calculation of standard error of the coefficient in Binary logistic regression analysis. I built a binary logsitic regression model as follows and got confused since the calculation of standard error of coefficients of X1, X2 and X3 are not the same as the Linear regression.> fit4 <-glm(Y~X1+X2+X3,data=d4,family=binomial("logit"))Warning message: In glm.fit(x = X, y = Y, weights = weights, start = start, etastart etastart, : fitted probabilities numerically 0 or 1 occurred> summary(fit4)Call: glm(formula = Y ~ X1 + X2 + X3, family = binomial("logit"), data = d4) Deviance Residuals: Min 1Q Median 3Q Max -1.641483e+00 -8.421161e-05 0.000000e+00 1.349398e-03 1.417550e+00 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -10.1534523 10.8397717 -0.93669 0.348921 X1 0.3312469 0.3007324 1.10147 0.270693 X2 0.1808757 0.1069222 1.69166 0.090711 . X3 5.0874665 5.0820163 1.00107 0.316792 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 91.4954278 on 65 degrees of freedom Residual deviance: 5.8129055 on 62 degrees of freedom AIC: 13.812906 Number of Fisher Scoring iterations: 12 Could somebody suggest the calculation of standard error of X1, X2 and X3 in the output of my model, please? Any suggestions will be really appreciated. Kind Regards Bessy -- View this message in context: http://r.789695.n4.nabble.com/standard-error-of-Binary-logistic-regression-coefficient-tp2303716p2303716.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at 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. Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}}
Achim Zeileis
2010-Jul-27 16:48 UTC
[R] standard error of Binary logistic regression coefficient.
On Tue, 27 Jul 2010, John Sorkin wrote:> Do not worry about the SE. The SE listed on the output is the SE of the log odds. You can use the estimate (beta) and SE from the listing to compute a confidence interval (CI)as follows: > CI exp(beta-1.96*SE) to exp(beta-1.96*SE)The standard errors can be computed by using the vcov() method: sqrt(diag(vcov(glm_object))) Confidence intervals can be computed using the confint() method: confint(glm_object) hth, Z> John > John Sorkin > Chief Biostatistics and Informatics > Univ. of Maryland School of Medicine > Division of Gerontology and Geriatric Medicine > JSorkin at grecc.umaryland.edu > -----Original Message----- > From: Bessy <piglet630 at hotmail.com> > To: <r-help at r-project.org> > > Sent: 7/27/2010 11:40:33 AM > Subject: [R] standard error of Binary logistic regression coefficient. > > > Dear all, > > I am struggling with the calculation of standard error of the coefficient in > Binary logistic regression analysis. > > I built a binary logsitic regression model as follows and got confused since > the calculation of standard error of coefficients of X1, X2 and X3 are not > the same as the Linear regression. > >> fit4 <-glm(Y~X1+X2+X3,data=d4,family=binomial("logit")) > Warning message: > In glm.fit(x = X, y = Y, weights = weights, start = start, etastart > etastart, : > fitted probabilities numerically 0 or 1 occurred >> summary(fit4) > > Call: > glm(formula = Y ~ X1 + X2 + X3, family = binomial("logit"), data = d4) > > Deviance Residuals: > Min 1Q Median 3Q Max > -1.641483e+00 -8.421161e-05 0.000000e+00 1.349398e-03 1.417550e+00 > > Coefficients: > Estimate Std. Error z value Pr(>|z|) > (Intercept) -10.1534523 10.8397717 -0.93669 0.348921 > X1 0.3312469 0.3007324 1.10147 0.270693 > X2 0.1808757 0.1069222 1.69166 0.090711 . > X3 5.0874665 5.0820163 1.00107 0.316792 > --- > Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 > > (Dispersion parameter for binomial family taken to be 1) > > Null deviance: 91.4954278 on 65 degrees of freedom > Residual deviance: 5.8129055 on 62 degrees of freedom > AIC: 13.812906 > > Number of Fisher Scoring iterations: 12 > > > Could somebody suggest the calculation of standard error of X1, X2 and X3 in > the output of my model, please? > > Any suggestions will be really appreciated. > > Kind Regards > > Bessy > > -- > View this message in context: http://r.789695.n4.nabble.com/standard-error-of-Binary-logistic-regression-coefficient-tp2303716p2303716.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. > > Confidentiality Statement: > This email message, including any attachments, is for th...{{dropped:6}} > > ______________________________________________ > R-help at 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. >
Joshua Wiley
2010-Jul-27 17:03 UTC
[R] standard error of Binary logistic regression coefficient.
Hi, Just to extend the excellent suggestions, if you are interested in the odds ratio, you can just use exp(): #Odds Ratio exp(fit4$coefficients) #Confidence interval around OR exp(confint(fit4)) To give you an idea graphically of the log odds (or logit) look at: p <- seq(0, 1, by = .001) plot(y = log(p / (1 - p) ), x = p, type = "l") Cheers, Josh On Tue, Jul 27, 2010 at 8:40 AM, Bessy <piglet630 at hotmail.com> wrote:> > Dear all, > > I am struggling with the calculation of standard error of the coefficient in > Binary logistic regression analysis. > > I built a binary logsitic regression model as follows and got confused since > the calculation of standard error of coefficients of X1, X2 and X3 are not > the same as the Linear regression. > >> fit4 <-glm(Y~X1+X2+X3,data=d4,family=binomial("logit")) > Warning message: > In glm.fit(x = X, y = Y, weights = weights, start = start, etastart > etastart, ?: > ?fitted probabilities numerically 0 or 1 occurred >> summary(fit4) > > Call: > glm(formula = Y ~ X1 + X2 + X3, family = binomial("logit"), data = d4) > > Deviance Residuals: > ? ? ? ? ?Min ? ? ? ? ? ? 1Q ? ? ? ? Median ? ? ? ? ? ? 3Q ? ? ? ? ? ?Max > -1.641483e+00 ?-8.421161e-05 ? 0.000000e+00 ? 1.349398e-03 ? 1.417550e+00 > > Coefficients: > ? ? ? ? ? ? ? Estimate ? ? Std. Error ?z value Pr(>|z|) > (Intercept) -10.1534523 ?10.8397717 -0.93669 0.348921 > X1 ? ? ? ? ? ?0.3312469 ? 0.3007324 ?1.10147 0.270693 > X2 ? ? ? ? ? ?0.1808757 ? 0.1069222 ?1.69166 0.090711 . > X3 ? ? ? ? ? ?5.0874665 ? 5.0820163 ?1.00107 0.316792 > --- > Signif. codes: ?0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 > > (Dispersion parameter for binomial family taken to be 1) > > ? ?Null deviance: 91.4954278 ?on 65 ?degrees of freedom > Residual deviance: ?5.8129055 ?on 62 ?degrees of freedom > AIC: 13.812906 > > Number of Fisher Scoring iterations: 12 > > > Could somebody suggest the calculation of standard error of X1, X2 and X3 in > the output of my model, please? > > Any suggestions will be really appreciated. > > Kind Regards > > Bessy > > -- > View this message in context: http://r.789695.n4.nabble.com/standard-error-of-Binary-logistic-regression-coefficient-tp2303716p2303716.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/