Two-sample Kolmogorov-Smirnov Goodness-of-Fit Test

The two-sample Kolmogorov-Smirnov goodness of fit test is used to test whether two sets of observations could reasonably have come from the same distribution. This test assumes that the samples are random samples, the two samples are mutually independent, and the data are measured on at least an ordinal scale. In addition, the test gives exact results only if the underlying distributions are continuous.

To perform a two-sample Kolmogorov-Smirnov test

Choose Statistics __image\ebd_ebd26.gif Compare Samples __image\ebd_ebd27.gif Two Samples __image\ebd_ebd28.gif Kolmogorov-Smirnov GOF. The dialog shown below appears.

__image\kolsmir2.gif

The two-sample Kolmogorov-Smirnov test has the following options:

Data

Data Set

Select a data set from the dropdown list or type the name of a data set. You can also type into the Data Set edit field any expression that evaluates to a data set.

Variable 1

Specify a column as the first sample, when the data set does not have a grouping indicator.

Variable 2

Specify another column as the second sample, when the data set does not have a grouping indicator.

Variable 2 is a Grouping Variable

Select if one column in the data set is a grouping indicator that categorizes cases into two groups. In this case, select the response from Variable 1 and the indicator from Variable 2.

Results

Save As

Enter the name for the object in which to save the results of the analysis.

Print Results

Select this to print out the results of the analysis in the designated output window.

Related S-PLUS language functions

ks.gof, chisq.gof, qqplot