# What is the exact log-likelihood of an AR(2) model?

Let's say we have the following AR(2) model:

$y_t=\phi_0+\phi_1y_{t-1}+\phi_2y_{t-2}+e_t, \; e_t\sim N(0,\sigma^2_e)$

with T observations in total.

Working out the conditional log-likelihood is straight forward:

$LLF(\theta)=-\frac{T-2}{2}\ln(2\pi\sigma^2_e)-\sum_{i=3}^T\frac{(y_i-\phi_0-\phi_1y_{t-1}-\phi_2y_{t-2})^2}{2\sigma_e^2}$

where $\theta=(\phi_0, \phi_1, \phi_2)$.

Now, to find the exact likelihood we need to know the densities of $y_1$ and $y_2|y_1$. Assuming stationarity, the mean and variance of $y_1$ are simply the unconditional mean, $\mu$, and unconditional variance, $\sigma^2$, of the process which gives us

$f(y_1|\theta)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{(y_1-\mu)^2}{2\sigma^2}\right)$

where $\mu=\frac{\phi_0}{1-\phi_1-\phi_2}$ and $\sigma^2=\frac{\sigma^2_e}{1-\phi_1^2-\phi_2^2}$.

However, I don't know how to find the conditional density of $y_2|y_1$. Specifically, how do you find the conditional mean and variance? I suspect that $E[y_2|y_1]$ will be of the form $a+by_1$ but I don't know how to find a and b. Any help on this would be great!

• Take a look at the related questions on the right panel, maybe you will find what you need. – Richard Hardy May 20 '16 at 14:44
• I've looked around but haven't been able to find anything on AR(2) models (or indeed AR(p) models). Most questions only deal with AR(1) models. But thanks for the tip, it caused me to look around some more! – Mark May 20 '16 at 15:21
• I'm curious about the general problem of finding the exact maximum likelihood estimates for any ar(p) time series. I have an approach which seems to be really promising, but kind of silly if this is already solved. If not solved I'll try to write it up as an answer. – dave fournier Sep 29 '17 at 4:49
• AFAIK, the initial values in the AR likelihood are a general problem which is dealt with by setting them to the unconditional mean of the process. Therefore, the conditional pdf is not needed. But, for the specifics, harvey's econometric analysis of time series, will most likely have the derivation in there. If I can find the text and the section, I'll reply again. – mlofton Oct 30 '18 at 22:48
• I did find the book and the discussion is more involved than I thought ( and Harvey's descriptions are succinct to say the least ) but my suggestion above is one of them. If you want to read Harvey's discussion and don't have the book, I can send you the pages offline but I imagine that, since it's a pretty generic problem which holds for all AR(p) models, Hamilton and other decent time-series books should discuss it also. Still, I recommend Harvey's text because, although he's succinct, there's a lot of good stuff in there even if you only realize this after reading it 5-10 times as I have. – mlofton Oct 30 '18 at 22:55