1

The question arose from my analysis on Matlab.

The function kstest(x) compares data set x against a standard normal distribution (mean 0 and std 1)

My question is, do you correct the data set to have a mean of 0 and std of 1

y = (x - mean(x))/std(x)

or compare it without correcting?

kepsek
  • 11
  • 2

1 Answers1

0

I believe you need Lilliefors test. The Kolmogorov-Smirnov test uses a completely specified distribution, so in your case, you need to know exactly which normal distribution you're testing against (pre-specified values of mean and variance). Kolmogorov-Smirnov does not take into account the uncertainty involved in estimating the mean and variance. This is the issue that Lilliefors addressed in his paper. From the abstract:

The standard tables used for the Kolmogorov-Smirnov test are valid when testing whether a set of observations are from a completely-specified continuous distribution. If one or more parameters must be estimated from the sample then the tables are no longer valid.

See also the Wikipedia article for a summary. The "nortest" package in R has the function lillie.test() to perform a Lilliefors test. I don't use Matlab, but from a quick Google search it looks there is a lillietest(x) function from here.

By the way, you might be interested in this discussion where it's discussed when (and if) normality testing is really appropriate/useful or not.

iceberg
  • 31
  • 3