statsmodels.tsa.ardl.UECM.from_formula

classmethod UECM.from_formula(formula, data, lags=0, order=0, trend='n', *, causal=False, seasonal=False, deterministic=None, hold_back=None, period=None, missing='none')[source]

Construct an UECM from a formula

Parameters:
formulastr

Formula with form dependent ~ independent | fixed. See Examples below.

dataDataFrame

DataFrame containing the variables in the formula.

lagsint

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

orderint, 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.

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’.

Returns:
UECM

The UECM model instance

Examples

A simple UECM using the Danish data

>>> from statsmodels.datasets.danish_data import load
>>> from statsmodels.tsa.api import UECM
>>> data = load().data
>>> mod = UECM.from_formula("lrm ~ ibo", data, 2, 2)

Fixed regressors can be specified using a |

>>> mod = UECM.from_formula("lrm ~ ibo | ide", data, 2, 2)