चरण-दर-चरण सूचना
Gather Your Paired Data and Calculate Differences
Collect your 'before' and 'after' measurements for each subject. For every pair, calculate the difference (D) by subtracting the first measurement from the second (e.g., After - Before). Be consistent with the direction of subtraction.
Handle Zero Differences and Determine Effective 'n'
Identify any pairs where the difference (D) is zero. Exclude these pairs from your analysis. Your new sample size, 'n', will be the count of the remaining non-zero differences.
Rank the Absolute Differences
Take the absolute value of each non-zero difference (|D|). Then, rank these absolute values from smallest (rank 1) to largest. If there are ties (identical absolute differences), assign them the average of the ranks they would have received.
Assign Original Signs to Ranks and Sum Them
Reapply the original sign of each difference (D) to its corresponding rank. Then, calculate two sums: W+ (sum of all positive ranks) and W- (sum of the absolute values of all negative ranks).
Determine the Wilcoxon W Statistic
Your test statistic W is the smaller of the two sums calculated in the previous step: W = min(W+, W-). This is the value you will use for hypothesis testing.
Compare to Critical Value and Conclude
Consult a Wilcoxon Signed-Rank Test critical values table for your specific 'n' (effective sample size) and chosen significance level (alpha). If your calculated W is less than or equal to the critical value, reject the null hypothesis, indicating a statistically significant difference.
The Wilcoxon Signed-Rank Test is a powerful non-parametric statistical test used to compare two related samples or repeated measurements on a single sample. It serves as an alternative to the paired t-test when the assumptions for a parametric test, such as normality of differences, are not met, or when data is ordinal. This guide will walk you through the manual calculation of the Wilcoxon Signed-Rank Test, helping you understand its underlying principles.
Understanding the Wilcoxon Signed-Rank Test
This test assesses whether there is a statistically significant difference between the medians of two paired samples. Instead of relying on the actual values of the differences, it uses the ranks of the absolute differences, weighted by their original signs. This makes it robust to outliers and suitable for data that may not follow a normal distribution.
Prerequisites for the Test
Before you begin, ensure your data meets the following criteria:
- Paired Data: You must have two measurements for each subject or unit (e.g., 'before' and 'after' scores, or measurements from two different conditions applied to the same individual).
- Ordinal or Interval Data: The data should be measured on at least an ordinal scale, meaning the order of values is meaningful.
- Non-Normal Distribution: The differences between the paired measurements are not normally distributed, or your sample size is too small to assume normality.
- Symmetry: The distribution of the differences should be symmetric around the median for valid inference, although some sources relax this assumption for larger sample sizes.
Step-by-Step Manual Calculation
Follow these steps to perform the Wilcoxon Signed-Rank Test by hand.
1. Calculate the Differences Between Paired Values
For each pair of observations, calculate the difference (D). It's crucial to be consistent with the direction of subtraction. For example, if you have 'Before' (X1) and 'After' (X2) measurements, calculate D = X2 - X1 for all pairs.
2. Handle Zero Differences
Any pair where the difference (D) is exactly zero should be excluded from your analysis. These pairs do not contribute to the observed difference between conditions. After removing them, your sample size (n) for the subsequent steps will be the number of remaining non-zero differences.
3. Calculate Absolute Differences and Assign Ranks
Take the absolute value of each non-zero difference (|D|). Then, rank these absolute differences from smallest to largest. Assign rank 1 to the smallest absolute difference, rank 2 to the next smallest, and so on.
- Handling Ties: If two or more absolute differences are identical, they are considered 'tied'. To assign ranks in case of ties, calculate the average of the ranks they would have received if they were distinct. For example, if two values are tied for ranks 3 and 4, both receive a rank of (3+4)/2 = 3.5.
4. Assign Original Signs to Ranks
Now, reapply the original sign of the difference (D) to its corresponding rank. If the original difference was positive, the rank is positive. If the original difference was negative, the rank is negative.
5. Sum Positive and Negative Ranks
Calculate two sums:
- W+: The sum of all positive ranks.
- W-: The sum of the absolute values of all negative ranks (or simply sum the negative ranks and take the absolute value of the total).
6. Determine the Wilcoxon W Statistic
The Wilcoxon W statistic (also sometimes denoted as T) is typically the smaller of the two sums calculated in the previous step:
W = min(W+, W-)
This W statistic is what you will compare against critical values to determine statistical significance.
Worked Example
Let's consider a study where 7 participants were given a new training program, and their performance scores were recorded 'Before' and 'After' the program.
| Subject | Before (X1) | After (X2) | Difference (D = X2 - X1) | Absolute Difference (|D|) | Rank of |D| | Signed Rank | | :------ | :---------- | :--------- | :----------------------- | :------------------------ | :---------- | :---------- | | 1 | 10 | 12 | +2 | 2 | 3.5 | +3.5 | | 2 | 15 | 14 | -1 | 1 | 1.5 | -1.5 | | 3 | 8 | 11 | +3 | 3 | 5.5 | +5.5 | | 4 | 12 | 15 | +3 | 3 | 5.5 | +5.5 | | 5 | 9 | 10 | +1 | 1 | 1.5 | +1.5 | | 6 | 18 | 16 | -2 | 2 | 3.5 | -3.5 | | 7 | 11 | 11 | 0 | - | - | - |
- Differences: Calculated in the 'Difference (D)' column.
- Zero Differences: Subject 7 has a difference of 0. We exclude this participant from further analysis. Our effective sample size (n) becomes 6.
- Absolute Differences & Ranks: The non-zero absolute differences are {2, 1, 3, 3, 1, 2}. Sorted, these are {1, 1, 2, 2, 3, 3}.
- For |D|=1 (tied at positions 1, 2): Rank = (1+2)/2 = 1.5
- For |D|=2 (tied at positions 3, 4): Rank = (3+4)/2 = 3.5
- For |D|=3 (tied at positions 5, 6): Rank = (5+6)/2 = 5.5
- Signed Ranks: Reapply the original signs, as shown in the 'Signed Rank' column.
- Sum Ranks:
- W+ = 3.5 + 5.5 + 5.5 + 1.5 = 16
- W- = |-1.5 + (-3.5)| = |-5| = 5
- W Statistic: W = min(16, 5) = 5.
Interpreting the W Statistic and P-Value
To determine significance, compare your calculated W statistic to a critical value from a Wilcoxon Signed-Rank Test table for your specific sample size (n, which is 6 in our example) and chosen significance level (alpha, commonly 0.05). For a two-tailed test with n=6 and α=0.05, the critical value (T_crit) is 2.
- Decision Rule: If your calculated W statistic is less than or equal to the critical value (W ≤ T_crit), you reject the null hypothesis. The null hypothesis states there is no difference between the paired measurements.
In our example, W = 5. Since 5 > 2, we fail to reject the null hypothesis. This suggests there is no statistically significant difference in performance scores before and after the training program at the 0.05 significance level.
Normal Approximation for Larger N
For larger sample sizes (typically n > 20), you can use a normal approximation to calculate a Z-score and corresponding p-value. The formulas are:
- Mean (μ_W) = n(n+1)/4
- Standard Deviation (σ_W) = sqrt([n(n+1)(2n+1)]/24)
- Z = (W - μ_W) / σ_W (where W is typically W+ for this approximation, possibly with a continuity correction of -0.5 in the numerator).
Common Pitfalls to Avoid
- Incorrect Handling of Ties: Always use the average rank for tied absolute differences. Failing to do so will lead to incorrect W values.
- Excluding Zero Differences: Remember to remove pairs with zero differences and adjust your 'n' accordingly. These pairs provide no information about the direction of change.
- Confusing W+ and W-: While both are calculated, the W statistic for comparison is typically the smaller of the two sums (W+ or W-).
- Misinterpreting the Decision Rule: Be clear on whether your test table requires W to be less than or greater than the critical value for significance. Most tables for the W (or T) statistic use a 'less than or equal to' rule for rejection.
- Assuming Normality: Do not use the Wilcoxon Signed-Rank Test if your differences are normally distributed and you have a sufficient sample size; the paired t-test would be more powerful.
When to Use a Calculator
While understanding the manual calculation is crucial, statistical calculators or software become invaluable in several scenarios:
- Large Sample Sizes: Manual calculation for n > 15-20 becomes extremely tedious and prone to errors, especially with ties.
- Precise P-Values: Tables often provide only critical values for common alpha levels. Calculators can provide exact p-values, offering more nuanced insights into the strength of evidence against the null hypothesis.
- Verification: After performing a manual calculation, a calculator can quickly verify your results.
- Complex Tie Structures: When many values are tied, manual ranking can become cumbersome.
By understanding the manual process, you gain a deeper appreciation for how the Wilcoxon Signed-Rank Test works, allowing you to interpret results from calculators and software with greater confidence.