Created
June 17, 2020 07:21
-
-
Save GermanCM/73423c411370d18d3eb1f2554c9692ae to your computer and use it in GitHub Desktop.
Normality check Shapiro-Wilk test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy.random import seed | |
from numpy.random import randn | |
from scipy.stats import shapiro | |
''' | |
24.5.2 Shapiro-Wilk Test | |
The Shapiro-Wilk test evaluates a data sample and quanties how likely it is that the data | |
was drawn from a Gaussian distribution | |
''' | |
# normality test | |
stat, p = shapiro(sample_singles) | |
print('Statistics=%.3f, p=%.3f' % (stat, p)) | |
# interpret | |
alpha = 0.05 | |
if p > alpha: | |
print('Sample looks Gaussian (fail to reject H0)') | |
else: | |
print('Sample does not look Gaussian (reject H0)') | |
#source: https://machinelearningmastery.com/statistics_for_machine_learning/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment