Question
1. For the following question, you will use the Beer Preference data used in class. You are asked to replicate some results and do some
1. For the following question, you will use the Beer Preference data used in class. You are asked to replicate some results and do some further analysis. The data can be found on the course website. (You do not need to partition the data).
a. Fit a linear probability model for Preference as a function of all other variables. Use Preference = Light as the success class (i.e. Light should be set to 1, Regular is 0).
b. Generate predicted preferences using a cutoff of 0.5.
c. What is the total error rate (i.e. the proportion of misclassified points)? <- Hint: use abs function
d. What is the error rate for each class - i.e. the proportion of each class that is misclassified? <- Hint: separate the prediction by halves
e. Create a chart as follows: sort the data by predicted probability of liking light beer (in descending order); create the cumulative of actual preference and plot (against rank). So, for instance, the first point would be (1, 1) if the person most likely to like light beer according to your model actually liked light beer; the second point would be (2, 2) if the second most likely person also actually liked light beer, but (2, 1) if he liked regular beer, and so on. Extend the above plot to include (0, 0) and connect with a straight line (using the R lines(...) function); for reference, graph a line joining (0, 0) to the last point (i.e. the cumulative after the full sample has been accounted for). <- Hint: This is Lift Chart
f. What would this chart ideally look like? I.e. if you had a perfect classifier, what would the chart look like?
2. Repeat (1) above for the for the logistic regression model. Which is the better model?
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