![]() |
VOOZH | about |
Statistical significance tests helps find out whether results we see in data are real or just happened by chance. They are used to check if differences or patterns in data are meaningful. SciPy’s scipy.stats module helps to perform these tests using simple Python functions. These tests are useful in research, experiments and data analysis.
Before running any test, it's essential to understand following key terms:
If p-value ≤ α -> reject H₀ (there is a significant effect)
If p-value > α -> fail to reject H₀ (no significant effect found)
Some of widely used statistical significance tests are listed below. Each test serves a specific purpose in analyzing data and checking for meaningful patterns or differences.
Hypothesis testing is a way to make decisions or predictions using data. It helps check if a certain assumption (called a hypothesis) about a population is likely to be true based on sample data.
Example: This example tests whether average weight of a product is significantly different from 50 grams using sample data.
Output
T-statistic: -0.0882
P-value: 0.9339
The null hypothesis is not rejected. No significant difference from 50.
Explanation:
T-test is a type of hypothesis test used to compare averages (means) of two groups. It helps find out if difference between two group means is real or just happened by chance. The t-test works best when data is small and follows a shape similar to a normal distribution (called t-distribution).
Example: A restaurant wants to test whether adding chipotle sauce to a dish has affected its average sales. Two sets of sales data are collected: one with chipotle and one without.
Output
T-statistic: 0.1846
P-value: 0.8552
The null hypothesis is not rejected. Chipotle sauce does not have a significant effect on sales.
Explanation:
Kolmogorov–Smirnov test is a statistical test used to check whether a dataset follows a specific distribution. It is often used to test if data is normally distributed or uniformly distributed or to compare two distributions.
Note: This test is valid only for continuous distributions.
Example: In this example, a dataset of 1000 values is randomly generated from a uniform distribution. The one sample KS test is used to check whether data really follows a uniform distribution.
Output
K–S Test Statistic: 0.0277
P-value: 0.4194
The null hypothesis is not rejected.
Conclusion: The data likely follows a uniform distribution.
Explanation:
Normality tests help check whether data follows a normal (bell-shaped) distribution. Two common indicators are:
Skewness: Measures symmetry of the distribution.
Kurtosis: Measures how heavy or light the tails are compared to normal.
Example: This example checks if the given data is normally distributed by calculating skewness and kurtosis using scipy.stats.describe().
Output
Skewness: -0.2234
Kurtosis: 3.0771
Explanation: