Logistic Regression Standard Error Formula
Contents |
från GoogleLogga inDolda fältSök efter grupper eller meddelanden
Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have
Logistic Regression Python
Meta Discuss the workings and policies of this site About Us interpreting standard error in logistic regression Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with logistic regression calculator us Cross Validated Questions Tags Users Badges Unanswered Ask Question _ Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, https://groups.google.com/d/topic/comp.soft-sys.stat.spss/Fv7Goxs_Bwk data mining, and data visualization. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How are the standard errors computed for the fitted values from a logistic regression? up vote 17 down vote favorite http://stats.stackexchange.com/questions/66946/how-are-the-standard-errors-computed-for-the-fitted-values-from-a-logistic-regre 16 When you predict a fitted value from a logistic regression model, how are standard errors computed? I mean for the fitted values, not for the coefficients (which involves Fishers information matrix). I only found out how to get the numbers with R (e.g., here on r-help, or here on Stack Overflow), but I cannot find the formula. pred <- predict(y.glm, newdata= something, se.fit=TRUE) If you could provide online source (preferably on a university website), that would be fantastic. r regression logistic mathematical-statistics references share|improve this question edited Aug 9 '13 at 15:14 gung 74.2k19160309 asked Aug 9 '13 at 14:41 user2457873 8814 add a comment| 1 Answer 1 active oldest votes up vote 19 down vote accepted The prediction is just a linear combination of the estimated coefficients. The coefficients are asymptotically normal so a linear combination of those coefficients will be asymptotically normal as well. So if we can obtain the covariance matrix for the parameter estimates we can obtain the standard error for a linear com
standard errors into odds ratios is trivial in Stata: just add , or to the end of a logit command: . use "http://www.ats.ucla.edu/stat/data/hsbdemo", clear . logit honors i.female math https://www.andrewheiss.com/blog/2016/04/25/convert-logistic-regression-standard-errors-to-odds-ratios-with-r/ read, or Logistic regression Number of obs = 200 LR chi2(3) = 80.87 Prob > chi2 = 0.0000 Log likelihood = -75.209827 Pseudo R2 = 0.3496 ------------------------------------------------------------------------------ honors | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | female | 3.173393 1.377573 2.66 0.008 1.35524 7.430728 math | 1.140779 .0370323 4.06 0.000 1.070458 1.21572 read | 1.078145 .029733 logistic regression 2.73 0.006 1.021417 1.138025 _cons | 1.99e-06 3.68e-06 -7.09 0.000 5.29e-08 .0000749 ------------------------------------------------------------------------------ Doing the same thing in R is a little trickier. Calculating odds ratios for coefficients is trivial, and exp(coef(model)) gives the same results as Stata: # Load libraries library(dplyr) # Data frame manipulation library(readr) # Read CSVs nicely library(broom) # Convert models to data frames # Use treatment contrasts instead logistic regression standard of polynomial contrasts for ordered factors options(contrasts=rep("contr.treatment", 2)) # Load and clean data df <- read_csv("http://www.ats.ucla.edu/stat/data/hsbdemo.csv") %>% mutate(honors = factor(honors, levels=c("not enrolled", "enrolled")), female = factor(female, levels=c("male", "female"), ordered=TRUE)) # Run model model <- glm(honors ~ female + math + read, data=df, family=binomial(link="logit")) summary(model) #> #> Call: #> glm(formula = honors ~ female + math + read, family = binomial(link = "logit"), #> data = df) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -2.0055 -0.6061 -0.2730 0.4844 2.3953 #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) -13.12749 1.85080 -7.093 1.31e-12 *** #> femalefemale 1.15480 0.43409 2.660 0.00781 ** #> math 0.13171 0.03246 4.058 4.96e-05 *** #> read 0.07524 0.02758 2.728 0.00636 ** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> (Dispersion parameter for binomial family taken to be 1) #> #> Null deviance: 231.29 on 199 degrees of freedom #> Residual deviance: 150.42 on 196 degrees of freedom #> AIC: 158.42 #> #> Number of Fisher Scoring iterations: 5 # Exponentiate coefficients exp(coef(model)) #>
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 20 Oct 2016 07:04:01 GMT by s_wx1202 (squid/3.5.20)