# How can I see specific likelihood values with MLE (or possibly another function?)

조회 수: 3(최근 30일)
Patrick Yee 2021년 11월 2일
답변: Jeff Miller 2021년 11월 2일
Hello,
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!

댓글을 달려면 로그인하십시오.

### 답변(1개)

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);
for i=1:numel(d)
% parm1 etc these are the final estimates from mle
pdf_d(i) = mycustomdensity(d(i),parm1,parm2,parm3);
end
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.
hth

댓글을 달려면 로그인하십시오.

R2018b

### Community Treasure Hunt

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

Start Hunting!