Kalman Filter
All functions · nseries package
Kalman
func (s Series) Kalman(k1 float64) Series
Kalman implements the Kalman filter on a data series. Based on the article by Vince Banes, “Data Smoothing using a Kalman Filter”, Stocks & Commodities V3:5 (October 1985), pp. 162-165.
The gain parameter is the filter gain, and the second gain is the square root of twice it, so a negative gain gives NaN on every bar, bar 0 included. For a gain of 0 or more, bar 0 is s[0] and the state starts at the first input with zero velocity.