Contents Previous Next Subchapters Current Chapters-> erf ierf erfc beta betai gamma gammln gammainc besselj bessely besseli besselk elliprf elliprd elliprj ellipf ellipe ellipi kolsmi psi airy isprime lentz Parent Chapters-> Omatrix6 special kolsmi Search Tools-> contents reference index search

Kolmogorov-Smirnov Test
 Syntax `kolsmi(`sample`, function `cum`)` See Also cnormal , ghist

Description
Tests the hypothesis that a set of samples come from the candidate distribution specified by the cumulative distribution function cum. The real or double-precision column vector sample contains the samples of the random variable that we are testing. If s is a column vector with the same type as sample, the function call cum(s) returns a vector with the same type and dimension as s containing the element-by-element value of the cumulative distribution. The return value of `kolsmi` is a scalar with the same type as sample. It is the probability that the maximum difference between the sample cumulative distribution and the candidate cumulative distribution is greater than or equal to the value corresponding to sample (under the hypothesis that the candidate distribution is correct).

Example
If you enter ```      sample = rand(20, 1) ``` O-Matrix will store twenty realizations of a random variable that is uniformly distributed between zero and one. If you continue by entering ```      kolsmi(sample, function cnormal) ``` O-Matrix will print the probability that a normal random variate would yield a sample cumulative distribution that has a greater deviation than the one corresponding to `sample`. This statistic should be very small relative to one, because `sample` does not come from a normal random variable.