How can I see specific likelihood values with MLE (or possibly another function?)
조회 수: 3(최근 30일)
I have some data and several experimental models with 3 free parameters. I would like to use aicbic to compare the models, and to do this, I need maximum likelihood estimates. I am trying to use the mle function, but it only seems to generate parameter estimates and not the actual likelihood values. Is there a fast way I can compute maximum likelihood values?
I am using a custom probability density function, by the way.
Other solutions not using mle are also appreciated! Thanks!
Jeff Miller 2021년 11월 2일
Once you have the parameter estimates (e.g., from mle) you can compute the likelihood value by calling your custom density function for each data point with the estimated parameters and then getting the product of the results (log transformation often helpful). Something like this:
% function pdfval = mycustomdensity(x,parm1,parm2,parm3) % suppose this fn
% is in a file somewhere
% d is a vector of data points
pdf_d = zeros(numel(d),1);
% parm1 etc these are the final estimates from mle
pdf_d(i) = mycustomdensity(d(i),parm1,parm2,parm3);
likelihood = prod(pdf_d);
lnlikelihood = sum(ln(pdf_d));
if your customdensity function can accept a vector of x and produce the corresponding vector of pdf values, you don't need the for loop.