Illustration of two-sample Kolmogorov-Smirnov test: Data from textbook Table 4.1 p110 (2nd edn) Water Diffusion across human chorioaminon tissue X: At term (approx 39weeks, Control) Y: 12-26 weeks Sample 1 (Xs, m=10, Xbar=1.313) 0.80 0.83 1.89 1.04 1.45 1.38 1.91 1.64 0.73 1.46 Sample 2 (Ys, n=5, Ybar=0.976) 1.15 0.88 0.90 0.74 1.21 After sorting each sample: Sample 1 0.73 0.80 0.83 1.04 1.38 1.45 1.46 1.64 1.89 1.91 Sample 2 0.74 0.88 0.90 1.15 1.21 Samples sorted together (3rd column is Group: X=0, Y=1) Columns are Ordinal,Value,Group 1 0.73 0 2 0.74 1 3 0.80 0 4 0.83 0 5 0.88 1 6 0.90 1 7 1.04 0 8 1.15 1 9 1.21 1 10 1.38 0 11 1.45 0 12 1.46 0 13 1.64 0 14 1.89 0 15 1.91 0 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.20 Multiplied by LCM=10: xad2=1 for yad2=-2f Table used to calculate J = LCM*J2: Columns are Ordinal,Value,Group, Term,Diffsum,Maxdif, New? 1 0.73 0 1 1 1 1 2 0.74 1 -2 -1 1 0 3 0.80 0 1 0 1 0 4 0.83 0 1 1 1 0 5 0.88 1 -2 -1 1 0 6 0.90 1 -2 -3 3 1 7 1.04 0 1 -2 3 0 8 1.15 1 -2 -4 4 1 9 1.21 1 -2 -6 6 1 10 1.38 0 1 -5 6 0 11 1.45 0 1 -4 6 0 12 1.46 0 1 -3 6 0 13 1.64 0 1 -2 6 0 14 1.89 0 1 -1 6 0 15 1.91 0 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.0954 P-value for large-sample approximation by summing an infinite series: Infinite sum stopped after 3 terms (Intrinsically two-sided) approximate P-value = 0.1813 Doing nsims permutations to estimate the P-value: nsims = 10000 Number greater-than-or-equal and number of simulations: 1660 10000 95% confidence interval for simulated 2-sided P-value bracketed by estimated P-value: 0.1587 0.1660 0.1733 Compare with result of Wilcoxon Rank-Sum Test: Data with midranks: Columns are Ordinal,Value,Group, Midrank,Tiegroups 1.0000 0.7300 0 1.0000 0 2.0000 0.7400 1.0000 2.0000 0 3.0000 0.8000 0 3.0000 0 4.0000 0.8300 0 4.0000 0 5.0000 0.8800 1.0000 5.0000 0 6.0000 0.9000 1.0000 6.0000 0 7.0000 1.0400 0 7.0000 0 8.0000 1.1500 1.0000 8.0000 0 9.0000 1.2100 1.0000 9.0000 0 10.0000 1.3800 0 10.0000 0 11.0000 1.4500 0 11.0000 0 12.0000 1.4600 0 12.0000 0 13.0000 1.6400 0 13.0000 0 14.0000 1.8900 0 14.0000 0 15.0000 1.9100 0 15.0000 0 Wx_Wy_Sum_ExpWx_ExpWy = 90 30 120 80 80 Wilcoxon_RankSum_Zval_NormPval = 1.2247 0.2207