Session Ready
Exercise

Calculate RMSE

In this exercise you will calculate the RMSE of your unemployment model. In the previous coding exercises, you added two columns to the unemployment dataset:

  • the model's predictions (predictions column)
  • the residuals between the predictions and the outcome (residuals column)

You can calculate the RMSE from a vector of residuals, \(res\), as:

$$ RMSE = \sqrt{\operatorname{mean}(res^2)} $$

You want RMSE to be small. How small is "small"? One heuristic is to compare the RMSE to the standard deviation of the outcome. With a good model, the RMSE should be smaller.

Instructions
100 XP

The data frame unemployment is in your workspace.

  • Review the unemployment data from the previous exercise.
  • For convenience, assign the residuals column from unemployment to the variable res.
  • Calculate RMSE: square res, take its mean, and then square root it. Assign this to the variable rmse and print it.
    • Tip: you can do this in one step by wrapping the assignment in parentheses: (rmse <- ___)
  • Calculate the standard deviation of female_unemployment and assign it to the variable sd_unemployment. Print it. How does the rmse of the model compare to the standard deviation of the data?