**Have a Question?**

**Phone:** +1 (888) 427-9486

+1 (312) 257-3777

Contact Us

# Cointegration Test

Attachment | Size | |
---|---|---|

Cointegration-101.pdf | ||

JohansenTest.xlsx |

In time series analysis, we often encounter situations where we wish to model one non-stationary time series ()as a linear combination of other non-stationary time series (). In other words:

In general, a regression model for non-stationary time series variables gives spurious (nonsense) results. The only exception is if the linear combination of the (dependent and explanatory) variables eliminates the stochastic trend and produces stationary residuals.

In this case, we refer to the set of variables as cointegrated. It is only in this case that we can look at regression as a reasonable and reliable model.

In this paper, we’ll discuss one important question:

- How do we examine a set of non-stationary variables for Cointegration?

In future issues, we’ll tackle the topics of long-run and short-run dynamics of cointegrated time series variables using OLS regression and error correction models.

### Motivation

Cointegration means that, while many developments can cause permanent changes in the individual variable (i.e. ), there is some long-run equilibrium relation tying the individual variables together, represented by some linear combination of them.

#### Why do we care?

Ignoring the cointegration aspect in time series variables may lead to a spurious regression problem, which occurs if arbitrarily trending and/or non-stationary series are regressed on each other.

- In the case of a deterministic trending series, the spuriously found relationship is due to the trend governing both series, instead of the economic forces.
- In the case of non-stationarity (of type ), the series – even without trend – tends to show local trends, which tend to co-move along for relatively long periods.

In trading, a trader may buy one security and hedge it with another type of security (e.g. spreads). Such strategies are based on the belief that two securities are somewhat related and a long-run equilibrium should exist between them.

In economics and finance, academics use cointegrated variables to test plausible economic relationships, under the hypothesis of a long-run equilibrium between non-stationary time series (e.g. disposable income vs. private consumption).

### background

In a nutshell, cointegration assumes there is a common stochastic non-stationary (i.e. ) process underlying two (or more) processes X and Y.

are stationary process ( ) with zero mean, but they can be serially correlated.

Although, and are both non-stationary ( ), there exists a linear combination of them, which is stationary:

In other words, the regression of Y and X yields stationary residuals .

In general, given a set of non-stationary (of type ) time series variables , there exists a linear combination consisting of all variables with a vector , such that:

Where .If this is the case, then the 's are cointegrated to the order of

### Testing of Cointegration

In principle, testing for Cointegration is similar to testing the linear regression residuals () for stationarity.

So, to establish a cointegration relationship, you would run first an OLS regression model for your variables and test the residuals for stationarity.

**Sounds simple?** It is. But which variable should we select as the dependent variable? Does it matter? It turns out that it does matter.

**Why?** The residuals vary based on which time series is designated as the dependent variable, and the tests may give different results.

One important test for cointegration that is invariant to the ordering of variables is the full-information maximum likelihood test of Johansen (aka Johansen test).

## Johansen Test

The Johansen test approaches the testing for cointegration by examining the number of independent linear combinations (k) for an m time series variables set that yields a stationary process.

**Why?**

Early in this paper, we stated that cointegration assumes the presence of common non-stationary (i.e. ) processes underlying the input time series variables.

The number of independent linear combinations (k) is related to the assumed number of common non-stationary underlying processes (p) as follows:

So, let’s consider three plausible outcomes:

- . In this case, time series variables are not cointegrated
- 0 < k < m, 0 < p < m. In this case, the time series variables are cointegrated.
- . All time-series variables are stationary ( to start with. Cointegration is not relevant here.

By examining the number of independent combinations, we are indirectly examining the cointegration existence hypothesis.

The Johansen test has two forms: the trace test and the maximum eigenvalue test. Both forms/tests address the Cointegration presence hypothesis, but each asks very different questions.

#### Trace Test

The trace test examines the number of linear combinations (i.e. ) to be equal to a given value (), and the alternative hypothesis for to be greater than

To test for the existence of Cointegration using the trace test, we set (no cointegration), and examine whether the null hypothesis^{i} can be rejected. If this the case, then we conclude there is at least one cointegration relationship.

In this case, we need to reject the null hypothesis to establish the presence of Cointegration between the variables.

#### Maximum Eigenvalue Test

With the maximum eigenvalue test, we ask the same central question as the Johansen test. The difference, however, is an alternate hypothesis:

So, starting with and rejecting the null hypothesis implies that there is only one possible combination of the non-stationary variables to yield a stationary process. What if we have more than one? The test may be less powerful than the trace test for the same values.

A special case for using the maximum eigenvalue test is when , where rejecting the null hypothesis implies the existence of m possible linear combinations. This is impossible, unless all input time series variables are stationary () to start with.

## Johansen Test With NumXL

In NumXL, the Johansen test combines these two test forms to examine the cointegration assumption:

- Trace Test for
- Maximum Eigenvalue Test for

To establish the existence of cointegration in a set of time series variables, we wish to reject the trace test null hypothesis () and not reject the null hypothesis of the maximum eigenvalue test ( ).

Now, let’s go over the steps for conducting a cointegration test in NumXL.

#### Step 1

Organized your input time series data as adjacent columns. Each column represents one variable and each row corresponds to an observation.

#### Step 2:

Locate the cointegration test icon in the NumXL menu or toolbar and click on it.

#### Step 3:

Using the cointegration wizard, select your input variables. The selection may include column labels.

**Note:** The “Mask” field is used to exclude variable/columns from the analysis without changing your input data in the worksheet. In our tutorial, we want to include all of them, so we can leave it blank.

After we select the input data, the “Options” and “Missing Values” tabs are enabled.

#### Step 4: (Optional)

Initially, all Johansen tests are selected and a maximum lag^{i} order is calculated from the input data, but you can override any of those options as you see fit.

Let’s leave it unchanged.

#### Step 5: (Optional)

If your input data does not have any missing values, you may skip this step.

By default, the cointegration wizard will trigger an error if any of the variables has a missing value. This is acceptable for this tutorial.

Click the “OK” button.

When examining the output tables, keep this in mind:

- Under the trace test, we asked whether there’s at least one possible linear combination for the input variables to yield a stationary process. We examined this question under different assumption for the input variable, and they all passed. Thus, we can conclude that the variables are cointegrated.
- Next, under the maximum eigenvalue test, we want to be sure that the number of linear combinations does not equal the number of input variables. Why? Because if they do, the input variables are stationary to start with, and cointegration is not relevant. Again, we carry on the test under different assumptions for the input variables. In this example, they all failed the test aside from one scenario, which passed marginally.

In conclusion, we would state that the input variables are cointegrated.

**Now what?** You may use OLS regression for one variable using the other variables without the risk of getting into a spurious regression problem.

Attachment | Size |
---|---|

Cointegration-101.pdf | 276.31 KB |

JohansenTest.xlsx | 18.63 KB |