a) Run the following code:
fitlogit <- glm(Male~Wage+EDUC+EXPER+AGE, data=mydata,
family=binomial(link="logit"))
summary(fitlogit)
Results are:
Coefficients:
Estimate Std. Error z value
(Intercept) -5.18674 2.09966 -2.470
Wage 0.11319 0.07883 1.436
EDUC 0.32020 0.17132 1.869
EXPER 0.02064 0.06772 0.305
AGE 0.01471 0.03478 0.423
Pr(>|z|)
(Intercept) 0.0135 *
Wage 0.1510
EDUC 0.0616 .
EXPER 0.7605
AGE 0.6724
Hence, Logit(Male) = -5.187 + 0.113(Wage) + 0.320(EDUC) + 0.020(EXPER) + 0.015(AGE)
b) Run the following code:
predict.glm(fitlogit,type="response",data.frame(Wage=30, EDUC =
8, EXPER = 20, AGE = 50))
Result: 0.872
c) Most important predictor from the above table (which has the lowest p-value) = 0.0616
d) Run the following code:
fitlogit2 <- glm(Male~Wage+EDUC, data=mydata,
family=binomial(link="logit"))
summary(fitlogit2)
Results:
Coefficients:
Estimate Std. Error
(Intercept) -4.57524 1.70025
Wage 0.13429 0.07161
EDUC 0.28704 0.15712
z value Pr(>|z|)
(Intercept) -2.691 0.00713 **
Wage 1.875 0.06073 .
EDUC 1.827 0.06772 .
Both the variables are significant at 10% significance level as p-value of both < 0.1
e) Run the following code:
predict.glm(fitlogit2,type="response",data.frame(Wage=30,EDUC=8))
Answer: 0.852
Wage EDUC EXPER AGE Male 40 39 38 53 59 36 45 37 37 43 32 40 49 43 31 45 31 37.85 21.72 14.34 21....