I have a time series (quarterly data) that I will use to predict the upcoming 4 quarters.The total number of observations is 20 quarters, thus, I need to predict quarter 21 -> 24. First I took the diff(data) to have a stationary data and I want to fit AR(1). I am using the following in R:

arima(diff(data), order=c(1,0,0)) and I obtained: ar1 (- 0.2441) and Intercept (1.2004)

Is the following correct?

∆y(t+1) = 1.2004 - 0.2441*∆y(t)

∆y(t+2) = 1.2004 - 0.2441*∆y(t+1)

If I want to predict y(t+1), do I find ∆y(t+1) and then

y(t+1) = y(t) + ∆y(t+1)

y(t+2) = y(t) + ∆y(t+1)+ ∆y(t+2)

and so on... until y(t+4)

Is this analogy correct? Do you know how can I get the predicted value in R without doing it manually? How can I tell R that first I need to predict the delta and then the original value.


The answer by Gennaro Tedesco gives the forecasts for the differenced data. If you need forecasts for the original data, you may use

predict( arima(data,order=c(1,1,0)), n.ahead=4 )

where the order argument being c(1,1,0) rather than c(1,0,0) reflects that you want to fit an AR(1) model to differenced rather than original data. In other words, specifying the middle number in the order argument to be 1 rather than 0 does the differencing for you.

Regarding why you cannot obtain the same results manually as obtained by arima, perhaps the problem is the following. "Intercept" in the output of an ARIMA model in R may be a little misleading. That is, an AR(1) with "intercept" equal to $\mu$ means (in R)

$$ (x_t-\mu) = \varphi (x_{t-1}-\mu) + \varepsilon_t $$

rather than

$$ x_t = \mu + \varphi x_{t-1} + \varepsilon_t. $$

The latter part of my answer is based on this post, see especially ISSUE 1. Meanwhile, ISSUE 2 is very relevant to the former part of my answer.


Thank you for your reply. The command

forecast(model, h=4)

will predict ∆y(t+i), is there a way to predict y(t+i) directly in R? I used the command

predict (model, n.ahead=4)

and I had the same values as forecast. However, if I do it manually and use the coefficient of the autoregression, the values of ∆y(t+i) are different than teh one provided by the forecast or predict commands. Do you have an idea why?

Thank you!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.