statsmodels.tsa.filters.filtertools.recursive_filter

statsmodels.tsa.filters.filtertools.recursive_filter(x, ar_coeff, init=None)[source]

Autoregressive, or recursive, filtering.

Parameters:
  • x (array-like) – Time-series data. Should be 1d or n x 1.
  • ar_coeff (array-like) – AR coefficients in reverse time order. See Notes
  • init (array-like) – Initial values of the time-series prior to the first value of y. The default is zero.
Returns:

y – Filtered array, number of columns determined by x and ar_coeff. If a pandas object is given, a pandas object is returned.

Return type:

array

Notes

Computes the recursive filter

y[n] = ar_coeff[0] * y[n-1] + ...
        + ar_coeff[n_coeff - 1] * y[n - n_coeff] + x[n]

where n_coeff = len(n_coeff).