Answers for "scipy hypothesis test for normal distribution"

0

scipy hypothesis test for normal distribution

>>> from scipy import stats
>>> pts = 1000
>>> np.random.seed(28041990)
>>> a = np.random.normal(0, 1, size=pts)
>>> b = np.random.normal(2, 1, size=pts)
>>> x = np.concatenate((a, b))
>>> k2, p = stats.normaltest(x)
>>> alpha = 1e-3
>>> print("p = {:g}".format(p))
p = 3.27207e-11
>>> if p < alpha:  # null hypothesis: x comes from a normal distribution
...     print("The null hypothesis can be rejected")
... else:
...     print("The null hypothesis cannot be rejected")
The null hypothesis can be rejected
Posted by: Guest on November-19-2020

Code answers related to "scipy hypothesis test for normal distribution"

Python Answers by Framework

Browse Popular Code Answers by Language