[R] a question about ks.test

Greg Snow 538280 at gmail.com
Tue Feb 25 21:42:14 CET 2014

I think both of your questions can be answered using simulations.

If you simulate a bunch of datasets  where the null hypothesis is true
(data comes from the candidate distribution or 2 sets come from the
same distribution) and compute the KS statistic for each (you can use
the ks.test function to do this and just ignore the p-value part),
then you can estimate the critical value as a quantile of the

The second would be similar, generate the data such that the maximum
difference between the generating distribution and the normal of
interest is C, simulate a bunch of times and find the quantile to
compute the critical value, then if for the real data the difference
is bigger than the critical value you can reject the null.

On Tue, Feb 25, 2014 at 12:57 PM, Shima Shahbazi <shima at math.aau.dk> wrote:
> Hello,
> I have two questions about one sided ks.test.
> First, is there any function in R to find _the critical value_ for this
> test? I looked at the  "Z. W. Birnbaum and Fred H. Tingey (1951) paper"
> and I found the formula "sqrt(-1/(2n)log(/a/))" but when I use the
> p-value from ks.test and this critical value the results are different.
> I really need to use the critical value not the p-value.
> Second, is it possible to test H_0: P(X<=y)-P(Z<=y)>=C, where C is a
> constant and Z is normal? I mean is it possible to see if the maximum
> distance between two cumulative distributions is _more than __a constant_?
> Best,
> Shima.
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com

More information about the R-help mailing list