What distribution is appropriate for my data?

2 ビュー (過去 30 日間)
Behrooz Daneshian
Behrooz Daneshian 2022 年 11 月 25 日
回答済み: John D'Errico 2022 年 11 月 25 日
Hi everyone. I tried to fit a lognormal distribution considering the first moment approach via below code.However, the fited lognormal distribution is not good (please see the attached picture). Can anyone suggest a better distribution to fit my data?
close all
load radious
load frequency
load pors_11.33
probs = vector2 / sum(vector2); % Convert counts to probabilities
ExpOfY = sum(vector1.*probs); % mean of the scores tabulated in vectors 1 & 2
Ysqr = vector1.^2;
ExpOfYsqr = sum(Ysqr.*probs);
VarOfY = ExpOfYsqr - ExpOfY^2; % variance of the scores tabulated in vectors 1 & 2
normu = log(ExpOfY/sqrt(1+VarOfY/ExpOfY^2));
norvar = log(1+VarOfY/ExpOfY^2);
norsigma = sqrt(norvar);
dist = makedist('Lognormal','mu',normu,'sigma',norsigma);
x = linspace(0,max(vector1)); % Use whatever range is appropriate for your data
pdfOfx = pdf(dist,x);
figure; plot(x,pdfOfx);
% set(gca, 'XScale', 'log')
hold on
vector2nor = vector2 / trapz(vector1,vector2);
legend('Fitted lognormal','Real data')
hold on

回答 (1 件)

John D'Errico
John D'Errico 2022 年 11 月 25 日
Why would you expect a distribution like that, with a strange hump on one side to have some predefined distribution that fits it well? Note that any simple distribution, like a normal, or lognormal will have a single well defined mode. (I'll leave out beta distributions, which do NOT have that shape either.)
That bump means no simple distribution will work. What will probably work is a mixture distribution.

Community Treasure Hunt

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

Start Hunting!

Translated by