# kstest2

Two-sample Kolmogorov-Smirnov test

## Syntax

## Description

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`

)

## Examples

## Input Arguments

## Output Arguments

## More About

## Algorithms

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.

## References

[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.

## Version History

**Introduced before R2006a**

## See Also

`kstest`

| `lillietest`

| `adtest`