Skip to content Skip to sidebar Skip to footer

Pandas: Using Rolling_mean() With Maximum Information Criteria As A Smoothing Function?

I would like to use pd.rolling_mean() as a smoothing function keeping the maximum information criteria. This means the endpoints are computed differently depending on the informati

Solution 1:

you could use the shift function, like so,

ts_shiftedPlus = ts.shift(1)
ts_shiftedMinus = ts.shift(-1)

ts_smooth = 1/3 * ts_shiftedMinus + 1/3 * ts + 1/3 * ts_shiftedPlus
ts_smooth.ix[0] = 1/2 * ts.ix[0] + 1/2 * ts.ix[1]
N = len(ts)
ts_smooth.ix[N] = 1/2 * ts.ix[N-1] + 1/2 * ts.ix[N]

Post a Comment for "Pandas: Using Rolling_mean() With Maximum Information Criteria As A Smoothing Function?"