Kolmogorov-Smirnov Inverse CDF
x = distfun_ksinv(p,N) x = distfun_ksinv(p,N,lowertail)
a matrix of doubles, the probability. Must be in the range [0,1].
a matrix of doubles , the number of observations. N belongs to the set {1,2,3,4,.......,2147483647}
a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<=x) otherwise P(X>x).
a matrix of doubles, the outcome, x in [0,1]
Computes the Inverse cumulative distribution function of the Kolmogorov-Smirnov distribution function.
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
x = distfun_ksinv(.6284796154565043,10) expected = 0.274 // Kolmogorov-Smirnov Test // http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm n=1000; x=distfun_normrnd(0,1,[1 n]); // Does x comes from the Normal distribution ? x=gsort(x,"g","i"); y=distfun_normcdf(x,0,1); i=1:n; Dplus=max(y-(i-1)/n); Dminus=max(i/n-y); D=max(Dminus,Dplus); mprintf("Test statistic D=%f\n",D) // Threshold alpha=0.05; Dalpha=distfun_ksinv(alpha,n,%f); mprintf("Significance level =%f\n",alpha) mprintf("Critical value =%f\n",Dalpha) mprintf("Critical region: Reject H0 if D>%f\n",Dalpha) if (D>Dalpha) then mprintf("Reject H0.\n") else mprintf("Accept H0.\n") end // We should accept 95% of the time | ![]() | ![]() |
http://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test