I have a homework in a subject called "Non-parametric statistics", and it's causing me some difficulties at the moment. So I would be very glad if you could help me or give me some ideas. The task is as follows:
Pulse is being measured twice on the same test group - first at rest state and then after a 15-minute walk. We're interested to find out whether the pulse is different before and after the walk.
We have 4 observations. The task is to find all posible probabilities of significance for two-sided hypothesis (H0: the distribution of pulse doesn't change) using a) sign test and b) Wilcoxon rank sum test. Besides of finding the probabilities, a complete solution must be included.
Suppose pulse rates are 58, 75, 62 and 63 initially, for subjects 1, 2, 3, 4. Also, that their respective pulse rates are 63, 80, 71 and 77 after walking.
Sign test. We can see immediately that the pulse rate increased for all four subjects--the signs of all four differences, After - Before, are positive. Considering subjects to be independent, we can use the binomial distribution $\mathsf{Binom}(n=4, p=.5)$ as the distribution of the number of positive differences ("Successes") under the null hypothesis that $p = .5$ (increases and decreases are equally likely). The distribution of $X$ is given by the table:
The P-value for our data is $2(1/16) = 1/8.$ (The P-value is the probability under this null distribution of obtaining a result as far away from the expected 2 Successes and 2 Failures as our result.)
Usually, one requires a P-value below 5% in order to reject the null hypothesis. A design with four subjects is not adequate to get such a small P-value. So there is no way for the sign test to reject the null hypothesis (and thus give convincing evidence that walking changes pulse rate).
Note: If we had $n = 6$ subjects, all with increased pulse rates, then the P-value for the two-sided alternative would be $2(1/64) = 1/32 < 5\%$
Wilcoxon Signed-Rank Test: This test looks at the absolute values of After - Before differences and ranks them (with half-ranks for ties). Our (absolute) differences are 5, 5, 19, 14, and the corresponding ranks are 1.5, 1.5, 4, 3.
Next, the procedure is to sum the ranks corresponding to differences that are positive (for our data, all of them). Different sofware packages and texts have slightly different methods of doing the rest of the test, so I can't say exactly what your text does. Here is the result of the Wilcoxon Signed-Rank test is R statistical software:
R gives a provisional P-value of 0.975 < .05 showing that we cannot reject the null hypothesis. On account of the tie, R does not try to give an exact P-value.
Here are results from Minitab:
Minitab shows a P-value = 0.1, which makes some attempt to deal with the tie, but still does not lead to rejection.
In any case, even with four differences all of them positive, the Wilcoxon Signed-Rank test cannot have a small enough P-value to find a significant difference between pulse rates Before and After walking.
Paired t test. If we are willing to assume that differences in pulse rates are normally distributed, we can also use a paired t test. Here are results from R:
The assumption of normality adds information, and so we get a smaller P-value here. Still not quite enough to reject at the 5% level of significance.
Note: If the values after walking had been 65, 82, 71, 77, then the sign test and the Wilcoxon Signed-Rank test would give exactly the same P-values (and error message) as before, but the t test would be significant at the 5% level with P-value= 0.028.
Summary: In summary, four subjects are not enough for either the Sign test or the Wilcoxon Signed-Rank to give a significant result no matter what the data. These tests are less powerful than a paired t test because they look only at the signs or the relative ranks of the four individual differences, whereas the t test looks at the actual pulse rate values (assuming they are normal).