kstest
One-sample Kolmogorov-Smirnov test
Syntax
h = kstest(x)
h = kstest(x,CDF)
h = kstest(x,CDF,alpha)
h = kstest(x,CDF,alpha,type)
[h,p,ksstat,cv] = kstest(...)
Description
h = kstest(x) performs a Kolmogorov-Smirnov test to compare the values in the data vector x to a standard normal distribution. The null hypothesis is that x has a standard normal distribution. The alternative hypothesis is that x does not have that distribution. The result h is 1 if the test rejects the null hypothesis at the 5% significance level, 0 otherwise.
The test statistic is:
where F(x) is the empirical cdf and G(x) is the standard normal cdf.
h = kstest(x,CDF) compares the distribution of x to the hypothesized continuous distribution defined by CDF, which is either a two-column matrix or a ProbDist object of the ProbDistUnivParam class or ProbDistUnivKernel class. When CDF is a matrix, column 1 contains a set of possible x values, and column 2 contains the corresponding hypothesized cumulative distribution function values G(x). If possible, define CDF so that column 1 contains the values in x. If there are values in x not found in column 1 of CDF, kstest approximates G(x) by interpolation. All values in x must lie in the interval between the smallest and largest values in the first column of CDF. If the second argument is empty ([]), kstest uses the standard normal distribution.