Session Ready
Exercise

Generating and visualizing predicted values

You have applied a Gaussian GLM to examine the relationship between feeding_events and stream_flow.

Using your model output (gaussian_glm), you can make predictions about the number of feeding_events that will be seen at varying stream_flow. Start by building a data frame containing the values of stream_flow you want to use to make predictions. Next, generate predictions of feeding_events at these values. Finally, add a line to your scatterplot of stream_flow and feeding_events that represents the model predictions, and visually assess the model.

Note that the dragonflies data set, gaussian_glm model, and ggplot2 library have been preloaded.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Create a data frame called pred_df containing 10 values of stream_flow between 1 and 5.