statsmodels.tsa.ardl.UECMResults.append

UECMResults.append(endog, exog=None, refit=False, fit_kwargs=None)

Append observations to the ones used to fit the model

Creates a new result object using the current fitted parameters where additional observations are appended to the data used to fit the model. The new results can then be used for analysis or forecasting.

Parameters:
endogarray_like

New observations from the modeled time-series process.

exogarray_like, optional

New observations of exogenous regressors, if applicable.

refitbool, optional

Whether to re-fit the parameters, using the new dataset. Default is False (so parameters from the current results object are used to create the new results object).

fit_kwargsdict, optional

Keyword arguments to pass to fit (if refit=True).

Returns:
AutoRegResults

Updated results object containing results for the new dataset.

Notes

The endog and exog arguments to this method must be formatted in the same way (e.g. Pandas Series versus Numpy array) as were the endog and exog arrays passed to the original model.

The endog argument to this method should consist of new observations that occurred directly after the last element of endog. For any other kind of dataset, see the apply method.

Examples

>>> import pandas as pd
>>> from statsmodels.tsa.ar_model import AutoReg
>>> index = pd.period_range(start='2000', periods=3, freq='A')
>>> original_observations = pd.Series([1.2, 1.4, 1.8], index=index)
>>> mod = AutoReg(original_observations, lags=1, trend="n")
>>> res = mod.fit()
>>> print(res.params)
y.L1    1.235294
dtype: float64
>>> print(res.fittedvalues)
2001    1.482353
2002    1.729412
Freq: A-DEC, dtype: float64
>>> print(res.forecast(1))
2003    2.223529
Freq: A-DEC, dtype: float64
>>> new_index = pd.period_range(start='2003', periods=3, freq='A')
>>> new_observations = pd.Series([2.1, 2.4, 2.7], index=new_index)
>>> updated_res = res.append(new_observations)
>>> print(updated_res.params)
y.L1    1.235294
dtype: float64
>>> print(updated_res.fittedvalues)
dtype: float64
2001    1.482353
2002    1.729412
2003    2.223529
2004    2.594118
2005    2.964706
Freq: A-DEC, dtype: float64
>>> print(updated_res.forecast(1))
2006    3.335294
Freq: A-DEC, dtype: float64