How to create fitting plots using data and a parametric function, whose parameter I estimated through maximum likelihood?
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear all,
I want to plot data vs fitted function I found through Maximum Likelihood Estimation.
The following 4 plots are needed:
- observed and fitted densities
- observed and fitted densities in log
- observed vs fitted frequencies in log
- Q-Q plot in log
The function I used is a double Pareto-lognormal function. I managed to estimate the parameters of the function but now I'm struggling with the plots. Any help would be great.
The function is as follows:
Y = log(X)
n = length(Y);
m = mean(Y);
theta(1)= 3.3025;
theta(2)= 2.2771;
theta(3)= 0.9303;
p = theta(1)*theta(3) - (Y-m + 1/theta(1) - 1/theta(2) )/theta(3);
q = theta(2)*theta(3) + (Y-m + 1/theta(1) - 1/theta(2) )/theta(3);
M = log( (1-normcdf(p)).*normpdf(q) + (1-normcdf(q)).*normpdf(p) ) + .5*(log(2*pi)+p.^2) + .5*(log(2*pi)+q.^2);
function F=n*log(theta(1)) + n*log(theta(2)) - n*log(theta(1)+theta(2)) + ...
sum(-.5*(log(2*pi) + ( (Y-m + 1/theta(1) - 1/theta(2))/theta(3) ).^2) ) + sum(M);
end
F = -F;
2 Commenti
dpb
il 21 Lug 2019
function F=n*log(theta(1)) + n*log(theta(2)) - n*log(theta(1)+theta(2)) + ...
sum(-.5*(log(2*pi) + ( (Y-m + 1/theta(1) - 1/theta(2))/theta(3) ).^2) ) + sum(M);
end
F = -F;
What's the negation of F after the function? Shouldn't be either
function F=n*log(theta(1)) + n*log(theta(2)) - n*log(theta(1)+theta(2)) + ...
sum(-.5*(log(2*pi) + ( (Y-m + 1/theta(1) - 1/theta(2))/theta(3) ).^2) ) + sum(M);
F = -F;
end
or
function F=-(n*log(theta(1)) + n*log(theta(2)) - n*log(theta(1)+theta(2)) + ...
sum(-.5*(log(2*pi) + ( (Y-m + 1/theta(1) - 1/theta(2))/theta(3) ).^2) ) + sum(M));
end
?
Also, where are X, Y? Nobody can do nuttin' without the data.
Lastly, what have you tried and where did you run into a problem, specifically?
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!