Problems with the three-parameter Weibull distribution

8 views (last 30 days)
Federico Antonelli
Federico Antonelli on 15 Oct 2021
Commented: Star Strider on 15 Oct 2021
Hi, I am working with the three-parameters Weibull distribution because my dataset contains only negative numbers. The code below is found in the documentation and obviously works correctly.
However, I don't fully understand how it works. I have searched on-line and in the documentation but I can't get around the two lines that I have highlighted in bold. I don't understand how to assign the values to the start vector and how to assign values to lower and upper bound. Any reference to the 'Weight' data would be helpful.
Thank you
Kind Regards
Federico
load carsmall
x = linspace(0,6000);
f_def = @(x,a,b,c) (x>c).*(b/a).*(((x-c)/a).^(b-1)).*exp(-((x-c)/a).^b);
try
mle(Weight,'pdf',f,'Start',[1700 2 1500])
catch ME
disp(ME)
end
opt = statset('FunValCheck','off');
params = mle(Weight,'pdf',f,'Start',[1700 2 1500],'Options',opt, ...
'LowerBound',[0 0 -Inf],'UpperBound',[Inf Inf min(Weight)])
figure
histogram(Weight,8,'Normalization','pdf')
hold on
plot(x,f(x,params(1),params(2),params(3)),'LineWidth',2)
hold off

Answers (1)

Star Strider
Star Strider on 15 Oct 2021
Those lines estimate the parameters of the distribution using Maximum Likelihood Estimation with the mle function, so look through that documentation as well.
The Start name-value pair is described under Other Options (there is no direct link to it). With respect to defining them, make a good guess as to what the parameters should be. If the guess is wrong and the estimation fails to converge, try new guesses until it converges.
.
  2 Comments
Star Strider
Star Strider on 15 Oct 2021
My pleasure!
One option to estimate the correct Start parameters would be to use the ga (genetic algorithm) function. I would follow the example and estimate the last two parameters using the fitdist calls on an appropriate subset of the data. (It may be possible to make them positive by specifying ‘c’ correctly.) That will make the third parameter easier to estimate.
With respect to the bounds, although they are required for custom distributions, they can be specified to essentially anything reasonable. I would use the bounds in the example.
.

Sign in to comment.

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by