How to calculate LogLikelihood between real data and predicted data?

23 views (last 30 days)
Hey everyone!
I have used an AR-model to predict a time series and now I would like to calculate the LogLikelihood between my predicted datapoints and real datapoints to determine what set-up of my AR is the best by using the Akaika and Bayesian Information Criteria. On the internet I found the following idea:
LogL=sum(log(pdf(pd,x)))
I cannot use this command though because matlab tells me it needs to know what kind of probability density function the pdf command should use. How can I solve this problem?
I tried this:
LogL=sum(log(pdf('norm',pd,x,0,1)))
to try out what happens if I use a normal density function but my result is simply NaN...

Accepted Answer

Roger Wohlwend
Roger Wohlwend on 15 Oct 2014
When you estimate the model (using Matlab's arima class), you get the log-likelihood as the third output variable of the function estimate. I guess, that is the kind of log-likehood you want, because there is no such thing as a log-likelihood between real and predicted data. For the Akaika and BAyesian Information Criterion use the function aicbic (if you possess the Econometrics toolbox).
  1 Comment
JING QIAO
JING QIAO on 23 Jun 2022
May I ask how can I use aicbic in matlab for user defined functions? I tried to fit a set of data using different combinations of functions (sine, polynomial), I wanted to use aic/bic to test which one is a better function to model the data. From https://jp.mathworks.com/help/econ/aicbic.html, I need to provide the log-likelihood of the models. How can we calculate the log-likelihood?
Refer to https://jp.mathworks.com/help/ident/ref/idgrey.aic.html#buy65_c-model, it seems that the models are the ones defined by the matlab, such as
Is there a way to use aic/bic for the models defined by the user (e.g,, y1= ax+bx^2+c, y2=ax+dx^3+sin(x))? Many thanks in advance!

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Econometrics Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!