If two (or more) time series are integrated of same order (e.g. of order one I(1)), but their linear combination is integrated of lesser order (e.g. integrated of order zero I(0)), then these series are cointegrated.
In the vector notation: if yt is (n x 1) vector of time series (y1,t, y2,t, ... yn,t)' all integrated of order I(d) and β is (n x 1) cointegrating vector (β1, β2, ... βn)' , then if there exists linear combination zt integrated of order I(d-b), the vector of time series is cointegrated I(d,b).
In fact, there can be more than one cointegrating vectors, then we are dealing with (n x r) matrix β. There can be 0<r<n cointegrating vectors. It follows that there are n-r common stochastic trends.
One advantage of cointegration is that the problem of “spurious regression” can be avoided in this case, as the least square regression gives unbiased and superconsistent estimates.
Another advantage is that it is a long-term model (e.g. captures long-term relationship between levels of two time series y and x) in contrary to a model fitted on differenced data which would be a short-term model (e.g. captures effect of change in x on change of y). Combination of both approaches (short- and long-term models) is known as error correction model (ECM), which is self-regulating model that allows for short-term autoregressive behavior but after some time always aligns time series into equilibrium given by cointegrating vectors.
To test for cointegration and to create an error correction model, several approaches are possible, most common are the Engle-Granger's two step estimation and Johansen‘s vector autoregressive (VAR) technique. While the Engle-Granger's approach is easier to perform, it allows only one cointegrating vector at most (one has to decide which of the series is dependent and which are idependent).
Showing posts with label stationarity. Show all posts
Showing posts with label stationarity. Show all posts
Wednesday, April 12, 2017
Cointegration and error correction model
Labels:
cointegration,
spurious regression,
stationarity,
time series
Friday, March 3, 2017
Time series (theoretical concept)
A time series is a collection of random variables {Y1,Y2,…YT} ordered in time. There is a stochastic process {Yt} that generates the series. Each element Y1,Y2,…YT of the series is a random draw from a probability distribution. However we can only observe one particular realization of the stochastic process {y1,y2,..yT} in reality.
The stochastic process {Yt} is then described by a T-dimensional joint probability distribution. The(unknown) parameters (mean, variance, covariance) of the joint probability distribution of {Yt} are, for each t=1,2…T:
For a weakly stationary time series it holds that:
To infer the parameters from a particular observed realization, we assume the process to be ergodic (the sample moments approach the population moments as T becomes infinite).
The stochastic process {Yt} is then described by a T-dimensional joint probability distribution. The(unknown) parameters (mean, variance, covariance) of the joint probability distribution of {Yt} are, for each t=1,2…T:
For a weakly stationary time series it holds that:
To infer the parameters from a particular observed realization, we assume the process to be ergodic (the sample moments approach the population moments as T becomes infinite).
Thursday, February 16, 2017
The Dickey-Fuller unit root test (stationarity test)
The Dickey-Fuller test is a unit root test. Presence of unit root is only one of potential causes of non-stationarity, therefore in the strict sense it is not a comprehensive stationarity test.
The hypotheses are set in following way:
H0: unit root is present in the sample
H1: stationarity or trend-stationarity
Definition of unit root is based on characteristic equation. Having autoregressive process (with zero-mean, no autocorrelation and constant variance error εt):
Then m is root of characteristic equation:
If m=1 then it is a unit root.
In case of first order autoregressive process the characteristic equation becomes:
In this example, the m is unit root (m=1) if just when γ1=1.
If there is unit root in this first order autoregressive process, the process is non-stationary (it is integrated of order one I(1)) as its properties depend on particular time t:
Therefore to test unit root presence in first order autoregressive process AR(1):
Depending on what is the hypothesis, the testing regression model differs:
If hypothesis is a unit root process:
If hypothesis is a unit root process with drift:
If hypothesis is a unit root process with drift and time trend:
We are testing whether δ=0 (γ=δ+1=1), that is null hypothesis of unit root presence. However the testing statistic t does not have standard distribution. Instead Dickey-Fuller distribution tables have to be used (which are specific for each of three stated null hypothesis).
Apparently the test has low power (ability to reject the null if alternative is true) because it’s difficult to distinguish unit root from root near but less than one. It is therefore encouraged to really follow “graphics” and “common sense” before performing actual hypothesis test (Bo Sjo: Testing for Unit Roots and Cointegration).
To decide which of the tree variants of test shall be used, it’s best to rely on the knowledge about the nature of time series (is the presence of intercept or slope a rational expectation given the time series?). If such knowledge is missing, other approaches can be considered (Dolado, Jenkinson, Sosvilla-Rivero: Cointegration and Unit Roots).
Since the null hypothesis is non-stationarity (while in some other tests the null is stationarity, e.g. KPSS test), it is good idea to apply Dickey-Fuller test anytime we have good reason to believe the series is non-stationary (Bo Sjo: Testing for Unit Roots and Cointegration).
We are testing whether time series is I(1) - integrated of order one. If the time series is already differenced we are testing I(2). In such case if the I(2) is not rejected then it makes no sense to test for I(1) anymore.
The Augmented Dickey-Fuller test is a natural extension of the simple test by adding p lags to the process, hereby considering autoregression beyond first order:
Setting order p is an interesting question though. It is suggested to start with higher lags and cut it down continually. Alternatively information criteria (AIC, BIC, …) can be used.
The R adf.test function that is often used tests the third form of hypothesis (incl. intercept and slope). The R ur.df or adfTest functions enables choosing of appropriate null hypothesis.
The hypotheses are set in following way:
H0: unit root is present in the sample
H1: stationarity or trend-stationarity
Definition of unit root is based on characteristic equation. Having autoregressive process (with zero-mean, no autocorrelation and constant variance error εt):
Then m is root of characteristic equation:
If m=1 then it is a unit root.
In case of first order autoregressive process the characteristic equation becomes:
In this example, the m is unit root (m=1) if just when γ1=1.
If there is unit root in this first order autoregressive process, the process is non-stationary (it is integrated of order one I(1)) as its properties depend on particular time t:
Therefore to test unit root presence in first order autoregressive process AR(1):
Depending on what is the hypothesis, the testing regression model differs:
If hypothesis is a unit root process:
If hypothesis is a unit root process with drift:
If hypothesis is a unit root process with drift and time trend:
We are testing whether δ=0 (γ=δ+1=1), that is null hypothesis of unit root presence. However the testing statistic t does not have standard distribution. Instead Dickey-Fuller distribution tables have to be used (which are specific for each of three stated null hypothesis).
Apparently the test has low power (ability to reject the null if alternative is true) because it’s difficult to distinguish unit root from root near but less than one. It is therefore encouraged to really follow “graphics” and “common sense” before performing actual hypothesis test (Bo Sjo: Testing for Unit Roots and Cointegration).
To decide which of the tree variants of test shall be used, it’s best to rely on the knowledge about the nature of time series (is the presence of intercept or slope a rational expectation given the time series?). If such knowledge is missing, other approaches can be considered (Dolado, Jenkinson, Sosvilla-Rivero: Cointegration and Unit Roots).
Since the null hypothesis is non-stationarity (while in some other tests the null is stationarity, e.g. KPSS test), it is good idea to apply Dickey-Fuller test anytime we have good reason to believe the series is non-stationary (Bo Sjo: Testing for Unit Roots and Cointegration).
We are testing whether time series is I(1) - integrated of order one. If the time series is already differenced we are testing I(2). In such case if the I(2) is not rejected then it makes no sense to test for I(1) anymore.
The Augmented Dickey-Fuller test is a natural extension of the simple test by adding p lags to the process, hereby considering autoregression beyond first order:
Setting order p is an interesting question though. It is suggested to start with higher lags and cut it down continually. Alternatively information criteria (AIC, BIC, …) can be used.
The R adf.test function that is often used tests the third form of hypothesis (incl. intercept and slope). The R ur.df or adfTest functions enables choosing of appropriate null hypothesis.
Labels:
stationarity,
test,
time series,
unit root
Monday, February 6, 2017
Stationarity in time series
Formally: A time series y1,y2,... is nonstationary if, for some m, the joint probability distribution of yi, yi+1, ..., yi+m-1 is dependent on the time index i (definition by WolframMathworld)
Strong form of stationarity: A time series whose joint probability distribution does not change in time
Weak form of stationarity: A time series whose mean and autocovariance do not change in time (i.e. mean is the same at any time and covariance only depends on lag, not on time).
Practically: If the time series appear mean-reverting it is most probably stationary. If, on the contrary, it is drifting up or down, it is probably not. If the autocorrelation function drops to zero quickly on higher lags, it is probably stationary. On the contrary, ACF for non-stationary time series decreases very slowly. "Time series with trends, or with seasonality, are not stationary. A time series with cyclic behavior is stationary - that is because the cycles are not of fixed length, so before we observe the series we cannot be sure where the peaks and troughs of the cycles will be" (Rob J. Hydman: Forecasting: principles and practice).
The problem with non-stationarity is also known as “spurious regression” problem. When dealing with two (or more) non-stationary time series, very high correlation is often found between them, despite lack of any rational causality. What is often overlooked and ignored in many studies is that the correlation and regression coefficients might be misleading if assumptions (non-stationarity) are not met. The problem is that sample estimates of correlation and regression coefficients can not be interpreted as population parameters at all in such case (Johansen: Correlation, regression, and cointegration of nonstationary economic time series).
Treatment of non-stationarity is possible:
The ultimate goal of non-stationarity remedies should be however to obtain stationary residuals. A model with non-stationary dependent or independent variables should not present a problem as long as model errors are stationary. A prime example would be cointegration model, which is a correct model describing two processes which evolve in an equilibristic relationship.
Strong form of stationarity: A time series whose joint probability distribution does not change in time
Weak form of stationarity: A time series whose mean and autocovariance do not change in time (i.e. mean is the same at any time and covariance only depends on lag, not on time).
Practically: If the time series appear mean-reverting it is most probably stationary. If, on the contrary, it is drifting up or down, it is probably not. If the autocorrelation function drops to zero quickly on higher lags, it is probably stationary. On the contrary, ACF for non-stationary time series decreases very slowly. "Time series with trends, or with seasonality, are not stationary. A time series with cyclic behavior is stationary - that is because the cycles are not of fixed length, so before we observe the series we cannot be sure where the peaks and troughs of the cycles will be" (Rob J. Hydman: Forecasting: principles and practice).
The problem with non-stationarity is also known as “spurious regression” problem. When dealing with two (or more) non-stationary time series, very high correlation is often found between them, despite lack of any rational causality. What is often overlooked and ignored in many studies is that the correlation and regression coefficients might be misleading if assumptions (non-stationarity) are not met. The problem is that sample estimates of correlation and regression coefficients can not be interpreted as population parameters at all in such case (Johansen: Correlation, regression, and cointegration of nonstationary economic time series).
Treatment of non-stationarity is possible:
- If there is a deterministic trend, the time series can be in fact “trend stationary process” as it mean-reverts to a level determined for each time t by function f(t) (e.g. linear time trend f(t)=βt). By simply subtracting trend f(t) we obtain stationary process.
- If the series drifts up or down (the process is not mean-reverting because stochastic shocks persists a.k.a. there is a unit root) then differencing helps. Typical example would be random walk process.
- If there is deterministic seasonality, set of dummy variables can capture the seasonal component.
- If there is changing seasonal effect, then seasonal differencing helps.
- If there is increasing variance, log transformation can be applied (to remedy the variance problem in general, the Box-Cox transformation function helps).
The ultimate goal of non-stationarity remedies should be however to obtain stationary residuals. A model with non-stationary dependent or independent variables should not present a problem as long as model errors are stationary. A prime example would be cointegration model, which is a correct model describing two processes which evolve in an equilibristic relationship.
Subscribe to:
Posts (Atom)











