statsmodels.tsa.ardl.UECM

class statsmodels.tsa.ardl.UECM(endog, lags, exog=None, order=0, trend='c', *, fixed=None, causal=False, seasonal=False, deterministic=None, hold_back=None, period=None, missing='none')[source]

Unconstrained Error Correlation Model(UECM)

Parameters:
endogarray_like

A 1-d endogenous response variable. The dependent variable.

lags{int, list[int]}

The number of lags of the endogenous variable to include in the model. Must be at least 1.

exogarray_like

Exogenous variables to include in the model. Either a DataFrame or an 2-d array-like structure that can be converted to a NumPy array.

order{int, sequence[int], dict}

If int, uses lags 0, 1, …, order for all exog variables. If a dict, applies the lags series by series. If exog is anything other than a DataFrame, the keys are the column index of exog (e.g., 0, 1, …). If a DataFrame, keys are column names.

fixedarray_like

Additional fixed regressors that are not lagged.

causalbool, optional

Whether to include lag 0 of exog variables. If True, only includes lags 1, 2, …

trend{‘n’, ‘c’, ‘t’, ‘ct’}, optional

The trend to include in the model:

  • ‘n’ - No trend.

  • ‘c’ - Constant only.

  • ‘t’ - Time trend only.

  • ‘ct’ - Constant and time trend.

The default is ‘c’.

seasonalbool, optional

Flag indicating whether to include seasonal dummies in the model. If seasonal is True and trend includes ‘c’, then the first period is excluded from the seasonal terms.

deterministicDeterministicProcess, optional

A deterministic process. If provided, trend and seasonal are ignored. A warning is raised if trend is not “n” and seasonal is not False.

hold_back{None, int}, optional

Initial observations to exclude from the estimation sample. If None, then hold_back is equal to the maximum lag in the model. Set to a non-zero value to produce comparable models with different lag length. For example, to compare the fit of a model with lags=3 and lags=1, set hold_back=3 which ensures that both models are estimated using observations 3,…,nobs. hold_back must be >= the maximum lag in the model.

period{None, int}, optional

The period of the data. Only used if seasonal is True. This parameter can be omitted if using a pandas object for endog that contains a recognized frequency.

missing{“none”, “drop”, “raise”}, optional

Available options are ‘none’, ‘drop’, and ‘raise’. If ‘none’, no NaN checking is done. If ‘drop’, any observations with NaNs are dropped. If ‘raise’, an error is raised. Default is ‘none’.

Attributes:
ar_lags

The autoregressive lags included in the model

ardl_order

The order of the ARDL(p,q)

causal

Flag indicating that the ARDL is causal

deterministic

The deterministic used to construct the model

df_model

The model degrees of freedom.

dl_lags

The lags of exogenous variables included in the model

endog_names

Names of endogenous variables.

exog_names

Names of exogenous variables included in model

fixed

The fixed data used to construct the model

hold_back

The number of initial obs.

period

The period of the seasonal component.

seasonal

Flag indicating that the model contains a seasonal component.

trend

The trend used in the model.

See also

statsmodels.tsa.ardl.ARDL

Autoregressive distributed lag model estimation

statsmodels.tsa.ar_model.AutoReg

Autoregressive model estimation with optional exogenous regressors

statsmodels.tsa.statespace.sarimax.SARIMAX

Seasonal ARIMA model estimation with optional exogenous regressors

statsmodels.tsa.arima.model.ARIMA

ARIMA model estimation

Notes

The full specification of an UECM is

\[\Delta Y_t = \delta_0 + \delta_1 t + \delta_2 t^2 + \sum_{i=1}^{s-1} \gamma_i I_{[(\mod(t,s) + 1) = i]} + \lambda_0 Y_{t-1} + \lambda_1 X_{1,t-1} + \ldots + \lambda_{k} X_{k,t-1} + \sum_{j=1}^{p-1} \phi_j \Delta Y_{t-j} + \sum_{l=1}^k \sum_{m=0}^{o_l-1} \beta_{l,m} \Delta X_{l, t-m} + Z_t \lambda + \epsilon_t\]

where \(\delta_\bullet\) capture trends, \(\gamma_\bullet\) capture seasonal shifts, s is the period of the seasonality, p is the lag length of the endogenous variable, k is the number of exogenous variables \(X_{l}\), \(o_l\) is included the lag length of \(X_{l}\), \(Z_t\) are r included fixed regressors and \(\epsilon_t\) is a white noise shock. If causal is True, then the 0-th lag of the exogenous variables is not included and the sum starts at m=1.

Examples

>>> from statsmodels.tsa.api import UECM
>>> from statsmodels.datasets import danish_data
>>> data = danish_data.load_pandas().data
>>> lrm = data.lrm
>>> exog = data[["lry", "ibo", "ide"]]

A basic model where all variables have 3 lags included

>>> UECM(data.lrm, 3, data[["lry", "ibo", "ide"]], 3)

A dictionary can be used to pass custom lag orders

>>> UECM(data.lrm, [1, 3], exog, {"lry": 1, "ibo": 3, "ide": 2})

Setting causal removes the 0-th lag from the exogenous variables

>>> exog_lags = {"lry": 1, "ibo": 3, "ide": 2}
>>> UECM(data.lrm, 3, exog, exog_lags, causal=True)

When using NumPy arrays, the dictionary keys are the column index.

>>> import numpy as np
>>> lrma = np.asarray(lrm)
>>> exoga = np.asarray(exog)
>>> UECM(lrma, 3, exoga, {0: 1, 1: 3, 2: 2})

Methods

fit(*[, cov_type, cov_kwds, use_t])

Estimate the model parameters.

from_ardl(ardl[, missing])

Construct a UECM from an ARDL model

from_formula(formula, data[, lags, order, ...])

Construct an UECM from a formula

hessian(params)

The Hessian matrix of the model.

information(params)

Fisher information matrix of model.

initialize()

Initialize the model (no-op).

loglike(params)

Log-likelihood of model.

predict(params[, start, end, dynamic, exog, ...])

In-sample prediction and out-of-sample forecasting.

score(params)

Score vector of model.

Properties

ar_lags

The autoregressive lags included in the model

ardl_order

The order of the ARDL(p,q)

causal

Flag indicating that the ARDL is causal

deterministic

The deterministic used to construct the model

df_model

The model degrees of freedom.

dl_lags

The lags of exogenous variables included in the model

endog_names

Names of endogenous variables.

exog_names

Names of exogenous variables included in model

fixed

The fixed data used to construct the model

hold_back

The number of initial obs.

period

The period of the seasonal component.

seasonal

Flag indicating that the model contains a seasonal component.

trend

The trend used in the model.


Last update: Nov 14, 2024