BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Foundations of Inference in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Compute the error as actual minus predicted salary
error = ____

# Plot the errors as a histogram
plt.____(____)
plt.show()

# Conduct an Anderson-Darling test using the years of experience
result = ____(____)

# Find where the result is significant
print(result.____[result.____ > result.____])
Kodu Düzenle ve Çalıştır