0
$\begingroup$

I have to make a one-step ahead forecast for a time series Y(t) using R. Theory suggests the ideal model should be:

Y(t) = αX + βY$_{t-1}$ - βY$_{t-2}$

However, I don't know how to deal with the following issues:

  • I have to take βY$_{t-1}$ minus βY$_{t-2}$.
  • There are both autoregressive (Y$_{t-1}$,Y$_{t-2}$) and exogenous variables (X).
  • I have to test whether or not "βY$_{t-1}$ - βY$_{t-2}$" is the best way to express the autoregression, instead of other ARIMA models.

The time series Y(t) in question is:

Y <- c(57.4, 51.6, 36.1, 34.8, 41.2, 59.1, 62.5, 55.0, 53.8, 52.4, 44.5, 42.2, 50.1, 61.3, 49.6, 38.2, 51.1, 44.7, 40.8, 46.1, 53.5, 54.7, 50.3, 48.8, 53.7, 52.0)

The exogenous variable X used is:

X <- c(-12.1, 30.0, 13.5, 30.0, -3.8, -24.3, 30.0, 30.0, 30.0, 30.0, -21.6, 30.0, 0.0, 26.5, -30.0, 20.5, -4.8, -9.2, 22.2, -7.3, 15.9, 16.0, 13.7, 5.6, 5.7, 1.8)

I am a beginner. If anything was not clear, let me know and I will give the necessary explanations.

Thanks in advance.

Edit: It seems that these particular Y and X are not much effective. Nevertheless I am interested in the solution, which can be applied to different values of Y and X.

$\endgroup$
  • $\begingroup$ You might be better of on an R-specific site as you seem to need programming advice rather than statistical. Perhaps you can do a further edit if you can clarify the statistical aspects. $\endgroup$ – mdewey Nov 7 '16 at 9:51
  • $\begingroup$ @mdewey Thanks. The main statistical issue is the second point: whether it makes sense to model "Y(t-1) - Y(t-2)" rather than usual AR models. $\endgroup$ – thetax Nov 7 '16 at 10:07
  • $\begingroup$ It seems that the same question by the same author has been answered here: stackoverflow.com/questions/40471043/… $\endgroup$ – coffeinjunky Nov 8 '16 at 11:59
1
$\begingroup$

For arima modelling the best route is using the Arima and auto.arima functions in the forecast package.

To answer questions directly:

  1. You don't need to subtract a lagged variable you can use the equasion:

Y(t) = αX + βY$_{t-1}$ + βY$_{t-2}$

The Arima model as below will assign a negative value to your second Beta coefficient if such a pattern is found in the data.

2. Ar model with 2 lagged variables and exogenous regeressor:

library(forecast)

model <- Arima(y, order = c(2,0,0), xreg=X)
  1. Use model <- auto.arima(y, xreg=X) and a model will be automatically selected for you based on aicc comparison of multiple models. Use ?auto.arima for further details.

forecast(model, h= 12) will forecast the model for 12 more values.

Also look into Time series model cross validation for further model comparison.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ The above fits the model $(1-\beta_1 B-\beta_2 B^2)(Y_t - \mu - \alpha X_t)=w_t$ equivalent to a linear regression with residuals following an AR(2) process which is different from the model $(1-\beta_1 B-\beta_2 B^2)(Y_t - \mu) = \alpha X_t + w_t$ where $X_t$ influence not only $Y_t$ but also subseqeunt values. $\endgroup$ – Jarle Tufto Dec 15 '16 at 12:55
  • $\begingroup$ Correct, but your ARMAX version is also different from the model in the question, which constrained $\beta_1 + \beta_2 = 0$. $\endgroup$ – Chris Haug Dec 15 '16 at 14:57
0
$\begingroup$

Use ARIMA with regressor variable (but not that usually great to detect patterns, external regressor is usually not useful) or you may also try Mixed modeling (Granger causality)

| cite | improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ Could you add more details? $\endgroup$ – thetax Nov 7 '16 at 9:16
  • 3
    $\begingroup$ This is being automatically flagged as low quality, probably because it is so short. At present it is more of a comment than an answer by our standards. Can you expand on it? We can also turn it into a comment. $\endgroup$ – gung - Reinstate Monica Nov 7 '16 at 12:30
0
$\begingroup$

Which theory suggests that model?

Something that isn't clear: $\beta$ is a vector that contains $\beta_1, \beta_2, ..., \beta_n$?

If it is not, $\beta$ is the same, so

$Y(t) = \alpha X + \beta Y_{t-1} - \beta Y_{t−2}$ and the need to take $\beta Y_{t-1}$ minus $\beta Y_{t-2}$ may be achieved like this:

$Y(t) = \alpha X + \beta $($Y_{t-1} - Y_{t-2}$)

So think $Y_{t-1} - Y_{t-2}$ as $\Delta Y$

The model will be

$Y(t) = \alpha X + \beta \Delta Y$

Now you could look this $\beta$, with the same estimated value, as positive to t-1 and negative to t-2, because you forced that.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ I don't understand this answer. $\endgroup$ – Michael R. Chernick Jun 7 '18 at 20:59
  • $\begingroup$ The question does not tell us if the first and second $\beta$ are the same. My answer shows the transformation if they are. $\endgroup$ – André Oliveira Jun 7 '18 at 21:03
  • $\begingroup$ Just distributive property of multiplication. β(Y_{t−1} − Y_{t−2}) = βY_{t−1} − βY_{t−2} $\endgroup$ – André Oliveira Jun 7 '18 at 21:04

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.