uecm {ARDL}R Documentation

Unrestricted ECM regression


uecm is a generic function used to construct Unrestricted Error Correction Models (UECM). The function invokes two different methods. The default method works exactly like ardl. The other method requires an object of class 'ardl'. Both methods create the conditional UECM, which is the UECM of the underlying ARDL.



## S3 method for class 'ardl'
uecm(object, ...)

## Default S3 method:
uecm(formula, data, order, start = NULL, end = NULL, ...)



Additional arguments to be passed to the low level regression fitting functions.


An object of class 'ardl'.


A "formula" describing the linear model. Details for model specification are given under 'Details'.


A time series object (e.g., "ts", "zoo" or "zooreg") or a data frame containing the variables in the model. In the case of a data frame, it is coerced into a ts object with start = 1, end = nrow(data) and frequency = 1. If not found in data, the variables are NOT taken from any environment.


A specification of the order of the underlying ARDL model (e.g., for the UECM of an ARDL(1,0,2) model it should be order = c(1,0,2)). A numeric vector of the same length as the total number of variables (excluding the fixed ones, see 'Details'). It should only contain positive integers or 0. An integer could be provided if all variables are of the same order.


Start of the time period which should be used for fitting the model.


End of the time period which should be used for fitting the model.


The formula should contain only variables that exist in the data provided through data plus some additional functions supported by dynlm (i.e., trend()).

You can also specify fixed variables that are not supposed to be lagged (e.g. dummies etc.) simply by placing them after |. For example, y ~ x1 + x2 | z1 + z2 where z1 and z2 are the fixed variables and should not be considered in order. Note that the | notion should not be confused with the same notion in dynlm where it introduces instrumental variables.


uecm returns an object of class c("dynlm", "lm", "uecm"). In addition, attributes 'order', 'data', 'parsed_formula' and 'full_formula' are provided.

Mathematical Formula

The formula of an Unrestricted ECM conditional to an ARDL(p,q_{1},\dots,q_{k}) is:

\Delta y_{t} = c_{0} + c_{1}t + \pi_{y}y_{t-1} + \sum_{j=1}^{k}\pi_{j}x_{j,t-1} + \sum_{i=1}^{p-1}\psi_{y,i}\Delta y_{t-i} + \sum_{j=1}^{k}\sum_{l=1}^{q_{j}-1} \psi_{j,l}\Delta x_{j,t-l} + \sum_{j=1}^{k}\omega_{j}\Delta x_{j,t} + \epsilon_{t}

\psi_{j,l} = 0 \;\; \forall \;\; q_{j} \leq 1, \;\;\;\;\; \psi_{y,i} = 0 \;\; if \;\; p = 1

In addition, x_{j,t-1} and \Delta x_{j,t} cancel out becoming x_{j,t} \;\; \forall \;\; q_{j} = 0


Kleanthis Natsiopoulos, klnatsio@gmail.com

See Also

ardl recm



## Estimate the UECM, conditional to it's underlying ARDL(3,1,3,2) -----

# Indirectly
ardl_3132 <- ardl(LRM ~ LRY + IBO + IDE, data = denmark, order = c(3,1,3,2))
uecm_3132 <- uecm(ardl_3132)

# Directly
uecm_3132_ <- uecm(LRM ~ LRY + IBO + IDE, data = denmark, order = c(3,1,3,2))
identical(uecm_3132, uecm_3132_)

## Post-estimation testing ---------------------------------------------

library(lmtest) # for bgtest(), bptest(), and resettest()
library(tseries) # for jarque.bera.test()
library(strucchange) # for efp(), and sctest()

# Breusch-Godfrey test for higher-order serial correlation
bgtest(uecm_3132, order = 4)

# Breusch-Pagan test against heteroskedasticity

# Ramsey's RESET test for functional form
## Not run: 
    # This produces an error.
    # resettest() cannot use data of class 'zoo' such as the 'denmark' data
    # used to build the original model
    resettest(uecm_3132, type = c("regressor"))

## End(Not run)

uecm_3132_lm <- to_lm(uecm_3132, data_class = "ts")
resettest(uecm_3132_lm, power = 2)

# Jarque-Bera test for normality

# CUSUM test for structural change detection
## Not run: 
    # This produces an error.
    # efp() does not understand special functions such as "d()" and "L()"
    efp(uecm_3132$full_formula, data = uecm_3132$model)

## End(Not run)

uecm_3132_lm_names <- to_lm(uecm_3132, fix_names = TRUE)
fluctuation <- efp(uecm_3132_lm_names$full_formula,
                   data = uecm_3132_lm_names$model)

[Package ARDL version 0.2.4 Index]