I was recently given the following data.
7 1 6 6 2 8 3 7 4 6 3 3 1 8 4 5 9 3 2 4 1 4 4 3 6 3 4 2 3 2 7 2 7 4 2 4 4 4 3 2 2 4 5 8 6 4 3 1 5 5
I then ran a KS test as follows in R:
ks.test(mydata,"pnorm",mean(mydata),sd(mydata))
and got the following:
One-sample Kolmogorov-Smirnov test
data: mydata
D = 0.1832, p-value = 0.06985
alternative hypothesis: two-sided
Trouble is when I do the same test in SPSS, as shown here: https://statistics.laerd.com/spss-tutorials/testing-for-normality-using-spss-statistics.php
I get a p-value of 0.000 but exactly the same test statistic. Does anyone have an idea why this is? I'm not an expert in SPSS at all (don't even have it installed) but the fact that the D-statistic matches makes me think I ran it correctly and am somehow misreading it.
Addendum
RioRaider's hint was the right way to go. After manually applying Lilliefors Significance Correction as described here:
http://home.ubalt.edu/ntsbarsh/stat-data/SPSSSAS.htm
Formula:
Exp[ -7.01256D2(n + 2.78019) + 2.99587D(n+2.78019)1/2 - 0.122119 + 0.97498/n1/2 + 1.67997/n ]
I get exactly the p-values as described. Is there a way I can flag his comment as a +1?
Rmanual page for the KS test explicitly mentions that using the mean and sd of the data for the parameters is invalid. You can verify this with a simulation. – whuber♦ Sep 14 '12 at 22:11