I am relatively new to non-parametric tests. I wrote the following R code to test 2 sample tests using the KS test and the Wilcoxon Rank Sum test. Drawing 2 samples of various sizes from unit Normal and checking p values under both tests. I see a rather large variation in p-values and no convergence as sample size increases.
The R code I used is as follows:
results<-data.frame(Picks=numeric(), NoTie1=numeric(), NoTie2=numeric(), intersect=numeric(), ks.stat=numeric(), ks.pval=numeric(), wx.stat=numeric(), wx.pval=numeric(), pval.diff=numeric())
for(i in (1:100)) {
aa<-round(rnorm(i*10),4)
bb<-round(rnorm(i*10),4)
cc<-intersect(aa,bb)
aa<-setdiff(aa,cc)
bb<-setdiff(bb,cc)
intersect(aa,bb)
kst<-ks.test(aa,bb,alternative="t")
wxt<-wilcox.test(aa,bb,alternative="t")
results[i,]<-list(i*10,length(aa), length(bb), length(cc), kst$statistic, kst$p.value, wxt$statistic, wxt$p.value,round(abs(kst$p.value-wxt$p.value),2))
}
Besides this, although I draw a sample from the unit normal, p-values don't seem to converge as sample size increases.
digits
argument to theprint
function. $\endgroup$