[R] The confidence level of p-value of ks.boot

Jasjeet Singh Sekhon sekhon at berkeley.edu
Sun Apr 29 21:58:15 CEST 2007

Hi Gala,

The default p-value is the bootstrap p-value for the ks-test.
Bootstrapping is highly recommended because the bootstrapped
Kolmogorov-Smirnov test, unlike the standard test, provides correct
coverage even when there are point masses in the distributions being
compared.  The bootstrap p-value is returned in the ks.boot.pvalue
object; so in your example code ks.b$ks.boot.pvalue.  And the results
from the standard ks.test function are contained in the ks
object--i.e., ks.b$ks.

For the theorem of correct coverage even with point masses see:
Abadie, Alberto. 2002. ``Bootstrap Tests for Distributional Treatment
Effects in Instrumental Variable Models.'' Journal of the American
Statistical Association, 97:457 (March) 284-292.

For the algorithm see:


Jasjeet S. Sekhon                     
Associate Professor             
Travers Department of Political Science
Survey Research Center          
UC Berkeley                     

V: 510-642-9974  F: 617-507-5524

Gala writes:
 > Hello!
 > I need to compare 2 datasets whether they come from the same distribution. I use function ks.boot{Matching}. And what is the confidence level of the p-value, returned by ks.boot function?
 > The code is:
 > set=read.table("http://stella.sai.msu.ru:8080/~gala/data/testsets.csv",
 >                 header=T,sep=',')
 > set1=set[!is.na(set$set1),'set1']
 > set2=set[!is.na(set$set2),'set2']
 > library(Matching)
 > ks.b=ks.boot(set1,set2,1000)
 > ks.b
 > Thank you!

More information about the R-help mailing list