# How to solve for 3 parameters for a Weibull distribution

11 views (last 30 days)
Isaac Valdez on 26 Jun 2020
Commented: Isaac Valdez on 30 Jun 2020
I am having a difficult time solving for the parameters "a", "b", and "c" for a data set that has a Weibull distribution. I know there is the "wblfit" command that solves for "a" and "b" however I cant seem to figure out a way to solve for all three parameters. Below is my code and the data that I want to find the paramters for.
Build_Array_Final{1}=[214.42,214.99,215.35,215.98,221.08,222.54,214.78,215,215.32,215.75,217.06,215.91,212.30,213.78,217.16,218.39,224.23,221.94...
,215.67,214.04,214.98,215.13]';
custpdf = @(x,a,b,c) (x>c).*(b/a).*(((x-c)/a).^(b-1)).*exp(-((x-c)/a).^b);
opt = statset('MaxIter',1e5,'MaxFunEvals',1e5,'FunValCheck','off');
params = mle(Build_Array_Final{1},'pdf',custpdf,'start',[5 5 5],'Options',opt,'LowerBound',[0 0 0],...
'UpperBound',[Inf Inf min(Build_Array_Final{1})]);
I am also confused on what my initials start values are suppose to be for my parameter if I do not even know what they are.
I know there was a question that was asked similar to this but it was not answered. Any input I would be greatfutl for.
I am using ver 2020a

Jeff Miller on 27 Jun 2020
Here is what I get using Cupid:
Build_Array_Final{1}=[214.42,214.99,215.35,215.98,221.08,222.54,214.78,215,215.32,215.75,217.06,215.91,212.30,213.78,217.16,218.39,224.23,221.94...
,215.67,214.04,214.98,215.13]';
w = Weibull(1,1,210); % Wild guesses for starting parameters
w.EstML(Build_Array_Final{1})
% ans =
% Weibull(5.0394,1.5531,212.1006)

Show 1 older comment
Isaac Valdez on 29 Jun 2020
So I was able to get the values you got by setting the Start values to "[0 0 0]" however, why is it that when i use a wblfit(Build_Array_Final{1}) I get that "a=218.2659" and "b=61.7578" and not the values from the "mle"? Shouldnt the values be similar to the "wblfit" output at least for "a" and "b"?
Jeff Miller on 29 Jun 2020
Yes I just used that one line with EstMLE to find the parameters. Cupid did the rest.
Starting values are wild guesses, as I indicated, except I know that the third parameter is always a little less than the minimum data value. If you aren't sure EstMLE found the best parameter values, you can try lots of other starting points and see whether they all end with the same estimates.
"verifying the parameters" Not sure what you mean by that. Of course the estimated parameters are not the true population values because you only have a noisy random sample of data, and you can't perfectly recover the truth from those. If you mean showing that these parameter values do indeed maximize the likelihood, then you can try other parameter values and compare likelihoods with those.
The a and b from the 2-parameter Weibull shouldn't be anything like the first two of the 3-parameter version, at least not when the 3rd parameter is far from zero. If you want to use wblfit, subtract 214 from all of your observations and use wblfit on the difference scores. Then the a,b should be about the same as those that Cupid provided. That third parameter is just an offset of the scores; normally the minimum score in a Weibull distribution is 0.
Isaac Valdez on 30 Jun 2020
Thank you for clarifying everything in such great detail.