Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We used R to fit a logistic regression model to predict the probability of default from balance and student status (Yes, No). > attach(Default) >
We used R to fit a logistic regression model to predict the probability of default from "balance" and student status (Yes, No). > attach(Default) > fit=glm(default ~ balance + student, family=binomial) > summary(fit) Call: gim(formula = default ~ balance + student, family = binomial) Deviance Residuals: Min 1Q Median 3Q Max -2.4578 -0.1422 -0.0559 -0.0203 3.7435 Coefficients: Estimate Std. Error z value Pr(>|z)) (Intercept) -10.7500 3.692e-01 -29.116 contrasts(default) Yes No 0 Yes 1 > probs=predict(fit, type="response") > probs[1:7] 2 3 4 5 6 7 1.409096e-03 1.140318e-03 1.005719e-02 4.469571e-04 1.943498e-03 2.050378e-03 2.441704e-03 > pred=rep("No", nrow(Default)) > pred[probs>.5]="Yes" > table(pred, default) default pred No Yes No 9628 228 Yes 39 105 Write out the model in an equation form. None of the above O default = -10.7500 + (0.005738 * balance) - ( 0.7149 * studentYes) where studentY = 1 when the person is a student. Pr(default=Yes) = e-10.7500 + (0.005738 * balance) - ( 0.7149 * studentYes) / (1 + e-10.7500 + (0.005738 * balance) - (0.7149 * studentYes) ) where studentYes = 1 when the person is a student. default = e-10.7500 + (0.005738 * balance) - ( 0.7149 * studentYes) / (1 + e-10.7500 + (0.005738 * balance) - ( 0.7149 * studentYes) ) where studentYes = 1 when the person is a student
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started