statsmodels.tsa.stattools.innovations_filter

statsmodels.tsa.stattools.innovations_filter(endog, theta)

Filter observations using the innovations algorithm.

Parameters
endogarray_like

The time series to filter (nobs,). Should be demeaned if not mean 0.

thetandarray

Innovation coefficients of MA representation. Array must be (nobs, q) where q order of the MA.

Returns
ndarray

Array of filtered innovations.

See also

innovations_algo

Convert autocovariances to MA parameters.

References

*

Brockwell, P.J. and Davis, R.A., 2016. Introduction to time series and forecasting. Springer.

Examples

>>> import statsmodels.api as sm
>>> data = sm.datasets.macrodata.load_pandas()
>>> rgdpg = data.data['realgdp'].pct_change().dropna()
>>> acov = sm.tsa.acovf(rgdpg)
>>> nobs = activity.shape[0]
>>> theta, sigma2  = innovations_algo(acov[:4], nobs=nobs)
>>> resid = innovations_filter(rgdpg, theta)