Published on SOCY 7112G (http://stats.courseserve.info)

Comparing Least Squares and Logistic Regression

By Professor Shortell
Created 12/09/2013 - 7:13pm



CILS2010<-read.csv("http://www.courseserve.info/files/CILS2010.csv")
attach(CILS2010)

Eng=0; Eng<-V24+V25+V26+vV27
Eng2=0; Eng2[Eng>15]<-1; Eng2[Eng<=15]<-0

# Least squares linear regression
summary(lm(V60~Eng+V18+V19+V55+V72+V44+V11+V17))

Call:
lm(formula = V60 ~ Eng + V18 + V19 + V55 + V72 + V44 + V11 +
V17)

Residuals:
Min 1Q Median 3Q Max
-3.4792 -0.3826 0.2338 0.4215 1.4193

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.9532905 0.2894521 13.658 < 2e-16 ***
Eng 0.0790067 0.0092637 8.529 < 2e-16 ***
V18 0.2221707 0.0272793 8.144 5.86e-16 ***
V19 -0.0635706 0.0158466 -4.012 6.20e-05 ***
V55 0.0017498 0.0594642 0.029 0.9765
V72 -0.0013663 0.0007504 -1.821 0.0688 .
V44 -0.0399862 0.0165164 -2.421 0.0155 *
V11 0.0960830 0.0400204 2.401 0.0164 *
V17 0.0193007 0.0382207 0.505 0.6136
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6816 on 2598 degrees of freedom
(2655 observations deleted due to missingness)
Multiple R-squared: 0.07556, Adjusted R-squared: 0.07271
F-statistic: 26.54 on 8 and 2598 DF, p-value: < 2.2e-16


# Logistic regression
Degree=0; Degree[V60>=4]<-1; Degree[V60<4]<-0

summary(glm(Degree~Eng+V18+V19+V55+V72+V44+V11+V17,family="binomial"))

Call:
glm(formula = Degree ~ Eng + V18 + V19 + V55 + V72 + V44 + V11 +
V17, family = "binomial")

Deviance Residuals:
Min 1Q Median 3Q Max
-2.8453 0.2487 0.3098 0.3961 1.5044

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.159578 1.586683 1.361 0.173493
Eng 0.269895 0.041050 6.575 4.87e-11 ***
V18 0.630390 0.170316 3.701 0.000214 ***
V19 -0.333370 0.090546 -3.682 0.000232 ***
V55 0.170815 0.384830 0.444 0.657135
V72 -0.008990 0.003437 -2.616 0.008899 **
V44 -0.125861 0.094880 -1.327 0.184665
V11 0.434436 0.249167 1.744 0.081237 .
V17 0.062597 0.223177 0.280 0.779109
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 1299.1 on 2606 degrees of freedom
Residual deviance: 1201.6 on 2598 degrees of freedom
(2655 observations deleted due to missingness)
AIC: 1219.6

Number of Fisher Scoring iterations: 6


exp(coef(glm(Degree~Eng+V18+V19+V55+V72+V44+V11+V17,family="binomial")))

(Intercept) Eng V18 V19 V55 V72 V44 V11 V17
8.6674770 1.3098271 1.8783437 0.7165050 1.1862717 0.9910506 0.8817370 1.5440920 1.0645972


Source URL:
http://stats.courseserve.info/?q=node/123