statsmodels.tsa.filters.filtertools.convolution_filter(x, filt, nsides=2)
[source]
Linear filtering via convolution. Centered and backward displaced moving weighted average.
Parameters: 


Returns: 
y – Filtered array, number of columns determined by x and filt. If a pandas object is given, a pandas object is returned. The index of the return is the exact same as the time period in 
Return type: 
ndarray, 2d 
In nsides == 1, x is filtered
y[n] = filt[0]*x[n1] + ... + filt[n_filt1]*x[nn_filt]
where n_filt is len(filt).
If nsides == 2, x is filtered around lag 0
y[n] = filt[0]*x[n  n_filt/2] + ... + filt[n_filt / 2] * x[n] + ... + x[n + n_filt/2]
where n_filt is len(filt). If n_filt is even, then more of the filter is forward in time than backward.
If filt is 1d or (nlags,1) one lag polynomial is applied to all variables (columns of x). If filt is 2d, (nlags, nvars) each series is independently filtered with its own lag polynomial, uses loop over nvar. This is different than the usual 2d vs 2d convolution.
Filtering is done with scipy.signal.convolve, so it will be reasonably fast for medium sized data. For large data fft convolution would be faster.
© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.tsa.filters.filtertools.convolution_filter.html