Illustration of two-sample Kolmogorov-Smirnov test: Data from Table 5.7 p180 in text (Salivation Rates With/Without Feedback.) Sample 1 (Xs, m=10, Xbar=4.215) -0.15 8.60 5.00 3.71 4.29 7.74 2.48 3.25 -1.15 8.38 Sample 2 (Ys, n=10, Ybar=1.892) 2.55 12.07 0.46 0.35 2.69 -0.94 1.73 0.73 -0.35 -0.37 After sorting each sample: Sample 1 -1.15 -0.15 2.48 3.25 3.71 4.29 5.00 7.74 8.38 8.60 Sample 2 -0.94 -0.37 -0.35 0.35 0.46 0.73 1.73 2.55 2.69 12.07 Samples sorted together (3rd column is Group: X=0, Y=1) Columns are Ordinal,Value,Group 1 -1.15 0 2 -0.94 1 3 -0.37 1 4 -0.35 1 5 -0.15 0 6 0.35 1 7 0.46 1 8 0.73 1 9 1.73 1 10 2.48 0 11 2.55 1 12 2.69 1 13 3.25 0 14 3.71 0 15 4.29 0 16 5.00 0 17 7.74 0 18 8.38 0 19 8.60 0 20 12.07 1 Calculation of maximum absolute difference of empirical distribution functions: J2 = max_t |F_{m,X}(t) - F_{n,Y}(t)| Increment for X: xadd=0.10 for Y: yadd=-0.10 Multiplied by LCM=10: xad2=1 for yad2=-1f Table used to calculate J = LCM*J2: Columns are Ordinal,Value,Group, Term,Diffsum,Maxdif, New? 1 -1.15 0 1 1 1 1 2 -0.94 1 -1 0 1 0 3 -0.37 1 -1 -1 1 0 4 -0.35 1 -1 -2 2 1 5 -0.15 0 1 -1 2 0 6 0.35 1 -1 -2 2 0 7 0.46 1 -1 -3 3 1 8 0.73 1 -1 -4 4 1 9 1.73 1 -1 -5 5 1 10 2.48 0 1 -4 5 0 11 2.55 1 -1 -5 5 0 12 2.69 1 -1 -6 6 1 13 3.25 0 1 -5 6 0 14 3.71 0 1 -4 6 0 15 4.29 0 1 -3 6 0 16 5.00 0 1 -2 6 0 17 7.74 0 1 -1 6 0 18 8.38 0 1 0 6 0 19 8.60 0 1 1 6 0 20 12.07 1 -1 0 6 0 Maxdif=JJ for Table A10, J2=J/LCM = Maxdif of empirical distributions, Jstar for large-sample approximation: JJ_J2_Jstar = 6.0000 0.6000 1.3416 P-value for large-sample approximation by summing an infinite series: Infinite sum stopped after 3 terms (Intrinsically two-sided) approximate P-value = 0.0546 Doing nsims permutations to estimate the P-value: nsims = 100000 Number greater-than-or-equal and number of simulations: 5265 100000 95% confidence interval for simulated 2-sided P-value bracketed by estimated P-value: 0.0513 0.0527 0.0540 Compare with result of Wilcoxon Rank-Sum Test: Data with midranks: Columns are Ordinal,Value,Group, Midrank,Tiegroups 1.0000 -1.1500 0 1.0000 0 2.0000 -0.9400 1.0000 2.0000 0 3.0000 -0.3700 1.0000 3.0000 0 4.0000 -0.3500 1.0000 4.0000 0 5.0000 -0.1500 0 5.0000 0 6.0000 0.3500 1.0000 6.0000 0 7.0000 0.4600 1.0000 7.0000 0 8.0000 0.7300 1.0000 8.0000 0 9.0000 1.7300 1.0000 9.0000 0 10.0000 2.4800 0 10.0000 0 11.0000 2.5500 1.0000 11.0000 0 12.0000 2.6900 1.0000 12.0000 0 13.0000 3.2500 0 13.0000 0 14.0000 3.7100 0 14.0000 0 15.0000 4.2900 0 15.0000 0 16.0000 5.0000 0 16.0000 0 17.0000 7.7400 0 17.0000 0 18.0000 8.3800 0 18.0000 0 19.0000 8.6000 0 19.0000 0 20.0000 12.0700 1.0000 20.0000 0 Wx_Wy_Sum_ExpWx_ExpWy = 128 82 210 105 105 Wilcoxon_RankSum_Zval_NormPval = 1.7386 0.0821