# K-step ahead forecast for an AR(2)

Given an AR(2) process $$y_{t}=\phi_{1}y_{t-1}+\phi_2 y_{t-2}$$, I understand that the two-step ahead forecast (that is, $$\mathbb{E}[y_{t+2}|y_t]$$ is given by $$(\phi_{1}^2+\phi_{2})y_{t}+\phi_{1}\phi_{2}y_{t-1}$$. However, I am unable to derive a general expression for the k-step ahead forecast (that is, for $$\mathbb{E}[y_{t+k}|y_{t}]$$. How might I go about doing this? Thank you.

• Hi: the only way to do is to assume some values for the error terms in the future. Usually, this is done by assuming that this value is equal to error term's expectation which is assumed to be zero. Once you do this, you can generalize your expression for k steps ahead. – mark leeds May 12 at 15:22
• So would I keep iterating until I find a discernible pattern? – Charles May 12 at 15:27
• Hi: yes, If you do $y_3$, you'll probably see it. If not, let me know and I'll try to help you out. I can't see it off the top of my head either. – mark leeds May 12 at 20:51

Let's define $$C_k$$ such that: $$\mathbb{E}(y_{t+k}|y_t) = C_k y_t.$$ Then: \begin{align*} \mathbb{E}(y_{t+k+1}|y_t) &= \phi_1 \mathbb{E}(y_{t+k}|y_t) + \phi_2 \mathbb{E}(y_{t+k-1}|y_t),\\ &= \phi_1 C_k y_t + \phi_2 C_{k-1} y_{t},\\ &= (\phi_1 C_k + \phi_2 C_{k-1}) y_t \end{align*} This gives us the following recursive second order difference equation: $$C_{k+1} = \phi_1 C_k + \phi_2 C_{k-1}.$$ Or, updated one period: $$C_{k+2}- \phi_1 C_{k+1} - \phi_2 C_k = 0.$$ This is a second order homogeneous difference equation, which is of the form $$C_k = \alpha a_1^k + \beta a_2^k$$. Computing $$a_1$$ and $$a_2$$ can be done by solving the following characteristic function: $$(a^2- \phi_1 a - \phi_2) = 0$$ This gives the following two roots: $$a_1 = \frac{\phi_1 + \sqrt{\phi_1^2 + 4 \phi_2}}{2} \text{ and } a_2 = \frac{\phi_1 - \sqrt{\phi_1^2 + 4 \phi_2}}{2}.$$ So in general we have: $$C_k = \alpha a_1^k + \beta a_2^k$$ To find $$\alpha$$ and $$\beta$$, we need two starting values, say $$C_0 = 1$$ and $$C_1 = \phi_1$$. In other words, we assume that $$\mathbb{E}(y_t|y_t) = y_t$$ and $$\mathbb{E}(y_{t+1}|y_t) = \phi_1 y_t$$.

This gives the following two conditions: $$\alpha + \beta = 1\\ \alpha \left(\frac{\phi_1 + \sqrt{\phi_1^2 + 4 \phi_2}}{2}\right) + \beta \left(\frac{\phi_1 - \sqrt{\phi_1^2 + 4 \phi_2}}{2}\right) = \phi_1.\\$$

Solving this system in terms of $$\alpha$$ and $$\beta$$ gives: $$\beta = \frac{\sqrt{\phi_1^2 + 4 \phi_2} - \phi_1}{2 \sqrt{\phi_1^2 + 4 \phi_2}}\\ \alpha = \frac{\phi_1 + \sqrt{\phi_1^2 + 4 \phi_2} }{2 \sqrt{\phi_1^2 + 4 \phi_2}}$$

This gives the following closed form expression condition: \begin{align*} \mathbb{E}(y_{t+k}|y_t) &= C_k y_t,\\ &=\left[\begin{array}{ll} &\frac{\phi_1 + \sqrt{\phi_1^2 + 4 \phi_2} }{2 \sqrt{\phi_1^2 + 4 \phi_2}}\left(\frac{\phi_1 + \sqrt{\phi_1^2 + 4 \phi_2}}{2}\right)^k\\ + &\frac{\sqrt{\phi_1^2 + 4 \phi_2} - \phi_1}{2 \sqrt{\phi_1^2 + 4 \phi_2}} \left(\frac{\phi_1 - \sqrt{\phi_1^2 + 4 \phi_2}}{2}\right)^k\end{array}\right] y_t \end{align*}

• that was n nice derivation but the OP was looking for a general non-recursive formula for the k-step ahead forecast. – mark leeds May 15 at 1:13
• @mark leeds : The $k$ step ahead should be equal to $\mathbb{E}(y_{t+k}|y_t) = (\alpha a_1^t + \beta a_2^t) y_t$. – tdm May 15 at 10:41
• Thanks. Did you mean to raise the $a's$ the $k$ and not to the $t$. Charles: I have to look at it more carefully when I have time ( looks interesting ) but I'm not sure if it was what you were looking for based on what you first wrote in your question ? Also, tdm, why does $\alpha + \beta = 1$ ? – mark leeds May 15 at 14:23
• yes sorry , the $t$'s have to be $k$'s I will change it. The values of $\alpha$ and $\beta$ have to be determined based on two values of $C_k$. An example is $C_0$ and $C_1$ but other values are also possible. Have a look at how to solve 2nd order difference equations. Any math book for economists should have a chapter on this. – tdm May 15 at 15:53
• thanks for correction. I'll definitely look more closely at what you did and do my best to follow it. What I'm not getting right now is that the optimal k-step ahead prediction should not be random so it doesn't "feel right" that $C_{0}$ and C_{1}\$ can have more than one value. But let me check it out more closely before you bother explaining more. – mark leeds May 16 at 1:37

Charles: I still haven't had time to look carefully at tdm's soluton but I did make my own so, assuming mine is correct, you can have two choices for what to do. I also still plan on going over tdm's solution when I have more time.

The original model is an AR(2): $$y_{t} = \phi_1 y_{t-1} + \phi_2 y_{t-2}$$.

Using the backshift operator, this can be re-written as

$$y_t(1 - \phi_{1} L) = \phi_2 y_{t-2}$$

$$y_{t} = \frac{\phi_{2}}{(1 - \phi_{1} L)} y_{t-2}$$

Assuming that $$|\phi_{1}| < 1$$, the denominator in the equation immediately above can be written as an infinite sum so that the expression for $$y_{t}$$ becomes:

`$$y_{t} = \phi_{2} \sum_{i=0}^{\infty} \phi_{1}^{i} y_{t-2-i}$$

So, given that one is at time $$t$$, an expression for the prediction of $$y_{t+1}$$ can be written that is made up of the past $$y_{t}$$. Specifically, if one wants to calculate the prediction of $$y_{t+1}$$, then using the expression derives above but increasing the index by 1, results in:

$$\hat{y}_{t+1} = \phi_{2} \sum_{i=0}^{\infty} \phi_{1}^{i} y_{t - 2 + 1 - i}$$

Note that the first term in the infinite sum above, is $$y_{t-1}$$ so everything in the sum is known at time $$t$$.

Similarly, if one is at time $$t$$ and wants to calculate the prediction of $$y_{t+2}$$, then using the same expression but increasing the index by 2, results in:

$$\hat{y}_{t+2} = \phi_{2} \sum_{i=0}^{\infty} \phi_{1}^{i} y_{t - 2 + 2 -i}$$

Again note that the first term in the infinite sum above, is $$y_{t}$$ so everything in the sum is known at time $$t$$.

Similarly, if one is at time $$t$$ and wants to calculate the prediction of $$y_{t+3}$$, then using the same expression but increasing the index by 3, results in:

$$\hat{y}_{t+3} = \phi_{2} \sum_{i=0}^{\infty} \phi_{1}^{i} y_{t - 2 + 3 -i}$$

Now notice that the first term in the infinite sum is $$y_{t+1}$$ which is not available at time $$t$$. Therefore, for the first term in the sum, the prediction at time $$t+1$$, $$\hat{y}_{t+1}$$, needs to be used in place than the actual value, $$y_{t+1}$$, since it is not known at time $$t$$.

Similarly, for $$\hat{y}_{t+4}$$, the predictions $$\hat{y}_{t+1}$$ and $$\hat{y}_{t+2}$$ will need to be used in the summation, in place of $$y_{t+1}$$ and $$y_{t+2}$$ since they are also not available at time $$t$$.

Using the same argument, the same forecasting procedure can to be used all the way upto and including $$\hat{y}_{t+k}$$.

$$\hat{y}_{t+k} = \phi_{2} \sum_{i=0}^{\infty} \phi_{1}^{i} y_{t - 2 + k - i}$$

Note though that the previous predictions need to be used in place of $$y_{t+1},y_{t+2},\ldots, y_{t+k-1}$$ in the expression for the infinite sum. I hope this helps. It seems like there should be an easier way but I could not discern a pattern when I played around so this seemed like the only way.

• Thank you very much! – Charles May 22 at 14:13
• No problem Charles: I hope it helps. one way to test the infinite sum formula is to run it and compare its output to the first couple that you derived. Of course, you need to simulate some AR(2) data in order to do that. – mark leeds May 23 at 16:40