Oliver Amundsen
Oliver Amundsen

Reputation: 1511

Fit data to other formulations of Gumbel and Weibull models in Matlab

I need to fit Extreme Value distributions to wind speed data. I'm using Matlab for doing this. It may not be evident to a user that there are alternative formulations of the Gumbel and Weibull models than those that Matlab has built in in its commands: evfit and wblfit. Thus, the definitions implemented are:

Gumbel (suited for minima)

enter image description here

However, there's another version of the Gumbel to which I need to fit the data:

enter image description here

Weibull

Same comments applies to the Weibull models in Matlab. In previous versions, Matlab implemented a version of the Weibull in the command weibfit (not available anymore), which was later replaced by wblfit.

enter image description here

and previously as:

enter image description here

My question is: any ideas how can the data be fitted to the previous definitions of the Gumbel and Weibull models in Matlab?

Thanks,

Upvotes: 1

Views: 344

Answers (1)

obchardon
obchardon

Reputation: 10792

You can estimate the parameter of a custom distribution using the function mle:

Example with your custom weibul PDF:

data      = wblrnd(1,1,1000,1); %random weibull data
custompdf = @(x,a,b) (b*a).*x.^(b-1).*exp(-a*x.^b);                               %your custom PDF function
opt       = statset('MaxIter',1e5,'MaxFunEvals',1e5,'FunValCheck','off');         %Iteration's option
[param,ci]= mle(data,'pdf',custompdf,'start',[1 1],'Options',opt,'LowerBound',[0 0],'UpperBound',[Inf Inf])

If the function doesn't converge, you can adjust the starting point with some better suited value.

Upvotes: 2

Related Questions