Exercise

Distribution of errors

Almost no real-world process can be predicted perfectly. A desirable outcome is that the error is normally distributed. This means that some actual values will be above your prediction, and some will fall below it. That is, the errors (i.e. the difference between the actual values and predictions) will seem to "float" randomly around zero.

In this exercise, you will analyze results from a pre-built linear model which predicts a police officer's salary. You will then look at the error and see if it is approximately normally distributed. The predictions are a list of values stored in preds, and the actual salaries are a list of values stored in salaries.

Instructions

100 XP
  • Compute the error as the actual salaries minus the predicted salaries.
  • Plot the errors in a histogram.
  • Conduct an Anderson-Darling test of normality for the errors.
  • Find and print the significance_level(s) at which the null hypothesis would be rejected.