4
$\begingroup$

I would like to create a linear distributed lag model in order to do some forecast and also being able to interpret the results.

Unfortunately I'm a bit confused with the process I should follow.Concept of time series is quite new for me so I'm looking for something simple.

I have a variable Y that I want to express by the lags of several other variables X1,...X4. It seems that the R-package dynlm is well adapted for this kind of model.

At the end, I would like to have this kind of relation :

what I want

So I would like to ascertain which lags of my exogeneous variables are significant for modeling Y. I first thought using cross-correlation (ccf() in R) but after browsing on CrossValidated, it seems that this is not that simple.

Indeed, all of my variables except one(X3) are not stationary. I could difference all of them but how can I then interpret the results ?

Furthermore, should I also prewhiten my data? (I know there is a function prewhithen() included in TSA package).

Here are my time series :

    ############################################## CROSS VALIDATED ##################################################################
    library(dynlm)
    library(tseries)

    Y<-c(2.39,2.29,2.54,2.53,2.57,2.59,2.58,2.64,2.79,2.78,2.81,2.79,2.38,3.09,2.94,2.91,3.15,2.93,2.83,2.92,3.18,3.08,3.10,3.13,0.91,3.28,3.72,3.89,3.97,6.00,5.84,5.66,6.35,6.26,6.14,6.04,4.28,4.55,7.78,7.12,6.43,5.93,5.32,5.26,5.77,5.65,5.52,5.05,4.56,5.21,3.66,4.01,4.11,4.19,3.87,4.06,4.14,4.12,4.15,4.37,4.58,4.32,4.11,3.83,3.66,3.58,3.34,3.41,3.61,3.55,3.51,3.25,3.09,3.14,2.80,2.92,3.09,3.07,2.89,2.93,2.97,2.92,2.83,3.01,2.75,2.60,1.17,1.52,1.80,1.69,1.76,2.30,2.13)
    X1<-c(3.8,4.0,4.3,4.4,4.7,4.4,5.0,5.2,5.2,5.2,5.4,5.5,5.8,6.3,6.3,6.7,6.9,6.5,5.8,5.5,5.0,5.0,4.9,4.8,5.0,5.0,4.9,5.0,4.8,4.7,4.7,4.7,4.6,4.8,3.6,3.6,3.5,3.3,3.2,3.3,3.4,3.2,3.1,3.0,3.1,3.1,3.0,3.0,3.0,3.2,3.1,3.2,3.1,2.9,2.7,2.8,3.0,2.9,3.0,3.0,3.0,2.9,3.0,2.9,2.8,2.6,2.5,2.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1.8,2.2,3.6,5.3,2.1,3.3,3.5,0.9,5.6,7.8,5.7,4.9,30.9,3.8,3.1,16.9,4.8,4.0,4.2,4.3,4.8,14.2,5.2,3.7,3.4,1.7,4.9,9.8,4.6,4.2,0.0,4.6,5.9,0.6,5.1,4.5,4.6,1.9,5.4,4.8,4.0,4.4,6.8,4.6,4.1,3.7,3.0,3.0,3.2,1.9,3.9,5.3,3.0,3.2,0.2,3.1,3.2,2.1,3.3,3.8,2.9,1.8,3.2,3.3,2.5,1.9,5.0,2.7,2.5,-1.7,2.6,2.9,1.2,2.2,5.9,0.8)

    ## Time series Creation
    Yts<-ts(Y, start=c(1998,1), end=c(2005,9), frequency = 12)
    X1ts<-ts(X1,start = c(1998,1),end = c(2005,9), frequency = 12)
    X2ts<-ts(X2,start = c(1998,1),end = c(2005,9), frequency = 12)
    X3ts<-ts(X3,start = c(1998,1),end = c(2005,9), frequency = 12)
    X4ts<-ts(X4,start = c(1998,1),end = c(2005,9), frequency = 12)

And this is a plot of my time series : enter image description here

Tell me if something is unclear, and sorry for my english.

Any help would be much appreciated!

edit : I reduced a bit my message to make it more concise :)

$\endgroup$
  • $\begingroup$ 1) Why the particular lag structure (1, 3, 5)? Don't you want the data to tell you this? Or was that just an example of a possible result? 2) If data is non-stationary, you cannot run that equation. First, check the integration order of each series. If they are all either I(0) or I(1), then you have two options: (A) run the model in differences; (B) check if there is cointegration (google Engel-Granger 2 step procedure) and if there is, run an error-correction model. Else, your results might be spurious. Nowadays no serious econometrist will accept a work that does not evaluates this. $\endgroup$ – luchonacho Jul 15 '16 at 10:01
  • $\begingroup$ Thanks you for your answer luchonacho. There is no particular lag structure ,it was just an example. My variables are - I think - all I(1) except X3 which is I(0). I am not sure about that. Could I still run the model in differences ? If yes how could I then interpret the results ? Ok I will have a look at cointegration and error-correction model to see if it's feasible. $\endgroup$ – CCheckpoint Jul 15 '16 at 10:19
  • $\begingroup$ Notice you are missing the coefficients in your regression. You need to carefully compute the equation with the model in differences (adding and substracting terms, re-organising them, in order to derive the final equation were every term is in differences (maybe not $X_{3}$). From this final equation you will see the coefficients that you are estimating. The interpretation is attached to the coefficients and NOT to the formulation of the equation. Find examples on google about how to differentiate I(1) series. I'm afraid that Time Series is not something you can do in a "simple" way. $\endgroup$ – luchonacho Jul 15 '16 at 10:30
  • $\begingroup$ Oh yes sorry for this mistake, I am going to correct it. I am going to try first to run the model in differences, and if it doesn't work I'll go for an Error-correction model. Indeed, Time Series study seems to require a lot of experience and adaptation capacity! $\endgroup$ – CCheckpoint Jul 18 '16 at 7:41
  • $\begingroup$ Still, try the Engel-Granger 2 step procedure. It is very simple to implement. $\endgroup$ – luchonacho Jul 18 '16 at 7:43
0
$\begingroup$

The bivariate normalized scatterplot shows no relationship between Y and X1, X2 or X3, but there is something for X4. The CCF shows no spikes except for X4. Only X1 needed prewhitening

The first 3 observations need to be dropped as there are missing values in the data.

We ran your data through Autobox(a software I am involed with) and it found a contemporaneous relationship plus a lag of 1 and 2 for X4 plus two time trends starting at period 1 and then another starting at period 47 plus 3 outliers and an AR1.

enter image description here

Bivariate Normalized Scatterplot of Y and X4

ACF Residuals

PACF Residuals

Residuals

Historical and Outlier Adjusted

Your early data looks very different from newer data. I used the last 57 observations and things look very different. The scatterplots SCREAM correlation using the newer data.

Here is the CCF using the prewhitened X1 series which shows a mild relationship. When X3 gets dropped the significance becomes a lot clearer between the X's and the Y. enter image description here

Version 2

$\endgroup$

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.