I want to estimate the rolling average of a time series B using a Gaussian window. The equation to do this would correspond to
$$\tilde{B_{s}}(t_{n}) = \frac{1}{A_{s}} \sum_{t_{m}= t_{n}-3s}^{t_{n}+3s}B(t_{m})e^{-\frac{(t_{m} -t_{n})^{2}}{2s^{2}}}$$
where $$ A_{s} = \sum_{t_{m}= t_{n}-3s}^{t_{n}+3s}e^{-\frac{(t_{m} -t_{n})^{2}}{2s^{2}}}$$
I am aware that pandas
has a an option for a gaussian window.
For example see https://stackoverflow.com/questions/27099555/gaussian-kernel-density-smoothing-for-pandas-dataframe-resample
However, I am not sure if it is equivalent to the version of Gaussian averaging that I am interested in using.
So my questions are:
In
hrly = pd.Series(hourly[0][344:468]) smooth = hrly.rolling(window=5, win_type='gaussian', center=True).mean(std=0.5)
- Is the
win_type='gaussian'
going to give me the desired result? - What is the role of
std=0.5
? - If I wanted to do this using
.apply()
and use a manual function, how should the function be like?