How to generate a Frechet distribution using Methods of Moments?

23 ビュー (過去 30 日間)
Geovane Gomes
Geovane Gomes 2023 年 7 月 24 日
回答済み: Jeff Miller 2023 年 7 月 25 日
How could I generate extreme value type II distribution for maximum using the method of moments? I think of something similar to this

回答 (1 件)

Jeff Miller
Jeff Miller 2023 年 7 月 25 日
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.

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by