MATLAB: How to obtain the scale and shape parameter of a Weibull distribution from the relative frequency of observations in given intervals

distributionestimationextremeparameterStatistics and Machine Learning Toolboxvalueweibull

Consider the following data from a random process following the Weibull extreme value distribution, where X is a vector of intervals in which realizations of the random process were observed and Y is the relative frequency of these observations, e.g.
Xint = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
Y = [0.0275,0.0780,0.1164,0.1379,0.142,0.1315,0.1114,0.0872,0.0634,0.0430,0.0273,0.0162,0.00910,0.00480,0.00240,0.0011,0.0005,0.00015,0.0001,0.00005];
How can I obtain the scale and shape parameter of the underlying Weibull distribution from the relative frequency of observations in the given intervals?

Best Answer

As a first step, we generate the vector of observable realizations, X, from the given intervals Xint, in order to get an vector with the same length as Y. To that extent, we are using the moving mean value function movmean for no previous element, the current element, and only the next element in Xint while discarding the last sample:
X = movmean(Xint,[0 1],'Endpoints','discard');
Note that the relative frequency of observations in Y, corresponds to the probability distribution function (PDF) of the underlying Weibull distribution at the discrete points in X. We can use this information to generate a vector of random realizations of X using the PDF information Y as weights:
wblData = datasample(X,2000,'Replace',true,'Weights',Y);
Now, we can use wblfit to obtain parameter estimates and confidence intervals for Weibull data:
[paramMLE, paramCI] = wblfit(wblData)
paramMLE =
5.988417053853331 1.950545420954559
paramCI =
5.848546647345898 1.884551882824427
6.131632518850710 2.018849931318794
Note that this returns maximum likelihood estimates and 95% confidence intervals of the parameters of the Weibull distribution given the data in wblData.
As a next step, you can create a Weibull distribution object using the estimated parameters like:
wblObj = makedist('Weibull','A',paramMLE(1),'B',paramMLE(2))
wblObj =
WeibullDistribution
Weibull distribution
A = 6.0252
B = 1.97841
As an alternative, you can create a Weibull distribution object with the same scale parameter A and shape parameter B directly using data fitting:
wblObj = fitdist(wblData','Weibull')
wblObj =
WeibullDistribution
Weibull distribution
A = 6.0252 [5.88647, 6.1672]
B = 1.97841 [1.91194, 2.04719]