Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Perform Kolmogorov-Smirnov Test

For the Kolmogorov-Smirnov goodness-of-fit test, MuPAD® provides the stats::ksGOFT function. This function enables you to test the data against any cumulative distribution available in the MuPAD Statistics library. The Kolmogorov-Smirnov test returns two p-values. The null hypothesis passes the test only if both values are larger than the significance level. For example, create the following data sequence x which contains a thousand entries:

f := stats::normalRandom(1, 1/3):
x := f() $ k = 1..1000:

Use the function stats::ksGOFT to test whether the sequence x has a normal distribution with the mean 1 and the variance 1/3. Suppose, you apply the typical significance level 0.05. Since both p-values are larger than the significance level, the sequence passes the test:

stats::ksGOFT(x, CDF = stats::normalCDF(1, 1/3))

Test the same sequence, but this time compare it to the normal distribution with the variance 1. Both p-values are much smaller than the significance level. The null hypothesis states that the sequence x has a normal distribution with the mean 1 and the variance 1. This hypothesis must be rejected:

stats::ksGOFT(x, CDF = stats::normalCDF(1, 1))

Was this topic helpful?