Session Ready
Exercise

Fitting a linear regression model

The parsnip package provides a unified syntax for the model fitting process in R.

With parsnip, it is easy to define models using the various packages, or engines, that exist in the R ecosystem.

In this exercise, you will define a parsnip linear regression object and train your model to predict selling_price using home_age and sqft_living as predictor variables from the home_sales data.

The home_training and home_test tibbles that you created in the previous lesson have been loaded into this session.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Initialize a linear regression object, linear_model, with the appropriate parsnip function.
  • Use the lm engine.
  • Set the mode to regression.