To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com. Data in Table 3.1 page 39 EXPANDED DATA MATRIX: Columns are Patient number, Before (X_i), After (Y_i), Z_i=Y_i-X_i, and 1 if Z_i>0, 0 if Z_i<0 dd = 1.0000 1.8300 0.8780 -0.9520 0 2.0000 0.5000 0.6470 0.1470 1.0000 3.0000 1.6200 0.5980 -1.0220 0 4.0000 2.4800 2.0500 -0.4300 0 5.0000 1.6800 1.0600 -0.6200 0 6.0000 1.8800 1.2900 -0.5900 0 7.0000 1.5500 1.0600 -0.4900 0 8.0000 3.0600 3.1400 0.0800 1.0000 9.0000 1.3000 1.2900 -0.0100 0 SIGN-TEST ANALYSIS: N=Sample Size, B=Sign Test Score, P=2-sided binomial P-value: N_B_Pval = 9.0000 2.0000 0.1797 Large-sample normal-approximation test for binomial probability: Zval_Pval = -1.6667 0.0956 Note that the large-sample approximation for the sign test is not very accurate. The HODGES-LEHMANN estimator for theta for After=Before+theta for the sign test is the median of the Z_i values: Zmean is the mean of the Z=Y-X values. Zmean_BMed = -0.4319 -0.4900 WILCOXON SIGNED RANK TEST: Drop X and Y columns, add Abs(Z) Columns are Ordinal, Z, Sgn(Z), and Abs(Z) ddx = 1.0000 -0.9520 0 0.9520 2.0000 0.1470 1.0000 0.1470 3.0000 -1.0220 0 1.0220 4.0000 -0.4300 0 0.4300 5.0000 -0.6200 0 0.6200 6.0000 -0.5900 0 0.5900 7.0000 -0.4900 0 0.4900 8.0000 0.0800 1.0000 0.0800 9.0000 -0.0100 0 0.0100 SORT the matrix by its FOURTH column = Abs(Z): Then ADD a FIFTH column that are the signed ranks ddx = 9.0000 -0.0100 0 0.0100 1.0000 8.0000 0.0800 1.0000 0.0800 2.0000 2.0000 0.1470 1.0000 0.1470 3.0000 4.0000 -0.4300 0 0.4300 4.0000 7.0000 -0.4900 0 0.4900 5.0000 6.0000 -0.5900 0 0.5900 6.0000 5.0000 -0.6200 0 0.6200 7.0000 1.0000 -0.9520 0 0.9520 8.0000 3.0000 -1.0220 0 1.0220 9.0000 Data in ORIGINAL ORDER (by sorting on Pat.Number): Columns are Pat.Number, Z, Sgn, Abs(Z), and Rank ddx = 1.0000 -0.9520 0 0.9520 8.0000 2.0000 0.1470 1.0000 0.1470 3.0000 3.0000 -1.0220 0 1.0220 9.0000 4.0000 -0.4300 0 0.4300 4.0000 5.0000 -0.6200 0 0.6200 7.0000 6.0000 -0.5900 0 0.5900 6.0000 7.0000 -0.4900 0 0.4900 5.0000 8.0000 0.0800 1.0000 0.0800 2.0000 9.0000 -0.0100 0 0.0100 1.0000 Tplus_Tmean_Tstd = 5.0000 22.5000 8.4410 LARGE-SAMPLE NORMAL APPROXIMATION for two-sided Wilcoxon signed-rank P-value for H_0:theta=0: Zval_Pval = -2.0732 0.0382 SIMULATING THE TRUE Wilcoxon Signed-Rank P-VALUE: Using NSIMS random permutations: Nsims = 10000 INITIALIZING the random-number generator at Wseed = 2.1013e+005 FINISHED NSIMS simulations SIMULATED value for true 2-sided P-value: NLessEq=193 Nsims=10000 Pvalue=0.03860 (2-sided) 95%% Confidence Interval for true P-value (with Estimate in middle): Plow_PEst_Phigh = 0.0332 0.0386 0.0440 The HODGES-LEHMANN estimator for theta for After=Before+theta for the Wilcoxon signed-rank test is the median of the Walsh averages W_k=(Z_i+Z_j)/2: Walsh averages (not in order; n=9, nwa=45, nrows=5): -0.952 -0.403 -0.987 -0.691 -0.786 -0.771 -0.721 -0.436 -0.481 0.147 -0.438 -0.142 -0.236 -0.221 -0.171 0.114 0.069 -1.022 -0.726 -0.821 -0.806 -0.756 -0.471 -0.516 -0.430 -0.525 -0.510 -0.460 -0.175 -0.220 -0.620 -0.605 -0.555 -0.270 -0.315 -0.590 -0.540 -0.255 -0.300 -0.490 -0.205 -0.250 0.080 0.035 -0.010 SORTED Walsh averages (n=9, nwa=45, nrows=5): ( 1) -1.022 -0.987 -0.952 -0.821 -0.806 -0.786 -0.771 -0.756 -0.726 -0.721 (11) -0.691 -0.620 -0.605 -0.590 -0.555 -0.540 -0.525 -0.516 -0.510 -0.490 (21) -0.481 -0.471 -0.460 -0.438 -0.436 -0.430 -0.403 -0.315 -0.300 -0.270 (31) -0.255 -0.250 -0.236 -0.221 -0.220 -0.205 -0.175 -0.171 -0.142 -0.010 (41) 0.035 0.069 0.080 0.114 0.147 Zmean_MedZ_MedWav = -0.4319 -0.4900 -0.4600 EXACT CONFIDENCE INTERVALS based on the Wilcoxon signed-rank statistic: Estimator: -0.46 Table A4 for n=9 (n*(n+1)/2=45) has: P(T+ ge 39)=0.027 P(T+ ge 40)=0.020 P(T+ ge 41)=0.014 P(T+ ge 42)=0.010 P(T+ ge 43)=0.006 Exact symmetric confidence intervals for theta: (-0.771, -0.142) x=39 94.6% CI (-0.786, -0.010) x=40 96.0% CI (-0.806, 0.035) x=41 97.2% CI (-0.821, 0.069) x=42 98.0% CI (-0.952, 0.080) x=43 98.8% CI