Kolmogorov-Smirnov Test – How to Calculate the Power of Kolmogorov-Smirnov Test for a Normal Distribution?

kolmogorov-smirnov testnormal distributionstatistical-power

I have a question about calculating the power of Kolmogorov-Smirnov test, given the following: H0: mu=0, H1:m!=0, alpha = 0.05, for N(mu, 1), while true mu=0.1, for sample sizes n1 = 30, n2 = 1000. I have been struggling to find a way to calculate the power of KS test. I have covered this thread, but it was covering the exponential distribution, and I am not really getting how to apply that to normal distribution.

Any suggestions? I would be also glad to receive recommendations if there are any resources/literature that would help with this.

Best Answer

Please take the tour of our site, clarify your notation, and show what you have tried. To the extent that I understand what you are trying to do, the following hint may be helpful.

Hint: Below is one possibly relevant K-S test in R; it does not reject $H_0: \mu=0$ against $H_1: \mu= 0.1$ at the 5% level.

ks.test(rnorm(10, 0, 1), rnorm(1000, .1, 1), alternative="gr")

        Two-sample Kolmogorov-Smirnov test

data:  rnorm(10, 0, 1) and rnorm(1000, 0.1, 1)
D^+ = 0.122, p-value = 0.7447
alternative hypothesis: the CDF of x lies above that of y

Here are 100,000 possibly relevant K-S tests, among which 6.4% reject $H_0: \mu=0$ against $H_1: \mu = 0.1$ at the 5% level.

pv= replicate(10^5, ks.test(rnorm(10, 0, 1), rnorm(1000, .1, 1), 
     alternative="gr")$p.val)
mean(pv <= .05)
[1] 0.06416