# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.cointegration

## Class CointegrationMLE

• java.lang.Object
• com.numericalmethod.suanshu.stats.cointegration.CointegrationMLE

• public class CointegrationMLE
extends Object
Two or more time series are cointegrated if they each share a common type of stochastic drift, that is, to a limited degree they share a certain type of behavior in terms of their long-term fluctuations, but they do not necessarily move together and may be otherwise unrelated. If two or more series are individually integrated (in the time series sense) but some linear combination of them has a lower order of integration, then the series are said to be cointegrated. A common example is where the individual series are first-order integrated (I(1)) but some (cointegrating) vector of coefficients exists to form a stationary linear combination of them.

This implementation to estimate the cointegrating factors is the Johansen method, named after Søren Johansen. It is an MLE (maximum likelihood estimation) method. The Johansen test is a procedure for testing cointegration of several I(1) time series using MLE. This test permits more than one cointegrating relationship. It is more generally applicable than the Engle-Granger test.

• Søren Johansen, "Likelihood-Based Inference in Cointegrated Vector Autoregressive Models," Oxford University Press, USA. February 1, 1996.
• Kevin Sun, "Notes on Cointegration," February 23, 2011.
• Wikipedia: Cointegration
• Wikipedia: Johansen test
• ### Constructor Summary

Constructors
Constructor and Description
CointegrationMLE(MultivariateSimpleTimeSeries ts, boolean intercept)
Perform the Johansen MLE procedure on a multivariate time series, using the EIGEN test, with the number of lags = 2.
CointegrationMLE(MultivariateSimpleTimeSeries ts, boolean intercept, int p)
Perform the Johansen MLE procedure on a multivariate time series, using the EIGEN test.
CointegrationMLE(MultivariateSimpleTimeSeries ts, boolean intercept, int p, Matrix D)
Perform the Johansen MLE procedure on a multivariate time series.
• ### Method Summary

All Methods
Modifier and Type Method and Description
Matrix alpha()
Get the set of adjusting coefficients, by columns.
Matrix beta()
Get the set of cointegrating factors, by columns.
Vector beta(int r)
Get the r-th cointegrating factor, counting from 1.
Vector getEigenvalues()
Get the set of real eigenvalues.
int n()
Get the number of rows of the multivariate time series used in regression.
int rank()
Get the rank of the system, i.e., the number of (real) eigenvalues.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### CointegrationMLE

public CointegrationMLE(MultivariateSimpleTimeSeries ts,
boolean intercept,
int p,
Matrix D)
Perform the Johansen MLE procedure on a multivariate time series.
Parameters:
ts - a multivariate time series
intercept - indicate whether an intercept is included in the estimation
p - the number of lags, e.g., 2
D - the exogenous factor matrix (excluding the intercept)
• #### CointegrationMLE

public CointegrationMLE(MultivariateSimpleTimeSeries ts,
boolean intercept,
int p)
Perform the Johansen MLE procedure on a multivariate time series, using the EIGEN test.
Parameters:
ts - a multivariate time series
intercept - indicate whether an intercept is included in the estimation
p - the number of lags, e.g., 2
• #### CointegrationMLE

public CointegrationMLE(MultivariateSimpleTimeSeries ts,
boolean intercept)
Perform the Johansen MLE procedure on a multivariate time series, using the EIGEN test, with the number of lags = 2.
Parameters:
ts - a multivariate time series
intercept - indicate whether an intercept is included in the estimation
• ### Method Detail

• #### alpha

public Matrix alpha()
Get the set of adjusting coefficients, by columns.
Returns:
• #### beta

public Matrix beta()
Get the set of cointegrating factors, by columns.
Returns:
β, the cointegrating factors
• #### beta

public Vector beta(int r)
Get the r-th cointegrating factor, counting from 1.
Parameters:
r - an index
Returns:
βr, the r-th cointegrating factor
• #### getEigenvalues

public Vector getEigenvalues()
Get the set of real eigenvalues.
Returns:
the real eigenvalues
• #### rank

public int rank()
Get the rank of the system, i.e., the number of (real) eigenvalues.
Returns:
the rank
• #### n

public int n()
Get the number of rows of the multivariate time series used in regression.
Returns:
ts.size - p