Using MLE function to estimate the parameters of a custom distribution

瘦欲@ 提交于 2019-11-29 16:37:02
  • exp() is a function, not a variable, precise the argument
exp^(-c*w) ---> exp(-c*w)
  • The starting point concerns the 6 parameters, not only one 0.1*ones(1,6)
  • In custcdf mle requires the upper bound of the integral to be a scalar, I did some trial and error and the range is [2~9]. for the trial some values lead to negative cdf or less than 1 discard them.
  • Then use the right one to compute the upper bound see if it's the same as the one you predefined.

I re-write all the functions, check them out

The code is as follow

Censored = ones(5,1);% All data could be trusted 

data        =  rand(5,1); % Since I cannot upload the acutal data, we may use this

f         =  @(w,a,b,c) (w.^(a-1)).*((1-w).^(b-1)).*exp(-c.*w);
% to estimate the parameters
custpdf     =  @(t,alpha,theta,beta, a,b,c)...
                (((integral(@(w)f(w,a,b,c), 0,1)).^-1).*...
                beta.*...
                ((igamma(alpha, (theta./t).^beta)).^(a-1)).*...
                ((theta./t).^(alpha.*beta + 1 )).*...
                exp(-(((theta./t).^beta)+...
                c.*igamma(alpha, (theta./t).^beta)./gamma(alpha))))./...
                (theta.*...
                ((gamma(alpha)).^(a+b-1)).*...
                 ((gamma(alpha)-...
                 igamma(alpha, (theta./t).^beta)).^(1-b)));


custcdf = @(t,alpha,theta,beta, a,b,c)...
         ((integral(@(w)f(w,a,b,c), 0,1)).^-1).*...         
     (integral(@(w)f(w,a,b,c), 0,2));



phat = mle(data,'pdf',custpdf,'cdf',custcdf,'start', 0.1.*ones(1,6),'Censoring',Censored);

Result

    phat = 0.1017    0.1223    0.1153    0.1493   -0.0377    0.0902
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!