what's wrong with my ks test?
Afficher commentaires plus anciens
I get too high D-values with my ks-test but at the same time low p-values. How is that possible?
C = wblrnd(100,1);
C = C';
% 3 parameter WEIBULL SETUP
custompdf = @(x,a,b,c) (x>c).*(b/a).*(((x-c)/a).^(b-1)).*exp(-((x-c)/a).^b);
customcdf = @(x,a,b,c) (x>c).*1-exp(-((x-c)/a).^b);
opt = statset('MaxIter',1e5,'MaxFunEvals',1e5,'FunValCheck','off');
params = mle(C,'pdf',custompdf,'start',[mean(C) std(C) min(C)],'Options',opt,'LowerBound',[0 0 -Inf],'UpperBound',[Inf Inf min(C)]);
a_Welle = params(1,1);
b_Welle = params(1,2);
c_Welle = params(1,3);
x = [c_Welle+eps(c_Welle):0.1:max(C)*mean(C)];
% 2 parameter WEIBULL SETUP
p = wblfit(C);
[nlogl,pcov] = wbllike(p,C);
[quantile_Wbl2,q95lo,q95up] = wblinv(0.99958333,p(1),p(2),pcov);
Q = quantile(customcdf(x, a_Welle, b_Welle, c_Welle),0.99958333);
% kolmogorov-smirnov
[h_wbl3,p_wbl3,ksstat_wbl3] = kstest2(C, customcdf(C,a_Welle,b_Welle,c_Welle));
[h_wbl2,p_wbl2,ksstat_wbl2] = kstest2(C, wblcdf(C,p(1),p(2)));
fprintf('Two parameter Weibull-Distr.: h = %d, p = %f, D-Wert = %f\n', h_wbl2, p_wbl2, ksstat_wbl2);
fprintf('three parameter Weibull-Distr.: h = %d, p = %f, D-Wert = %f\n', h_wbl3, p_wbl3, ksstat_wbl3);
How can I improve my code?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Hypothesis Tests dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!