Session Ready
Exercise

Methods for trend lines

During the previous exercise, you used ggplot2's defult geom_smooth(). During this exercise, you will use a glm() instead. This will allow you to "see" a logistic regression with ggplot2. Specifically, you plot the probability someone takes the bus given their commute distance.

You will need to tell geom_smooth() to use the glm() method. Recall from Chapter 2 that the default family for a glm() is a Gaussian family, which produces the same results as a lm(). Thus, you will also need to specify the method argument from glm().
The code for creating gg_jitter, which you built in the last exercise, has been provided for you.

Instructions
100 XP
  • Use the "glm" method with geom_smooth().
  • With the method.args, set the family to 'binomial'.