2017-02-11 160 views
1

我在Matlab中使用[h,p,ksstat,cv] = kstest(x,'cdf',y);函數來查找ksstat和p值。我的xx(1,1:10) = [0.16;1.21;4.41;0.09;0.64;0.36;0.04;6.76;0.04;0.49]和我的y = chi2cdf(x,9);這是我指定或測試的cdf。雖然我得到這個錯誤:在MATLAB中計算Kolmogorov-Smirnov測試

Error using kstest (line 160) 
Hypothesized CDF matrix must have 2 columns. 

通常我會[h,p,ksstat,cv] = kstest(x,'cdf',y);其中 y = makedist('ChiSquared');但正如你可能知道的分佈卡方不存在,所以我不知道如何來解決這個問題。任何建議,非常感謝。

回答

1

我想你應該寫:

[h,p,ksstat,cv] = kstest(x,'cdf',[x y]); 

documentation says

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

+0

謝謝你的回答,你會知道如何指定CDF,我們只是有F(X)= MATLAB中的x^4? – Scooby