Get startedGet started for free

R squared plot

In the previous exercise, you got an R squared value of 0.651. The R squared metric ranges from 0 to 1, 0 being the worst and 1 the best.

Calculating the R squared value is only the first step in studying your model's predictions.

Making an R squared plot is extremely important because it will uncover potential problems with your model, such as non-linear patterns or regions where your model is either over or under-predicting the outcome variable.

In this exercise, you will create an R squared plot of your model's performance.

The home_test_results tibble has been loaded into your session.

This exercise is part of the course

Modeling with tidymodels in R

View Course

Exercise instructions

  • Create an R squared plot of your model's performance. The x-axis should have the actual selling price and the y-axis should have the predicted values.
  • Use the appropriate functions to add the line y = x to your plot and standardize the range of both axes.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create an R squared plot of model performance
ggplot(___, aes(x = ___, y = ___)) +
  geom_point(alpha = 0.5) + 
  ___(color = 'blue', linetype = 2) +
  ___ +
  labs(x = 'Actual Home Selling Price', y = 'Predicted Selling Price')
Edit and Run Code