3
$\begingroup$

I'm currently trying to use a variable x (and others) to explain a dependent variable y in a distributed lag model (with the long term goal of predicting variable y). The plot of variable x shows an evident seasonality at the end of the year: See https://i.sstatic.net/PbrJ5.png

After having deseasonalized the data with decompose (with multiplicative components), adf and kpss tests indicate, that the seasonal adjusted data is still not stationary. Because there are more independent variables and I don't want to look deeper into investigation a cointegration relationship between those series, I thought it would be the most usual way to take the difference of both series (with the diff() function).

Now there are 2 alternatives:

  1. Take the diff of the already seasonal adjusted data. The problem with this approach is, that I'm not sure if this a good idea because I don't see how you can reseasonalize the time series for a forecast result in an easy manner.
  2. Take the diff of the raw series. This leads to the following graph. See https://i.sstatic.net/OXhhd.png The time series is now stationary regarding adf and kpss tests, however there is still the seasonal pattern visible. Now I'm not sure if it is recommended to use decompose (with the multiplicative) method, to deseasonalize the diff of the time series, especially because there are zero values which have no effect when calculating the seasonal adjusted time series in the following way:
decompose(x_diff, "mult")$x / decompose(x_diff, "mult")$season

So, how should I proceed when I want to include (the diff of) x as a independent (and lagged) variable in a distributed lag model?

$\endgroup$

2 Answers 2

3
$\begingroup$
  1. Try a seasonal ARIMA model. The auto.arima() function in the "forecast" package has an automatic algo. The function documentation points to a paper by Hyndman and Khandakar.

  2. There also exist seasonal differencing and seasonal unit root tests. These tests are called: Canova-Hansen, OSCB, HEGY and a little known one by Kunst (1997). Search for them in Google scholar. D. Osborne is well known in this field. There is also a great time series book by Phillip Hans Franses. You should be looking for a seasonal unit root and seasonal lags. It is also possible to have both a seasonal unit root and a non-seasonal unit root. Likewise, both seasonal lags and non-seasonal lags.

  3. Try an ETS model. It is implemented in the ets() function of the forecast package. Again, the documentation points to the literature.

$\endgroup$
4
  • $\begingroup$ Thank you for your help, but I have one/two more question(s): When I've fitted e.g. an ARIMA model for each time series I want to explain the time series with, how do I proceed? Is there some way to automate the model selection process (ideally with R)? $\endgroup$ Commented Jan 23, 2013 at 20:23
  • $\begingroup$ Automatically choosing a model: The auto.arima() function in the forecast R package will automatically choose a Seasonal ARIMA model. By default, it uses the AICc when selecting different lags. The forecast package will automate model selection within one class of models, for example SARIMA. You could also write your own code to do a walk forward/rolling window test to choose between all possible models. $\endgroup$
    – power
    Commented Jan 24, 2013 at 11:42
  • $\begingroup$ Once the model has been "fitted", you can make a forecast. In the example of an ARIMA model in R as described above, use the forecast.Arima() function. The code would be my.model<-auto.arima(my.ts); forecast(my.model) I used ";" to denote a new line, it's not part of the R code. In general, you pass the last x observations to the model and calculate as per the equation y(t+h) = whatever. $\endgroup$
    – power
    Commented Jan 24, 2013 at 11:46
  • $\begingroup$ Also, when using a seasonal time series with the forecast package, you should set up a ts or msts object. Type ?ts or ?msts to see the documentation entry. Also you know about S3 objects, right? If not, the R Inferno has a quick intoduction. Search in Google for "R Inferno". $\endgroup$
    – power
    Commented Jan 24, 2013 at 11:49
0
$\begingroup$

Do you deasonalize first using presumed structure : Do you transform first based upon the original data while the statistcal assumptions are about the constancy of the variance of the errors ? Do you difference first ? All of the above "transformations" have side-effects and should be employed when needed. Read up on Transfer Functions which incorporate identifiable amomalies in the data such as Pulses, Seasonal Pulses, Level shifts and/or Local Time Trends while delivering a useful model incorporating both known and unknown series..

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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