Modeling non-stationary time series

Universidad Privada Boliviana / Universidad del Pacífico (Lima, Perú)

Prof. J. Dávalos (Ph.D.)

Superconsistency and Cointegration

Spurious regression

  • Spurious regressions are identified when relating non-stationary variables that depend on the same deterministic trend.

  • Consult the link for a variety of spurious relationships examples. Many time series in the link are time dependent, probably exhibiting a unit-root, thus difference stationary: link

  • Now you are well versed in the concept of deterministic and stochastic trends associated to a unit-root process such as a random-walk with drift (constant).

Like in our previous link, let’s consider 2 unrelated variables whatsoever, both exhibiting unit-roots with drift process (\(X_t\) and \(Z_t\)). We can write them as:

  • \(Z_t = Z_0 + a_z t +\sum_{j=0}^{t-1}\varepsilon_{t-j}\)
  • \(X_t = X_0 + a_x t +\sum_{j=0}^{t-1}\eta_{t-j}\)

where \(\{\varepsilon_t\}\),\(\{\eta_t\}\) are two independent WN process, \(a_z\) and \(a_x\) are the variable specific drifts and \(X_0\) and \(Z_0\) are variable specific initial conditions.

  • A naive OLS regression between them leads to:

    • \(X_t = \alpha_0 + \alpha_1 Z_t + u_t\)
  • The slope parameter OLS estimator (\(x_t =X_t - \bar X\) and \(z_t =Z_t - \bar Z\) ) is :

    • \(\hat \alpha = \frac{\sum_t z_t x_t}{\sum_t z_t^2}\)
  • Its expectation \(E(\hat \alpha) = \frac{a_x}{a_z}\) . The relationship is just artificially given by the drifts’ ratio, irrespective of their structural relationship or economic meaning.

  • If Z has no drift, the estimated slope converges to infinity (high spurious relationship).

Exercise 1

Find the estimated intercept expectation \(E(\hat \alpha_0)\). For the sake of simplicity assume \(X_0 = Z_0 = 0\). In which case will this constant be large? Explain.

Integration order I(d)

  • A given variable integration order is denoted I(d)
  • It only applies to DS (difference stationary) process, not trend stationary ones.
  • Let \(X_t\) be a DS stationary variable. It is said to be integrated of order \(d\), \(I(d)\), if its d-th difference \(\Delta^dX_t\) is \(I(0)\)
  • In our previous session, you probably found that the log of the US GDP (I(1)) was stationary once first differentiated. \(\Delta \log GDP\) is \(I(0)\).
  • Traditional econometric estimation (OLS) demands for \(I(0)\) variables and WN error for statistical inference to hold.

Cointegration - (super)consistency

  • In the presence of I(d) variables (d>0) traditional statistical inference still holds as long as the residual of the relationship between I(d) variables is well behaved i.e. it is stationary, it must not exhibit a unit-root. Let \(Y_t\) and \(X_t\) share the integration order I(1), where both exhibit unit-root and are difference stationary:

\(Y_t = X_t \beta + \varepsilon_t\)

  • This relationship will not be spurious if and only if \(\varepsilon \sim I(0)\). \(Y_t\) and \(X_t\) (integrated variables) are said to be Cointegrated.

Example 1

Interest rates are often I(1) uroot process that may eventually move together. Its spread (difference) is just some sort of residual. As you can see, it does not behave as an stationary process. This relationship is spurious despite having economic theory linking both segments of the interest rate curve:

Example 2

Criptocurrencies tend to move according the overall sentiment in their market. Consider Bitcoin and Ethereum prices (both unit root process). Their residual, is more likely to be stationary i.e. they are likely to be cointegrated

  • Let’s recall that the OLS estimator in a cross sectional model:

    • \(Y =X\beta + \varepsilon\) was said it to be consistent i.e. its probability limit converges to the true value with probability 1 as the sample size goes to infinity:
    • \(plim_{n\rightarrow\infty} \hat \beta_{OLS}= \beta + plim_{n\rightarrow\infty} (X'X)^{-1}X'\varepsilon\)
    • The term \(plim_{n\rightarrow\infty} (X'X)^{-1}X'\varepsilon\) goes to 0 at a speed of \(\sqrt{n}\).
  • In a TS setup with cointegrated series, the OLS estimator converges quickly to the true value.
    • In a cross section or with stationary I(0) TS the variance of the OLS estimator, a measure of its precision, reduces at rate \(1/T\) (the greater the sample T, the better)
    • In cointegrated regressions, the variance reduces at a rate of \(1/T^2\). This is even better, this is super-consistency
  • This is a blessing considering that ARMA process required large T (and stationarity) before starting any modeling. With cointegrated series, T=10 is as precise as T=100 with a non-cointegrated series.
  • So before FD your I(1) unit-root variables, check for cointegration.

Some examples in economics and finance

  • The permanent income hypothesis describes how agents spread their consumption out over their lifetime based on their expected income. Consumption and income tend to be cointegrated.

  • Purchasing power parity is a theory that relates the prices of a basket of goods across different countries. Nominal exchange rates and domestic and foreign prices tend to be cointegrated.

  • The present value model of stock prices implies a long-run relationship between stock prices and their dividends or earnings. Stock prices and dividends or earnings tend to be cointegrated

Some examples beyond economics

  • Joint mortality models imply a long-run relationship between mortality rates across different demographics. Male and female mortality rates are cointegrated.

  • Comorbidities of different types of cancers (colon, pancreas, lungs, etc.) and trends in medical welfare tend to be cointegrated.

Testing Cointegration: Engle - Granger test

  • Robert Engle III (the ARCH guy) and Clive Granger (the guy behind the ARCH guy) developed a cointegration test.

  • It just requires implementing an ADF on the residuals of the suspected cointegrating relationship to test for the presence of a unit-root.

Example

  • In this example, we test for a cointegrating relationship between personal income and consumption using quarterly data from the US.

  • Notice that you need to first run the ADF test manually in order to identify the best possible lag order. This is the general to specific approach.

  • Once chosen then run the ADF test on the residuals using 10 lags.

  • The Engle-Granger cointegration test does not reject the null, thus the series are not cointegrated

clear all
webuse balance2
des

* OLS to generate the residuals

reg c y 
predict resid, r

* Engle Granger -> ADF over the residuals
* Do not forget to implemente the general to specific approach 
* in order to chose your lags

dfuller resid, lags(10) regress  // 
* we do not reject the null

* now we check that the residuals are well behaved

* Manual ADF residuals:
reg d.resid l.resid l.d.resid l2.d.resid ///
l3.d.resid l4.d.resid l5.d.resid l6.d.resid ///
l7.d.resid l8.d.resid l9.d.resid l10.d.resid ///


predict residadf, r
corrgram residadf , lags(12)
(macro data for VECM/balance study)


Contains data from https://www.stata-press.com/data/r17/balance2.dta
 Observations:            96                  macro data for VECM/balance study
    Variables:             7                  1 May 2020 20:12
                                              (_dta has notes)
---------------------------------------------------------------------------------------------
Variable      Storage   Display    Value
    name         type    format    label      Variable label
---------------------------------------------------------------------------------------------
gdp             float   %9.0g                 
t               byte    %tq                   
inv             float   %9.0g                 
consump         float   %9.0g                 
y               double  %10.0g                ln(gdp)
i               double  %10.0g                ln(investment)
c               double  %10.0g                ln(consumption)
---------------------------------------------------------------------------------------------
Sorted by: t

      Source |       SS           df       MS      Number of obs   =        96
-------------+----------------------------------   F(1, 94)        =  89664.72
       Model |  11.1797109         1  11.1797109   Prob > F        =    0.0000
    Residual |  .011720248        94  .000124683   R-squared       =    0.9990
-------------+----------------------------------   Adj R-squared   =    0.9989
       Total |  11.1914311        95  .117804538   Root MSE        =    .01117

------------------------------------------------------------------------------
           c | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
           y |   .9657169   .0032251   299.44   0.000     .9593135    .9721204
       _cons |   .0812369   .0111332     7.30   0.000     .0591318    .1033421
------------------------------------------------------------------------------



Augmented Dickey–Fuller test for unit root

Variable: resid                            Number of obs  = 85
                                           Number of lags = 10

H0: Random walk without drift, d = 0

                                       Dickey–Fuller
                   Test      -------- critical value ---------
              statistic           1%           5%          10%
--------------------------------------------------------------
 Z(t)            -1.566       -3.531       -2.902       -2.586
--------------------------------------------------------------
MacKinnon approximate p-value for Z(t) = 0.5007.

Regression table
------------------------------------------------------------------------------
     D.resid | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       resid |
         L1. |  -.0417991   .0266923    -1.57   0.122    -.0949968    .0113987
         LD. |    .498788   .1106241     4.51   0.000     .2783144    .7192615
        L2D. |   -.036609   .1188433    -0.31   0.759    -.2734635    .2002454
        L3D. |   .0587095   .1202338     0.49   0.627    -.1809161    .2983352
        L4D. |   .0582647   .1204789     0.48   0.630    -.1818494    .2983788
        L5D. |  -.1489162   .1204431    -1.24   0.220    -.3889589    .0911265
        L6D. |   .1377239   .1198047     1.15   0.254    -.1010464    .3764943
        L7D. |   .0138265   .1199474     0.12   0.909    -.2252283    .2528814
        L8D. |   .0182911   .1199008     0.15   0.879    -.2206708    .2572529
        L9D. |  -.2428174   .1212217    -2.00   0.049    -.4844119   -.0012229
       L10D. |   .3319739    .114083     2.91   0.005     .1046068     .559341
             |
       _cons |  -.0000486    .000246    -0.20   0.844    -.0005389    .0004416
------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =        85
-------------+----------------------------------   F(11, 73)       =      3.13
       Model |  .000168173        11  .000015288   Prob > F        =    0.0017
    Residual |  .000356967        73  4.8900e-06   R-squared       =    0.3202
-------------+----------------------------------   Adj R-squared   =    0.2178
       Total |   .00052514        84  6.2517e-06   Root MSE        =    .00221

------------------------------------------------------------------------------
     D.resid | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       resid |
         L1. |  -.0417991   .0266923    -1.57   0.122    -.0949968    .0113987
         LD. |    .498788   .1106241     4.51   0.000     .2783144    .7192615
        L2D. |   -.036609   .1188433    -0.31   0.759    -.2734635    .2002454
        L3D. |   .0587095   .1202338     0.49   0.627    -.1809161    .2983352
        L4D. |   .0582647   .1204789     0.48   0.630    -.1818494    .2983788
        L5D. |  -.1489162   .1204431    -1.24   0.220    -.3889589    .0911265
        L6D. |   .1377239   .1198047     1.15   0.254    -.1010464    .3764943
        L7D. |   .0138265   .1199474     0.12   0.909    -.2252283    .2528814
        L8D. |   .0182911   .1199008     0.15   0.879    -.2206708    .2572529
        L9D. |  -.2428174   .1212217    -2.00   0.049    -.4844119   -.0012229
       L10D. |   .3319739    .114083     2.91   0.005     .1046068     .559341
             |
       _cons |  -.0000486    .000246    -0.20   0.844    -.0005389    .0004416
------------------------------------------------------------------------------

(11 missing values generated)

                                          -1       0       1 -1       0       1
 LAG       AC       PAC      Q     Prob>Q  [Autocorrelation]  [Partial autocor]
-------------------------------------------------------------------------------
1        0.0341   0.0341   .10221  0.7492          |                  |        
2       -0.0626  -0.0644   .45138  0.7980          |                  |        
3       -0.0408  -0.0369   .60116  0.8962          |                  |        
4        0.0823   0.0833   1.2195  0.8749          |                  |        
5       -0.0519  -0.0642   1.4683  0.9167          |                  |        
6       -0.0378  -0.0260   1.6018  0.9524          |                  |        
7        0.0382   0.0428   1.7405  0.9728          |                  |        
8       -0.0038  -0.0255   1.7419  0.9879          |                  |        
9        0.0035   0.0217   1.7431  0.9949          |                  |        
10      -0.0144  -0.0159   1.7635  0.9979          |                  |        
11      -0.0981  -0.1168   2.7254  0.9939          |                  |        
12      -0.0276  -0.0072   2.8027  0.9968          |                  |        

Exercise 2

Consider the relationship between gold and silver prices. They seem correlated. If a meaningful long-run relationship, you could consider diversifying your investments in such commodities by not having great exposure to both metals. Cointegration would mean that a negative shock in one market, would affect the other and viceversa. Use the data available in the kaggle competition to analyse these commodities (link).