Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Two-sample Kolmogorov-Smirnov test

`h = kstest2(x1,x2)`

`h = kstest2(x1,x2,Name,Value)`

```
[h,p] =
kstest2(___)
```

```
[h,p,ks2stat]
= kstest2(___)
```

returns
a test decision for the null hypothesis that the data in vectors `h`

= kstest2(`x1`

,`x2`

)`x1`

and `x2`

are
from the same continuous distribution, using the two-sample Kolmogorov-Smirnov
test. The alternative hypothesis is that `x1`

and `x2`

are
from different continuous distributions. The result `h`

is `1`

if
the test rejects the null hypothesis at the 5% significance level,
and `0`

otherwise.

returns
a test decision for a two-sample Kolmogorov-Smirnov test with additional
options specified by one or more name-value pair arguments. For example,
you can change the significance level or conduct a one-sided test.`h`

= kstest2(`x1`

,`x2`

,`Name,Value`

)

In `kstest2`

, the decision to reject the
null hypothesis is based on comparing the *p*-value `p`

with
the significance level `Alpha`

, not by comparing
the test statistic `ks2stat`

with a critical value.

[1] Massey, F. J. “The Kolmogorov-Smirnov
Test for Goodness of Fit.” *Journal of the American
Statistical Association*. Vol. 46, No. 253, 1951, pp. 68–78.

[2] Miller, L. H. “Table of Percentage
Points of Kolmogorov Statistics.” *Journal of the
American Statistical Association*. Vol. 51, No. 273, 1956,
pp. 111–121.

[3] Marsaglia, G., W. Tsang, and J. Wang.
“Evaluating Kolmogorov’s Distribution.” *Journal
of Statistical Software*. Vol. 8, Issue 18, 2003.

`adtest`

| `kstest`

| `lillietest`

Was this topic helpful?