ecm: Error Correction Model

View source: R/ecm.R

ecmR Documentation

Error Correction Model

Description

Fits an error correction model for univriate response.

Usage

ecm(y, X, output = TRUE)

Arguments

y

a response of a numeric vector or univariate time series.

X

an exogenous input of a numeric vector or a matrix for multivariate time series.

output

a logical value indicating to print the results in R console. The default is TRUE.

Details

An error correction model captures the short term relationship between the response y and the exogenous input variable X. The model is defined as

dy[t] = bold{\beta}[0]*dX[t] + \beta[1]*ECM[t-1] + e[t],

where d is an operator of the first order difference, i.e., dy[t] = y[t] - y[t-1], and bold{\beta}[0] is a coefficient vector with the number of elements being the number of columns of X (i.e., the number of exogenous input variables), and ECM[t-1] = y[t-1] - hat{y}[t-1] which is the main term in the sense that its coefficient \beta[1] explains the short term dynamic relationship between y and X in this model, in which hat{y}[t] is estimated from the linear regression model y[t] = bold{\alpha}*X[t] + u[t]. Here, e[t] and u[t] are both error terms but from different linear models.

Value

An object with class "lm", which is the same results of lm for fitting linear regression.

Note

Missing values are removed before the analysis. In the results, dX or dX1, dX2, ... represents the first difference of each exogenous input variable X, and dy is the first difference of response y.

Author(s)

Debin Qiu

References

Engle, Robert F.; Granger, Clive W. J. (1987). Co-integration and error correction: Representation, estimation and testing. Econometrica, 55 (2): 251-276.

Examples

X <- matrix(rnorm(200),100,2)
y <- 0.1*X[,1] + 2*X[,2] + rnorm(100)
ecm(y,X)

aTSA documentation built on May 29, 2024, 8:50 a.m.