I came across the table for use with the specialised K-S test and it said that the critical values were calculated using monte carlo calculations using 1000 or more samples for each value of N (sample size). I'm trying to understand how this was done. can anyone help me understand this. This is what i think;
Let the Lilliefors test statistic be and where is the cumulative normal distr. function, F is the empirical c.d.f for the sample , is the e.c.d.f of the sample with .
to simulate the null distribution of the lilliefors test statistic (D) i need to;
1) generate a sample of size n from the standard normal distribution N(0,1)
2) for the sample calculate
3)Do 1) and 2) 1,000 times
4)the distribution of the N values then approximates the null distribution of D
But were do i go on from here to calculate the right tail of this null distribution?
Funnily enough I co-authored a paper on this last summer...
What we did is took the 1000 values (in our case though we used many millions) and ordered them, smallest to largest. Then you just take the value which corresponds to the percentage point you want.
So for your 1000 values, if you want the upper 5% point, take the 950th values in your ordered set (have to check if we used 950, 951 or a combo of both).
thanks for your reply
oh i see. despite your few lines reply it helped alot.
I can't sit down and do it 1,000 times in my life time lol so
what i would like to do is use R to simulate the null distribution so that i can confirm the table. in the attachment i found the command for the null distribution for the k-s uniform case. I thought i could just change the uniform bit to normal but it doesn't work. I have never used R but it was the only one on my system. any ideas? any other program anyone knows how to do it in? thanks.
Use Maple. That's what we used. It will handle 50-60 million runs for n=5.
I'm looking through my code and trying to figure out how to help you but it's been a while since I had to do this and have forgotten most of the theory behind it...
If you use Maple I can send you the code I used and you can look at it. It's all been compiled and it's quite difficult to make out what is going on though. It works well and is fast though.
Maple, yeah i like maple. If you could send the code so i could go through it that would be great. I hate R lol.