ecm {aTSA}R Documentation

Error Correction Model


Fits an error correction model for univriate response.


ecm(y, X, output = TRUE)



a response of a numeric vector or univariate time series.


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


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


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.


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


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.


Debin Qiu


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


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

[Package aTSA version Index]