Class Web Page



1. Non-stationary time series


Daily Price of Dow Jones

From Aug. 28 to Dec. 18, 1972 (Brockwell p.153)
  D = read.csv("https://nmimoto.github.io/datasets/dowj.csv", header=TRUE)
  Dowj  = ts(D, start=1, freq=1)    # turn D into TS object
  plot(Dowj, type="o")               # plot with both line and circle

Is this stationary?

Lake Huron Data

Annual Level of Lake Huron 1875-1972

  D = read.csv("https://nmimoto.github.io/datasets/lake.csv", header=TRUE)
  Lake  = ts(D[,1], start=1875,, freq=1)  # turn it into TS object startng year 1875
  plot(Lake, type="o")

Is this stationary?

2. Tests for Stationarity

How do you check if a time seirs is stationary?

  • Visual inspection for constant mean, constant variance

  • KPSS test (\(H_0\): Stationary)

  • ADF test (\(H_0\): Not Stationary)

  • PP test (\(H_0\): Not Stationary)

  • Fit AR(1), and see if \(\hat \phi_1\) is significantly different from 1.

KPSS test

Kwiatkowski-Phillips-Schmidt-Shin (1992) test for \[ \left\{ \begin{array}{ll} H_0: X_t \mbox{ is trend stationary}\\ H_A: X_t \mbox{ is not stationary} \\ \end{array} \right. \] Large p-value means “Stationary”. This is default choice in auto.arima(). Decompose the series as \[ X_t \hspace{3mm} = \hspace{3mm} T_t + W_t + Y_t \] where \(T_t\) is deterministic trend, \(W_t\) is random walk, and \(Y_t\) is stationary error. Lagrange multiplier test that the random walk has zero variance.

ADF test

Augumented Dickey-Fuller test (Brockwell p. 194). “Unit-root” test for \[ \left\{ \begin{array}{ll} H_0: Y_t \mbox{ is not stationary} \\ H_A: Y_t \mbox{ is stationary} \end{array} \right. \]

Is replaced by \[ \left\{ \begin{array}{ll} H_0: Y_t \mbox{ has unit root} \\ H_A: Y_t \mbox{ does not have unit root } \end{array} \right. \]

Small p-value rejects the null hypothesis of non-stationarity, and means “Stationary”.

Fit AR(1) to a time series, and test if \(\phi_1\) is significantly different from 1, by \[ \frac{ \hat \phi_1 -1 }{ SE(\hat \phi_1) } \sim N(0,1) \]

PP test

Phillips-Perron test for the null hypothesis that x has a unit root. Same hypothesis as ADF test.

Small p-value means “Stationary”.

The tests are similar to ADF tests, but they incorporate an automatic correction to the DF procedure to all ow for autocorrelated residuals.

Calculation of the test statistics is complex. The tests usually give the same conclusions as the ADF tests

P-value of (KPSS, ADF, PP) tests

(LARGE, small, small) \(\to\) All three indicating stationarity.

(small, LARGE, LARGE) \(\to\) All three indicating non-stationarity.

(anything else) \(\to\) Conflicing conclusions, inconclusive.



3. Stationarity.tests()


Random Sample

  # load Stationarity.tests() from class web page
  source('https://nmimoto.github.io/R/TS-00.txt')

  # Test it on random sample
  X = rnorm(100)
  plot(X, type="o")

  Stationarity.tests(X)
## Warning in adf.test(A): p-value smaller than printed p-value
## Warning in pp.test(A): p-value smaller than printed p-value
## Warning in kpss.test(A): p-value greater than printed p-value
##        KPSS  ADF   PP
## p-val:  0.1 0.01 0.01

Large, small, small \(\to\) stationary. As it should be.

Dow Jones data

  plot(Dowj, type="o")

  Stationarity.tests(Dowj)
## Warning in kpss.test(A): p-value smaller than printed p-value
##        KPSS   ADF    PP
## p-val: 0.01 0.655 0.847

small, Large, Large \(\to\) Not stationary.

Lake Huron Data

  plot(Lake, type="o")

  Stationarity.tests(Lake)
## Warning in kpss.test(A): p-value smaller than printed p-value
##        KPSS  ADF    PP
## p-val: 0.01 0.24 0.025

small, Large, small \(\to\) conflicting. First two is indicating Non-Stationarity, last one is indicating stationarity.

4. Ex: Australian Steel Data

  D  = read.csv("https://nmimoto.github.io/datasets/steel.csv")

  D1 = ts(D[,2], start=c(1956,1), freq=12)
  plot(D1, type="o")

  Stationarity.tests(D1)
## Warning in pp.test(A): p-value smaller than printed p-value
## Warning in kpss.test(A): p-value smaller than printed p-value
##        KPSS   ADF   PP
## p-val: 0.01 0.408 0.01
  D2 = window(D1, start=c(1969, 12))
  plot(D2, type="o")

  Stationarity.tests(D2)
## Warning in pp.test(A): p-value smaller than printed p-value

## Warning in pp.test(A): p-value smaller than printed p-value
##        KPSS   ADF   PP
## p-val: 0.01 0.049 0.01
  D4 = window(D2, end=c(1981,  12))    # Dec 1969 to Dec 1981
  plot(D4)

  Stationarity.tests(D4)
## Warning in adf.test(A): p-value smaller than printed p-value
## Warning in pp.test(A): p-value smaller than printed p-value
## Warning in kpss.test(A): p-value smaller than printed p-value
##        KPSS  ADF   PP
## p-val: 0.01 0.01 0.01
  D5 = window(D2, start=c(1984, 1))    # Feb 1984 to Nov 1993
  plot(D5)

  Stationarity.tests(D5)
## Warning in pp.test(A): p-value smaller than printed p-value
## Warning in kpss.test(A): p-value greater than printed p-value
##        KPSS   ADF   PP
## p-val:  0.1 0.046 0.01



Summary

  • Three popular test for stationarity is KPSS, ADF, and PP test.

  • Tests are availabe in R, can be implemented with below command.

  source('https://nmimoto.github.io/R/TS-00.txt')

  Stationarity.tests(X)
  • p-value of (Large, Small, Small) indicates stationarity.

  • p-value of (small, Large, Large) indicates non-stationairty.