Borrar filtros
Borrar filtros

How to generate a Frechet distribution using Methods of Moments?

25 visualizaciones (últimos 30 días)
Geovane Gomes
Geovane Gomes el 24 de Jul. de 2023
Respondida: Jeff Miller el 25 de Jul. de 2023
How could I generate extreme value type II distribution for maximum using the method of moments? I think of something similar to this

Respuestas (1)

Jeff Miller
Jeff Miller el 25 de Jul. de 2023
Here is how you might do it if with Cupid :
%% Example for the 2-parameter Frechet distribution (minimum known to be 0)
% Make some example data to illustrate fitting commands.
sampleSize = 500;
observedVal = Frechet2(10,2).Random(sampleSize,1);
figure;
histogram(observedVal,'Normalization','pdf')
xvals = linspace(min(observedVal),max(observedVal),100);
% Fit with maximum likelihood:
fitDist = Frechet2(9,1); % Guess parameters 9,1
fitDist.EstML(observedVal)
fittedPDF = fitDist.PDF(xvals);
hold on
plot(xvals,fittedPDF)
% Fit with method of moments:
fitDist = Frechet2(9,1); % Guess parameters 9,1
obsMean = mean(observedVal);
obsVar = var(observedVal);
fitDist.EstMom([obsMean,obsVar])
fittedPDF = fitDist.PDF(xvals);
hold on
plot(xvals,fittedPDF)
legend('observed','MLE','Moment')
%% Example for the 3-parameter Frechet distribution (minimum a free paramenter)
% Make some example data to illustrate fitting commands.
%
sampleSize = 1000;
trueMin = -10;
observedVal = Frechet(10,2,trueMin).Random(sampleSize,1);
figure;
histogram(observedVal,'Normalization','pdf')
xvals = linspace(min(observedVal),max(observedVal),100);
% Fit with maximum likelihood:
fitDist = Frechet(9,1,-8); % Guess parameters 9,1,-2
fitDist.EstML(observedVal)
fittedPDF = fitDist.PDF(xvals);
hold on
plot(xvals,fittedPDF)
% Fit with method of moments
fitDist = Frechet(9,1,-8); % Guess parameters 9,1,-2
obsMean = mean(observedVal);
obsVar = var(observedVal);
obs3rdMom = mean( (observedVal - obsMean).^3 );
fitDist.EstMom([obsMean,obsVar,obs3rdMom])
fittedPDF = fitDist.PDF(xvals);
hold on
plot(xvals,fittedPDF)
legend('observed','MLE','Moment')
% Note that the parameter estimates will be unreasonable if the initial guesses
% for parameter values are too far wrong.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by