I need to do a two-sample Kolmogorov-Smirnov (KS) test in R, only I don't understand the formulae and how it works when I look it up. I suspect this is because I don't understand the maths of what goes on in this test and just know whether it will tell me if the data are normally distributed or not.

Any help given (about the formulae, interpretation, and even the usage in R) would be brilliant.

  • $\begingroup$ I'm confused what your question is. See the other questions with the same kolmogorov-smirnov tag for plenty of examples and discussion on how to interpret the test, e.g. this example is pretty straightforward and provides an example in R. $\endgroup$ – Andy W Aug 20 '14 at 12:38

There are two kinds of Kolmogorov-Smirnov tests - the one and two sample (both available in one and two-tailed forms).

The one sample test is used to test whether the data are consistent with some hypothesized (fully specified) distribution, so could be used to test if data were consistent with a normal distribution with specified mean and variance. [If you're interested in testing whether they're consistent with normality in general, the test must be modified; in that case it's usually called a Lilliefors test - a fruitful search term here.]

The two sample test is to see whether two sets of data are consistent with them having the same (completely unspecified) distribution. So the two sample test will not let you see if your data are normal.

Unfortunately, because your question is muddled over that point, it's difficult to give much additional guidance without some clarification on your part about what you want to achieve (you should edit it to clarify further).

Both one and two-sample K-S tests are discussed on Wikipedia: Kolmogorov–Smirnov test - and in numerous posts on the site here.

Here's one that discusses the statistic in the one sample case, for example, which may be of some help to get you started on some of the basic ideas.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.