Skip to content
All library documents

Constructing Mean-Reverting Portfolios with the Johansen Test

Code Stratmill research code

Summary

The document describes a software implementation of the Johansen cointegration method for forming mean-reverting portfolios from asset prices. It computes cointegration vectors, orders them by eigenvalue, and converts each vector into hedge ratios normalized so a chosen dependent asset has a ratio of one. If no dependent asset is specified, the first input column is used.

The implementation also stores Johansen trace and maximum-eigenvalue statistics with critical values when the input has no more than twelve assets; above that size, those statistics are not calculated. The fit accepts settings for deterministic terms and lag count. The text explains the implementation and its outputs, but provides no empirical trading results or guidance on selecting assets, validating stability, or setting trade and risk rules. The vectors identify candidate spreads; their presence alone does not establish profitability or ensure that a portfolio will remain mean reverting out of sample.

Key ideas

  • The Johansen procedure estimates multiple cointegration vectors from a set of asset prices.
  • Vectors are ordered by eigenvalue, with the first presented as the leading candidate for a mean-reverting portfolio.
  • Hedge ratios are normalized relative to a selected dependent asset, defaulting to the first input column.
  • Trace and maximum-eigenvalue statistics with critical values are stored only for datasets with at most twelve variables.
  • Lag count and deterministic-term settings affect the test specification.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.