What is Statistical Hypothesis Test?
In statistics, hypothesis test is used to test the quality of an assumption. By this test we can interpret whether the assumption made is true to factual data and situation or violates the facts.
This test is called STATISTICAL HYPOTHESIS TESTING.
Currently there are hundreds of statistical hypothesis testing but in this post we are going to see few of them which are most used.
Following is the flowchart that describes the types which we will discuss in this post :
1. NORMALITY TEST
This statistical test helps you check whether your data has Gaussian Distribution or not.
This test again has 3 different types in it :
1.1 Shapiro-Wilk Test
Python code for this test :
# Example of the Shapiro-Wilk Normality Test from scipy.stats import shapiro data = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869] stat, p = shapiro(data) print('stat=%.3f, p=%.3f' % (stat, p)) if p > 0.05: print('Probably Gaussian') else: print('Probably not Gaussian')
1.2 D Agostino's K^2 Test
Python code for this test :
# Example of the D'Agostino's K^2 Normality Test from scipy.stats import normaltest data = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869] stat, p = normaltest(data) print('stat=%.3f, p=%.3f' % (stat, p)) if p > 0.05: print('Probably Gaussian') else: print('Probably not Gaussian')
1.3 Anderson-Darling Test
Python code for the test :
# Example of the Anderson-Darling Normality Test from scipy.stats import anderson data = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869] result = anderson(data) print('stat=%.3f' % (result.statistic)) for i in range(len(result.critical_values)): sl, cv = result.significance_level[i], result.critical_values[i] if result.statistic < cv: print('Probably Gaussian at the %.1f%% level' % (sl)) else: print('Probably not Gaussian at the %.1f%% level' % (sl))
Python codes about other tests shall be discussed in upcoming posts.
To be continued ....
Top comments (0)