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