Experimental Design in Python
James Chapman
Curriculum Manager, DataCamp
$$ {z} = \frac{x-\mu}{\sigma}$$
sns.displot(data=salaries,
x='salary',
kind="kde")
plt.show()
QQ plot: compare data to a particular distribution
from statsmodels.graphics.gofplots import qqplot
from scipy.stats.distributions import norm
qqplot(salaries['salary'],
line='s',
dist=norm)
plt.show()
$H_0$ = "Data is drawn from a Normal Distribution"
from scipy.stats import shapiro alpha = 0.05
stat, p = shapiro(salaries['salary']) print(f"p: {round(p,4)} test stat: {round(stat,4)}")
p: 0.8293 test stat: 0.9956
p
> alpha
from scipy.stats import anderson
result = anderson(x=salaries['salary'], dist="norm")
print(round(result.statistic,4))
print(result.significance_level)
print(result.critical_values)
0.2748
[15. 10. 5. 2.5 1. ]
[0.572 0.651 0.781 0.911 1.084]
0.2748
< [0.572 0.651 0.781 0.911 1.084]
Experimental Design in Python