What distribution is appropriate for my data?

1 visualización (últimos 30 días)
Behrooz Daneshian
Behrooz Daneshian el 25 de Nov. de 2022
Respondida: John D'Errico el 25 de Nov. de 2022
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
clear;
load radious
load frequency
load pors_11.33
vector2=flip(F);
vector1=flip(R);
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
B=trapz(x,pdfOfx);
vector2nor = vector2 / trapz(vector1,vector2);
plot(vector1,vector2nor);
C=trapz(vector1,vector2nor);
xlabel('Radious(mm)');
ylabel('PDF');
legend('Fitted lognormal','Real data')
hold on

Respuestas (1)

John D'Errico
John D'Errico el 25 de Nov. de 2022
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