To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com. Wilcoxon Rank-Sum test for two samples: X: 23 21 22 14 23 19 15 15 16 Y: 27 27 22 21 27 28 19 20 31 24 21 23 23 21 SampleSizes_X_Y_Both = 9 14 23 Columns are Ordinal, Group number, and Values: dd = 1 1 23 2 1 21 3 1 22 4 1 14 5 1 23 6 1 19 7 1 15 8 1 15 9 1 16 10 2 27 11 2 27 12 2 22 13 2 21 14 2 27 15 2 28 16 2 19 17 2 20 18 2 31 19 2 24 20 2 21 21 2 23 22 2 23 23 2 21 The function getmidranks() was used to generate midranks and tie-group sizes Tie-group sizes for tie-groups with more than one value: Number_TieGroups_of_Size_ge_2 = 6 TieGroup Sizes of Size ge 2: 2 2 4 2 4 3 Columns are Ordinal, Group numbers, Values, and Midranks: Note: Directly displaying matrix dd would have all columns to 4 places beyond decimal point because of midranks. Instead, we use fprintf() on the rows of dd so that we can determine the format. 1. 1 23 15.5 2. 1 21 9.5 3. 1 22 12.5 4. 1 14 1.0 5. 1 23 15.5 6. 1 19 5.5 7. 1 15 2.5 8. 1 15 2.5 9. 1 16 4.0 10. 2 27 20.0 11. 2 27 20.0 12. 2 22 12.5 13. 2 21 9.5 14. 2 27 20.0 15. 2 28 22.0 16. 2 19 5.5 17. 2 20 7.0 18. 2 31 23.0 19. 2 24 18.0 20. 2 21 9.5 21. 2 23 15.5 22. 2 23 15.5 23. 2 21 9.5 Data sorted by Z-value to show tie groups (Sorted on Z-value then Group number then Ordinal as tie-breakers) Columns are Ordinal, Group number, Value, and Midrank 4. 1 14 1.0 7. 1 15 2.5 8. 1 15 2.5 9. 1 16 4.0 6. 1 19 5.5 16. 2 19 5.5 17. 2 20 7.0 2. 1 21 9.5 13. 2 21 9.5 20. 2 21 9.5 23. 2 21 9.5 3. 1 22 12.5 12. 2 22 12.5 1. 1 23 15.5 5. 1 23 15.5 21. 2 23 15.5 22. 2 23 15.5 19. 2 24 18.0 10. 2 27 20.0 11. 2 27 20.0 14. 2 27 20.0 15. 2 28 22.0 18. 2 31 23.0 WILCOXON RANK SUM SCORES: Xscore: Observed: 68.50 Expected: 108.00 Yscore: Observed: 207.50 Expected: 168.00 Difference in both cases: -39.50 Wstd_Zval_Pval_NOTIECORR = 15.8745 -2.4883 0.0128 Tiesum_TieCorr = 162.0000 0.0133 Wstd_Zval_Pval_TIECORR = 15.7683 -2.5050 0.0122 SIMULATING THE TRUE Wilcoxon Signed-Rank P-VALUE: Using NSIMS random permutations: Nsims = 10000 INITIALIZING the random-number generator at Wseed = 2.0709e+005 ASSUMING ObsWscoreX is on the LOWER TAIL: (That is, ObsWscoreX should be LESS than WExpScX) ObsWscoreX_ExpWscoreX = 68.5000 108.0000 SIMULATED value for true 2-sided P-value: NLessEq=57 Nsims=10000 Pvalue=0.01140 (2-sided) 95%% Confidence Interval for true P-value (with Estimate in middle): Plow_PEst_Phigh = 0.0084 0.0114 0.0144 The Hodges-Lehmann estimator for theta for Y=X+theta is the median of the Mann-Whitney differences W_k=Y_i-X_j: Mann-Whitney differences (n=23, nmwd=126, nrows=13): 4 4 -1 -2 4 5 -4 -3 8 1 -2 0 0 -2 6 6 1 0 6 7 -2 -1 10 3 0 2 2 0 5 5 0 -1 5 6 -3 -2 9 2 -1 1 1 -1 13 13 8 7 13 14 5 6 17 10 7 9 9 7 4 4 -1 -2 4 5 -4 -3 8 1 -2 0 0 -2 8 8 3 2 8 9 0 1 12 5 2 4 4 2 12 12 7 6 12 13 4 5 16 9 6 8 8 6 12 12 7 6 12 13 4 5 16 9 6 8 8 6 11 11 6 5 11 12 3 4 15 8 5 7 7 5 SORTED M-W differences (n=23, nmwd=126, nrows=13): ( 1) -4 -4 -3 -3 -3 -2 -2 -2 -2 -2 ( 11) -2 -2 -2 -1 -1 -1 -1 -1 -1 0 ( 21) 0 0 0 0 0 0 0 0 1 1 ( 31) 1 1 1 1 2 2 2 2 2 2 ( 41) 3 3 3 4 4 4 4 4 4 4 ( 51) 4 4 4 4 5 5 5 5 5 5 ( 61) 5 5 5 5 5 5 6 6 6 6 ( 71) 6 6 6 6 6 6 6 6 7 7 ( 81) 7 7 7 7 7 7 8 8 8 8 ( 91) 8 8 8 8 8 8 8 9 9 9 (101) 9 9 9 10 10 11 11 11 12 12 (111) 12 12 12 12 12 12 13 13 13 13 (121) 13 14 15 16 16 17 YXmeandiff_MWMedian = 5.1905 5.0000 APPROXIMATE EXACT CONFIDENCE INTERVALS based on the Wilcoxon rank-sum statistic: Estimator: 5 Normal confidence intervals for theta (Mean diff=5.19048): ( 2.16, 8.22) 95% CI ( 1.20, 9.18) 99% CI NONPARAMETRIC approximate exact CIs for theta based on the Wilcoxon rank-sum statistic: ( 1, 8) Offsets r1=31 r2= 96 95% CI ( 0, 10) Offsets r1=22 r2=105 99% CI