AR(1) Forecasting and Converting R’s Intercept to the Forecast Form
Article Quant Q&A · Author: Laura
Summary
The document explains how to obtain multi-step forecasts for an AR(1) process using its difference-equation, moving-average, and autoregressive representations. Its central point is that R reports the constant in a centered ARIMA form. When writing the one-step forecasting equation, the corresponding intercept is that constant multiplied by one minus the AR coefficient. The innovation term has conditional expectation zero, so it does not enter the forecast.
Key ideas
- R’s AR(1) output expresses the process around a constant that is not the forecasting equation’s intercept.
- The one-step forecast uses the reported constant multiplied by one minus the AR coefficient.
- Multi-step forecasts can be obtained by recursively substituting earlier forecasts into the AR equation.
- The moving-average representation expresses forecasts through weighted past residuals.
- For higher-order AR models, converting the constant to a forecasting intercept requires additional algebra.
Tags
Full text
# FORECASTING Model AR(1) in an Autoregressive Form The Pi´s Parameters
# FORECASTING Model AR(1) in an Autoregressive Form The Pi´s Parameters
Ive been implementing a little exercise to obtain the first 2 forecasting points of an AR(1) process. And i want to have the forecasting ponts using the three forms: Im folowing this pdf http://www.le.ac.uk/users/dsgp1/COURSES/BANKERS/BANKERS6.PDF
Difference Equation Forms, Moving Aerage Form and Auroregressive Form:
I did well for the first two forms:
```
library(forecast)
set.seed(20141221)
x <- arima.sim(n=108, list(ar=0.5))
data.ts <- ts(x, start=c(1999,01), freq=12)
time = window(data.ts, start=c(1999,01),end=c(2007,12))
inflarima1 <- arima( x,order = c(1, 0, 0))
inflarima1$coef
# ar1 intercept
#0.4945659 0.2069526
predict(inflarima,2)$pred
#Jan Feb
#2008 0.1147776 0.1613660
```
FIRST FORM: Difference Equation Form
```
# c^= INTERCEPT*(1-phi)
#h=1 -> yt+1 = c^ + phi*Yt
0.2069526*(1-0.4945659) + 0.4945659*x[108]
0.1147776
#h=2 -> yt+1 = c^ + phi*Yt+1 = c^ + phi*[c^ + phi*Yt]= c^+phi*c^+ phi^2*Yt
0.2069526*(1-0.4945659) + 0.2069526*(1-0.4945659)*0.4945659
+ 0.4945659^2*x[108]
0.1613660
```
SECOND FORM: MOVING AVERAGE
```
#Forecasting h=1;
#Yt+h = mu + phi*et + phi^(2)*et-1 +... + phi^(108)*et-107
#residuals<-inflarima1$residuals
MatrizFIrstForecasting<-matrix(NA,108,1)
for (i in 108:1) {
MatrizFIrstForecasting[i]<-residuals[i]*0.4945659^(108-(i-1) )
}
#Yt+1 = mu + phi*et + phi^2*et-1 + ... + phi^108*et-107
0.2069526 + sum(Matrizphie) #0.1147776
#Forecasting h=2;
#Yt+h = mu + phi^2*et + phi^(3)*et-1 +... + phi^(109)*et-107
MatrizSECONDForecasting<-matrix(NA,108,1)
for (i in 108:1) {
MatrizSECONDForecasting[i]<-residuals[i]*0.4945659^(108-(i-2) )
}
#Yt+2 = mu + phi^2*et + phi^3*et-1 + ... + phi^109*et-107
0.2069526 + sum(MatrizSECONDForecasting) #0.161366
```
So far so it worked...the problem is that I am not being able toimplement for the third form. I belive my code is wrong.
Could you help me find my mistake?
Third Form: Autoregressive
```
Y^_t+1|t = pi_1*yt + pi2*yt-1 + ... + pi_108*yt-107... CORRECT?
```
The PI´s coefficient are obtained like this?
```
pi_1 = (-phi_1) ; pi_2 = (-phi_1)^2 ; pi_3= (-phi_1)^3; ...;pi_108 = (-phi_1)^108
```
Thus,
I build a code for the first forecasting:
```
MATRIZpi<-matrix(,108,1)
for (i in 108:1) {
MATRIZpi[i]<-x[108-(108-i)]*(0.4945659)^(108-(i-1))
}
```
and the i sum each line of MATRIZpi matrix, to obtain:
```
Y^_t+1|t = pi_1*yt + pi2*yt-1 + ... + pi_108*yt-107
sum(MATRIZpi)
The value is 0.2099202
```
Obviously this wrong. I already modified the code a few times and I can not fix.
Could you suggest me something?
## Answer by Colin T Bowers (score 2, accepted)
https://quant.stackexchange.com/a/19115
I am struggling a little to understand your question, but I suspect I know where you're running into trouble, because it is a question we frequently use on students to test their understanding of how R estimates ARIMA models.
When you estimate an ARIMA model in R, the output is provided in what we often call Normal form. For the specific case of an AR(1) model, the normal form is:
\begin{equation} (1 - \phi L)(Y_t - c) = \epsilon_t \end{equation}
where $L$ is the lag operator, $\phi$ is the AR(1) coefficient, and $c$ is the constant parameter that is output by R. Now, let's say we want to turn all of this into a forecasting equation. We need to get $Y_t$ on the left hand side, and everything else on the right hand side. If you grind through the maths, you'll find that we end up with:
\begin{equation} Y_t = c(1 - \phi) + \phi Y_{t-1} + \epsilon_t \end{equation}
Aha! Note that the intercept term in our forecasting model, ie $c(1 - \phi)$, is not equal to the "intercept" term output by R, which I have denoted just $c$ above. So if you just used $c$ as the intercept term in your forecasting equation, you'll get the wrong answer, which I think is where you're going wrong above.
So, just to be very clear. If $\phi$ is the AR(1) coefficient output by R, and $c$ is the intercept term output by R, then your forecasting equation for an AR(1) should be:
\begin{equation} \mathbb{E}_t Y_{t+1} = c(1 - \phi) + \phi Y_t \end{equation}
where the $\epsilon_{t+1}$ term dropped out because by assumption $\mathbb{E}_t \epsilon_{t+1} = 0$
Note that for an AR(p) model with $p>1$, the correct intercept term to use the forecasting equation is a bit more complicated again. Deriving it is a good exercise. Fortunately, there is no interaction between the $c$ term and any MA coefficients, so for an ARMA(p, q), you only need to worry about the interaction with the AR(p) bit.
If you're struggling with this, the best thing is to write down an ARMA(p,q) in Normal form, and then try and convert it into a forecasting equation, and then try and convert it back. For reference, the Normal form for an ARMA(p,q) is:
\begin{equation} (1 - \phi_1 L - ... - \phi_p L^p) (Y_t - c) = (1 + \theta_1 L + ... + \theta_q L^q) \epsilon_t \end{equation}Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.