Fitting a multiple logistic regression
In the video, you learned about fitting a regression with two different predictor variables. In this exercise, you'll get to build the model we talked about. The distance a commuter rides might be important in determining if they are more likely to ride the bus. Similarly, the number of days a commuter goes to work might be important in determining if they are more likely to ride the bus. Using this model, we will examine how this variables may be used to predict the chance a commuter rides the bus.
This exercise is part of the course
Generalized Linear Models in R
Exercise instructions
- Build a logistic regression using the
bus
data frame. Save the output asbus_both
. - Predict if someone rides the
Bus
based upon bothCommuteDays
andMilesOneWay
. Make sure you use the variables in this order in the formula.. - Use
summary()
onbus_both
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Build a logistic regression with Bus predicted by CommuteDays and MilesOneWay
___
# Look at the summary of the output
___