Wilcoxon signed-rank test and associated Hodges-Lehmann estimator and confidence interval - written by XXXXX. Data: Hamilton Depression Scale Factor IV (Salsburg 1970) See the text (Hollander+Wolfe 2nd ed) Table 3.1, page 39 Scale values before and after treatment for 9 patients. Program ONESAMP_RANKS - January 23, 2007 N=9 observations: No. Before After Diff(After-Before) Sign: 1. 1.830 0.878 -0.952 - 2. 0.500 0.647 0.147 + 3. 1.620 0.598 -1.022 - 4. 2.480 2.050 -0.430 - 5. 1.680 1.060 -0.620 - 6. 1.880 1.290 -0.590 - 7. 1.550 1.060 -0.490 - 8. 3.060 3.140 0.080 + 9. 1.300 1.290 -0.010 - Is there a significant decrease in the Depression Scale after treatment? A significant difference? Classical one-sample t-test (n=9) for X=After-Before: Mean=-0.432 Stdev(Mean)=0.142 T=-3.035 P=0.0162 2-sided t-test, df=8 Wilcoxon signed rank analysis: Assuming that there are no entries with difference=0 and that there are no tied absolute values. Sorting by absolute differences (n=9) and assigning ranks based on abs.value of differences: 1. 1.300 1.290 -0.010 - 1 2. 3.060 3.140 0.080 + 2 3. 0.500 0.647 0.147 + 3 4. 2.480 2.050 -0.430 - 4 5. 1.550 1.060 -0.490 - 5 6. 1.880 1.290 -0.590 - 6 7. 1.680 1.060 -0.620 - 7 8. 1.830 0.878 -0.952 - 8 9. 1.620 0.598 -1.022 - 9 Restore original order by bubble sort on ord[]: 1. 1.830 0.878 -0.952 - 8 2. 0.500 0.647 0.147 + 3 3. 1.620 0.598 -1.022 - 9 4. 2.480 2.050 -0.430 - 4 5. 1.680 1.060 -0.620 - 7 6. 1.880 1.290 -0.590 - 6 7. 1.550 1.060 -0.490 - 5 8. 3.060 3.140 0.080 + 2 9. 1.300 1.290 -0.010 - 1 Wilcoxon signed rank statistics: T+=5 T-=40 Sum = 45 = 9*10/2 Exact P-value for Wilcoxon signed rank T+=5 by counting cases: P = (1(0)+5(1)+4(2))/512 = 10/512 = 0.0195 (one-sided) P = 0.0391 (two-sided) Large-sample Z-test for WSR statistic (assuming no ties): E(T-) = E(T+) = 9*10/4 = 22.5 Z=(40-22.5)/sqrt(9*10*19/24)=2.07322 P=0.0382 (two-sided) Hodges-Lehmann Wilcoxon signed-rank values: Median of Walsh averages(n=45)=-0.4600 Sorted Walsh averages (n=45): -1.0220 -0.9870 -0.9520 -0.8210 -0.8060 -0.7860 -0.7710 -0.7560 -0.7260 -0.7210 -0.6910 -0.6200 -0.6050 -0.5900 -0.5550 -0.5400 -0.5250 -0.5160 -0.5100 -0.4900 -0.4810 -0.4710 -0.4600(*) -0.4375 -0.4360 -0.4300 -0.4025 -0.3150 -0.3000 -0.2700 -0.2550 -0.2500 -0.2365 -0.2215 -0.2200 -0.2050 -0.1750 -0.1715 -0.1415 -0.0100 0.0350 0.0685 0.0800 0.1135 0.1470 Critical value tt=T+(alpha/2,9) for 1-alpha closest to 0.95: P[T+(9) >= 39] = 0.0270 (94.6% CI) WSR test CI offsets in (1,2,...,45): (7,39) WSR test CI offsets in (0,1,...,44): (6,38) -1.0220 -0.9870 -0.9520 -0.8210 -0.8060 -0.7860 -0.7710(*) -0.7560 -0.7260 -0.7210 -0.6910 -0.6200 -0.6050 -0.5900 -0.5550 -0.5400 -0.5250 -0.5160 -0.5100 -0.4900 -0.4810 -0.4710 -0.4600 -0.4375 -0.4360 -0.4300 -0.4025 -0.3150 -0.3000 -0.2700 -0.2550 -0.2500 -0.2365 -0.2215 -0.2200 -0.2050 -0.1750 -0.1715 -0.1415(*) -0.0100 0.0350 0.0685 0.0800 0.1135 0.1470 Nonparametric 94.6% CI: (-0.771, -0.142) Two-sided Student-t critical values: Tcrit(8,0.05)=2.7515 Tcrit(300,0.05)=1.9679 Mean=-0.4 Stderr=0.1 Twid=0.4 CIs of `average' value of differences: Sample mean(T): -0.4319 (-0.8234, -0.0404) 95% CI HL for WSR: -0.4600 (-0.7710, -0.1415) 94.6% CI