Exercise 11: Logistic Regression
Logistic Regression
Suppose we collect data for a group of students in a statistics class with variables \(X_1 =\)hours studied, \(X_2 =\)undergrad GPA, and \(Y =\)receive an A. We fit a logistic regression and produce estimated coefficient, \(\hat{\beta_0} = −6\), \(\hat{\beta_1} = 0.05\), \(\hat{\beta_2} = 1\).
Estimate the probability that a student who studies for 40 hours and has an undergrad GPA of 3.5 gets an A in the class.
How many hours would the student in part (a) need to study to have a 50% chance of getting an A in the class?
Split the
Boston
data set into training (80%) and test sets (20%).Using the training set, fit logistic regression to predict whether a given census tract in the test set has a crime rate above or below the median.