Foundations of Inference in Python
Paul Savala
Assistant Professor of Mathematics


Expect equal distribution above and below prediction


$H_0$: Data is normally distributed
$H_a$: Data is not normally distributed
result = stats.anderson(police_df['Annual Salary'])result.statistic
27.41
result.critical_values
[0.574, 0.654, 0.784, 0.915, 1.088]
result.significance_level[result.statistic > result.critical_values]
[15.  10.   5.   2.5  1. ]
  mu, std = stats.norm.fit(police_df['Annual Salary'])estimated_pct_under_70k = stats.norm.cdf(70000, loc=mu, scale=std)print(estimated_pct_under_70k)
0.27
actual_under_70k = police_df[police_df['Annual Salary'] < 70000]print(len(actual_under_70k) / len(police_df))
0.20
  Foundations of Inference in Python