from scipy import stats
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(82154321)
g_normal = stats.norm.freeze(scale=1) # Gaussian with sigma = 1
g_wide = stats.norm.freeze(scale=1.4) # Gaussian with sigma = 1.4
# generate data from wide Gaussian
x = g_wide.rvs(size=100)
# plot generated data and the two distributions
plt.hist(x, bins=20, histtype='step', density=True);
xv = np.linspace(-4, 4, 100)
plt.plot(xv, g_normal.pdf(xv), color='blue')
plt.plot(xv, g_wide.pdf(xv), color='red')
Can you reject the hypothesis that the data come from a standard normal distribution at a 95\% confidence level?
# your code here
# hint: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kstest.html