In this chapter we present a well-known test for the problem if two independent samples are drawn from the same population or not. The test is based on very few assumptions, for example, it is not necessary to specify the distributions beyond the fact that they are continuous distributions.
Description: | Tests if two independent samples are sampled from the same distribution. |
Assumptions: |
|
Hypotheses: | (A) vs for at least one |
(B) vs with for at least one | |
(C) vs with for at least one | |
Test statistic: | (A) |
(B) | |
(C) | |
where and denote the empirical distribution functions based on the two samples. |
Test decision: | Reject if for the observed value of |
(A) | |
(B) | |
(C) | |
The critical values , , can be found for instance in Sheskin (2007, table A.23). | |
p-values: | (A) |
(B) | |
(C) | |
Annotations: |
|
proc npar1way data=blood_pressure D; class status; var mmhg; exact edf; run;
The NPAR1WAY Procedure Kolmogorov–Smirnov Test for Variable mmhg Classified by Variable status EDF at Deviation from Mean status N Maximum at Maximum --------------------------------------------------- 0 25 0.880000 2.218182 1 30 0.066667 -2.024914 Total 55 0.436364 Maximum Deviation Occurred at Observation 25 Value of mmhg at Maximum = 125.0 KS 0.4050 KSa 3.0034 Kolmogorov–Smirnov Two-Sample Test (Asymptotic) D = max |F1 - F2| 0.8133 Pr > D <.0001 D+ = max (F1 - F2) 0.8133 Pr > D+ <.0001 D- = max (F2 - F1) 0.0000 Pr > D- 1.0000
x<-blood_pressure$mmhg[blood_pressure$status==0] y<-blood_pressure$mmhg[blood_pressure$status==1] ks.test(x,y,alternative="two.sided",exact=FALSE)
Two-sample Kolmogorov–Smirnov test data: x and y D = 0.8133, p-value = 2.923e-08 alternative hypothesis: two-sided
Sheskin D. 2007 Handbook of Parametric and Nonparametric Statistical Procedures, 4nd edn. Chapman & Hall.
Steck G.P. 1969 The Smirnov two sample tests as rank tests. The Annals of Mathematical Statistics 40, 1449–1466.
18.118.31.67