Fit parameter to Weibull distribution
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, i wounder why my customized 3-parametric Weibull distribution function can't fit this specific data but the 2-parametric Weibull distribution function does.
%% INPUT DATA
A = [5.05002673467000 4.03148539861043 5.39815092086792 5.80624039967855 6.40216302871704 5.76023737589518 4.58155600229899 5.00490283966065 6.05405394236247 3.56419595082601 4.50625197092692 6.45612986882528 5.02723805109660 5.93072589238485 5.20658095677694 6.97059233983358 6.17937358220418 4.19038120905558 5.45702393849691 4.59787972768148 2.83733654022217 5.06135972340902 4.45322751998902 3.77954316139221 6.04727951685588 5.98482131958008 4.78870089848836 5.37800931930542 5.78453779220581];
A = A';
%% 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(A,'pdf',custompdf,'start',[mean(A) std(A) min(A)],'Options',opt,'LowerBound',[0 0 -Inf],'UpperBound',[Inf Inf min(A)]);
a = params(1,1);
b = params(1,2);
c = params(1,3);
x = [c+eps(c):0.1:max(A)*4.5];
%% QUANTILES
p = wblfit(A);
[nlogl,pcov] = wbllike(p,A);
[quantile_Wbl2,q95lo,q95up] = wblinv(0.9991666,p(1),p(2),pcov);
Q = quantile(customcdf(x, a, b, c),0.9991666);
quantile_Wbl3 = fsolve(@(x) customcdf(x, a, b, c) - 0.9991666, quantile_Wbl2);
%% FIGURES
plot(x,customcdf(x, a, b, c),'LineWidth',2);
hold on
plot(x,wblcdf(x,p(1),p(2)));
hold on
cdfplot(A);
legend('WBL-3-Parameter','WBL-2-Parameter','daten')
hold off
%% Anpassungstest
% kolmogorov-smirnov Anpassungstest
[h_wbl3,p_wbl3] = kstest(A,[A customcdf(A,a,b,c)],0.05,0);
[h_wbl2,p_wbl2] = kstest(A,[A wblcdf(A,p(1),p(2))],0.05,0);
0 件のコメント
採用された回答
Jeff Miller
2023 年 6 月 3 日
The problem is a bad choice of starting values. You will get much better parameter estimates with
params = mle(A,'pdf',custompdf,'start',[1 1 1],'Options',opt,'LowerBound',[0 0 -Inf],'UpperBound',[Inf Inf min(A)]);
The 2- and 3-parameter fits are almost identical because the mle estimate of 'c' is pretty close to zero (-0.1464).
2 件のコメント
その他の回答 (1 件)
Sandeep
2023 年 5 月 23 日
Hi Kalle,
There can be more than one reason as to why a customized 3-parametric Weibull distribution function may not adequately fit a specific data set while the standard 2-parametric Weibull distribution function does. Firstly, including more parameters in the model can lead to overfitting, which negatively affects the generalization performance of the model. The customized 3-parameter Weibull distribution function may overfit the data, leading to poor predictions in new instances. The customized 3-parameter Weibull distribution function may require more data points to estimate the parameters accurately, leading to poor parameter estimation and sub-optimal results.
In summary, the customized 3-parameter Weibull distribution function may not fit your specific data because it is too complex or you do not have enough data to estimate the parameters accurately, overfitting to random errors, or sub-optimal parameter estimation.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!