Online updates of Kalman filters with inhomogeneous (non-equal-time-step) observations

Hi folks,

Anyone seen any code for a Kalman filter which admits online updates with (basically) time stamps or time deltas? I'm taking another crack at intraday mean reversion, but I really want to handle overnight gaps better than assuming they are as important as intraday updates. In fact, I wouldn't mind assigning custom weights to each minute based on the volume traded (that would be awesome), based on the idea that we are sampling the underlying process at random/sparse times, and that some minutes' observations are after a greater length of time/action in the volume clock.

I really don't want to have to go back to first principles and see if I can derive the state space update formulae with generalized elapsed time, and frankly, I'm not sure if I am capable of that yet.

Simon.

3 responses

Hmm playing with that code in MATLAB, it looks like it is still assigning the same weight to each observation, when really I want further spaced observations to be weighted higher, to reflect the fact that the underlying process has had more time to evolve.

Perhaps you could fit the price versus time data with a polynomial, and weight the fit by volume. Then use the polynomial to interpolate, creating an equally spaced grid, thereby synthesizing 24/7/365 minutely prices at equal volume. The tricky parts are the length of the trailing window for the fit, and the order of the polynomial. In addition to weighting by volume, you could weight by time, something like exp(-t/tau), where tau is the time constant. Then, you can select a really long trailing window, and fiddle with tau instead. This will weight more recent observations more heavily (e.g. on Monday morning, the prior week will have faded from the analysis).

For completeness, you could include the full OHLCV data in the fit and weights (e.g. points with lower variance could be weighted more heavily).

Once you have your synthetic, equally-spaced price data, then you could try applying your Kalman filter thingy (which may be useless after the fitting...)

Overall, at any point in time, it seems like you need a figure of merit for the goodness-of-fit of your model, to assess the degree to which it can be applied (i.e. how much risk are you taking on by relying on the model).