1. Learn
  2. /
  3. Courses
  4. /
  5. Supervised Learning in R: Regression

Connected

Exercise

Modeling with categorical inputs

For this exercise, you will fit a linear model to the flowers data, to predict Flowers as a function of Time and Intensity.

The model formula fmla that you created in the previous exercise is still available, as is the model matrix mmat.

Instructions

100 XP
  • Use fmla and lm to train a linear model that predicts Flowers from Intensity and Time. Assign the model to the variable flower_model.
  • Use summary() to remind yourself of the structure of mmat.
  • Use summary() to examine the flower_model. Do the variables match what you saw in mmat?
  • Use flower_model to predict the number of flowers. Add the predictions to flowers as the column predictions.
  • Fill in the blanks to plot predictions vs. actual flowers (predictions on the x-axis).