MATLAB: Kstest and hypothesis rejecting

h=0h=1hypothesis testingkstest

When one does a kstest in matlab and the h=0, what does that mean? The null hypothesis has failed? What about when h=1?

Best Answer

When in doubt, use help()
help kstest
kstest Single sample Kolmogorov-Smirnov goodness-of-fit hypothesis test.
H = kstest(X) performs a Kolmogorov-Smirnov (K-S) test to determine if
a random sample X could have come from a standard normal distribution,
N(0,1). H indicates the result of the hypothesis test:
H = 0 => Do not reject the null hypothesis at the 5% significance

level.
H = 1 => Reject the null hypothesis at the 5% significance
level.
The null hypothesis depends on your inputs. Again, from the documentation using doc(ktest):
Test the null hypothesis that the data comes from a normal distribution with
a mean of 75 and a standard deviation of 10. Use these parameters to center
and scale each element of the data vector since, by default, kstest tests for
a standard normal distribution.
x = (test1-75)/10;
h = kstest(x)