Non-parametric Tests
Non-parametric tests are statistical methods used when the assumptions required for parametric tests, such as normality and homogeneity of variance, are not met. These tests do not rely on the underlying distribution of the data, making them more flexible and robust for analyzing data that does not conform to the assumptions of traditional parametric tests. This article explores some of the most commonly used non-parametric tests, including the Mann-Whitney U Test, Wilcoxon Signed-Rank Test, and Kruskal-Wallis H Test. We will also discuss when and how to apply these tests, providing detailed examples for each.
Understanding Non-parametric Tests
What Are Non-parametric Tests?
Non-parametric tests are statistical methods that do not assume a specific distribution for the data. Unlike parametric tests (such as T-tests or ANOVA), which assume that the data follows a normal distribution, non-parametric tests can be used with data that is skewed, ordinal, or has outliers.
When to Use Non-parametric Tests
Non-parametric tests are appropriate in the following situations:
- Non-normal Distribution: When the data is not normally distributed and cannot be transformed to normality.
- Ordinal Data: When the data is ordinal (ranked) rather than interval or ratio.
- Small Sample Sizes: When the sample size is too small to reliably estimate the parameters of a normal distribution.
- Presence of Outliers: When the data contains outliers that cannot be removed or transformed.
- Heterogeneity of Variance: When the variances across groups are not equal.
Common Non-parametric Tests
Mann-Whitney U Test
Overview
The Mann-Whitney U Test (also known as the Wilcoxon rank-sum test) is a non-parametric test used to compare the medians of two independent groups. It is an alternative to the independent two-sample T-test when the assumption of normality is not met.
Example: Comparing Test Scores
Problem Setup:
Suppose you want to compare the test scores of two groups of students who used different study methods. The data is not normally distributed, so you decide to use the Mann-Whitney U Test. You have the following data:
- Group A: [85, 88, 78, 92, 85, 87, 90, 91]
- Group B: [78, 82, 85, 80, 88, 84, 86, 85]
Step 1: State the Hypotheses
- Null Hypothesis : The distributions of the two groups are the same.
- Alternative Hypothesis : The distributions of the two groups are different.
Step 2: Rank the Data
Rank all the scores from both groups together, from lowest to highest. If there are tied ranks, assign the average rank to each tied value.
Score | Group | Rank |
---|---|---|
78 | A | 1 |
78 | B | 1 |
80 | B | 3 |
82 | B | 4 |
84 | B | 5 |
85 | A | 6.5 |
85 | A | 6.5 |
85 | B | 6.5 |
85 | B | 6.5 |
86 | B | 10 |
87 | A | 11 |
88 | A | 12 |
88 | B | 12 |
90 | A | 14 |
91 | A | 15 |
92 | A | 16 |
Step 3: Calculate the U Statistic
First, calculate the sum of ranks for each group:
Calculate the U statistic for each group using the formula:
The Mann-Whitney U statistic is the smaller of and :
Step 4: Determine the P-value
Using a Mann-Whitney U distribution table or statistical software, find the p-value corresponding to with and .
- P-value: Approximately 0.12
Since , we fail to reject the null hypothesis. There is no statistically significant difference in the distributions of the two groups at the 5% significance level.
Effect Size:
To complement the p-value, calculate the effect size using :
Assuming the Z-score corresponding to is approximately -1.31:
This indicates a medium effect size.
When to Use the Mann-Whitney U Test
- Non-normal Data: When data is not normally distributed.
- Ordinal Data: When data is ranked or ordinal.
- Small Sample Sizes: When sample sizes are small and parametric assumptions are questionable.
Wilcoxon Signed-Rank Test
Overview
The Wilcoxon Signed-Rank Test is a non-parametric test used to compare the medians of two related samples or paired observations. It is an alternative to the paired T-test when the assumption of normality is not met.
Example: Pre-Test and Post-Test Scores
Problem Setup:
Suppose you want to test whether a new teaching method improves students' test scores. You measure the scores before and after the intervention for the same group of students. The data is not normally distributed, so you decide to use the Wilcoxon Signed-Rank Test. You have the following data:
- Pre-Test Scores: [78, 82, 88, 85, 90, 87, 84, 89]
- Post-Test Scores: [82, 85, 90, 88, 92, 90, 86, 91]
Step 1: State the Hypotheses
- Null Hypothesis : The median difference between the pairs is zero.
- Alternative Hypothesis : The median difference between the pairs is not zero.
Step 2: Calculate the Differences and Rank Them
Calculate the differences between the pre-test and post-test scores for each student. Then, rank the absolute values of these differences. Ignore the pairs with zero differences.
Student | Pre-Test | Post-Test | Difference | Rank | Sign | |
---|---|---|---|---|---|---|
1 | 78 | 82 | 4 | 4 | 1 | + |
2 | 82 | 85 | 3 | 3 | 2.5 | + |
4 | 85 | 88 | 3 | 3 | 2.5 | + |
6 | 87 | 90 | 3 | 3 | 2.5 | + |
3 | 88 | 90 | 2 | 2 | 6 | + |
5 | 90 | 92 | 2 | 2 | 6 | + |
7 | 84 | 86 | 2 | 2 | 6 | + |
8 | 89 | 91 | 2 | 2 | 6 | + |
Step 3: Calculate the Test Statistic
Sum the ranks for the positive differences and for the negative differences . In this example, all differences are positive.
Since there are no negative differences, . The test statistic is the smaller of and :
Step 4: Determine the P-value
Using a Wilcoxon Signed-Rank distribution table or statistical software, find the p-value corresponding to with .
- P-value: Approximately 0.031 (one-tailed), 0.062 (two-tailed)
Since , we fail to reject the null hypothesis at the 5% significance level for a two-tailed test. However, for a one-tailed test (if you have a directional hypothesis), , and you would reject the null hypothesis, suggesting that the teaching method has a significant effect.
Effect Size:
Calculate the effect size using :
This indicates a large effect size.
When to Use the Wilcoxon Signed-Rank Test
- Non-normal Data: When paired differences are not normally distributed.
- Ordinal Data: When dealing with ranked or ordinal paired data.
- Small Sample Sizes: When sample sizes are small and parametric assumptions are questionable.
Kruskal-Wallis H Test
Overview
The Kruskal-Wallis H Test is a non-parametric test used to compare the medians of three or more independent groups. It is an extension of the Mann-Whitney U Test to more than two groups and is an alternative to one-way ANOVA when the assumption of normality is not met.
Example: Comparing Exam Scores Across Three Teaching Methods
Problem Setup:
Suppose you want to compare the exam scores of students from three different teaching methods (A, B, C). The data is not normally distributed, so you decide to use the Kruskal-Wallis H Test. You have the following data:
- Method A: [85, 87, 90, 88, 86]
- Method B: [78, 82, 80, 85, 81]
- Method C: [92, 94, 89, 95, 93]
Step 1: State the Hypotheses
- Null Hypothesis : The distributions of the three groups are the same.
- Alternative Hypothesis : At least one group has a different distribution.
Step 2: Rank the Data
Rank all the scores from all groups together, from lowest to highest. If there are tied ranks, assign the average rank to each tied value.
Score | Group | Rank |
---|---|---|
78 | B | 1 |
80 | B | 2 |
81 | B | 3 |
82 | B | 4 |
85 | A | 5.5 |
85 | B | 5.5 |
86 | A | 7 |
87 | A | 8 |
88 | A | 9 |
89 | C | 10 |
90 | A | 11 |
92 | C | 12 |
93 | C | 13 |
94 | C | 14 |
95 | C | 15 |
Step 3: Calculate the H Statistic
First, compute the group ranks and overall statistics:
-
Group A:
-
Group B:
-
Group C:
-
Overall:
Calculate the Kruskal-Wallis H statistic:
Substitute the values:
Calculate each term:
Sum them:
Now, calculate H:
Step 4: Determine the P-value
Using a chi-square distribution table or statistical software with degrees of freedom:
- P-value: Approximately 0.002
Since , we reject the null hypothesis. There is a statistically significant difference in the distributions of at least one teaching method.
Effect Size:
Calculate eta-squared :
This indicates a large effect size.
When to Use the Kruskal-Wallis H Test
- Non-normal Data: When data is not normally distributed.
- Ordinal Data: When data is ranked or ordinal.
- Multiple Independent Groups: When comparing three or more independent groups.
Summary of Non-parametric Tests
Test | Use Case | Null Hypothesis | Assumptions | Parametric Alternative |
---|---|---|---|---|
Mann-Whitney U Test | Compare medians of two independent groups | The distributions of the two groups are the same | Independent observations | Independent Two-Sample T-test |
Wilcoxon Signed-Rank Test | Compare medians of two related samples or paired observations | The median difference between pairs is zero | Paired observations | Paired T-test |
Kruskal-Wallis H Test | Compare medians of three or more independent groups | The distributions of the groups are the same | Independent observations, similar shapes | One-Way ANOVA |
Best Practices for Applying Non-parametric Tests
-
Check for Normality: Before choosing a non-parametric test, use diagnostic plots (e.g., Q-Q plots) or statistical tests (e.g., Shapiro-Wilk test) to assess whether your data meets the assumptions of normality. If not, proceed with a non-parametric test.
-
Rank Data Appropriately: For non-parametric tests like the Mann-Whitney U Test and Kruskal-Wallis H Test, ensure that the data is ranked correctly, and handle ties by assigning average ranks.
-
Consider Sample Size: While non-parametric tests are robust to violations of assumptions, they may have lower power than parametric tests, especially with small sample sizes. Consider the implications of this trade-off.
-
Use Non-parametric Tests as a Last Resort: Non-parametric tests should be used when parametric tests are not suitable due to violations of their assumptions. If possible, try to meet the assumptions of parametric tests through transformations or other data preprocessing techniques.
-
Effect Sizes: In addition to p-values, report effect sizes (e.g., Cohen’s d for Mann-Whitney U Test, eta-squared for Kruskal-Wallis H Test) to provide a measure of the magnitude of differences.
-
Interpret Results Carefully: Non-parametric tests often test for differences in distributions rather than just differences in medians. Be cautious in interpreting the results, especially in terms of what aspect of the distribution (e.g., median, shape) is being tested.
Conclusion
Non-parametric tests provide valuable tools for analyzing data that do not meet the assumptions required for parametric tests. By understanding when and how to apply methods like the Mann-Whitney U Test, Wilcoxon Signed-Rank Test, and Kruskal-Wallis H Test, you can handle a wide range of data analysis scenarios where traditional parametric approaches may fail.
These tests allow you to draw meaningful conclusions from data that is skewed, ordinal, or contains outliers, providing flexibility and robustness in your statistical analyses. By following best practices and carefully interpreting the results, you can ensure that your non-parametric tests yield reliable and insightful findings.