# Can Kalman Filtering be done hierarchically - estimated from multiple time series with the same parameters?

I have a large number of of noisy time series recordings (trials), for which I wish to estimate the state transition model underlying them using the Kalman filter. The process generating the time series is the same in every trial, and so I want to be able to pool information from all of the trials, rather than fitting individual filters to every trial.

I thought this should be a fairly common application of the Kalman filter, but unfortunately I haven't been able to find any literature on how this might be done. I suspect I've either fundamentally misunderstood something about how Kalman filters work, and so what I require can't be done, or I just don't know the terminology for what I'm looking for.

So, can anyone tell me if it is possible to fit the Kalman filter in this way, and if so, what this method is called?

• If you put a common prior across trials on a given parameter, you'll get pooling across the trials in the posterior. Jan 10 '18 at 19:20
• I don't think that's quite right. A common prior will pull all estimates towards the prior mean, but it won't allow the observed data from each individual trial to affect the posterior estimate for all of the other trials, or, in other words, to constrain the estimates to be drawn from a common distribution, estimated from the data. That's what a hierarchical model would achieve.
– Eoin
Jan 11 '18 at 14:49
• Sorry, I meant a common learned prior. Jan 11 '18 at 16:06
• @TrynnaDoStat or you mean posterior?
– Mai
Jan 23 '18 at 14:57
• block kalman filter? It runs on all the data at once. Kalman filtering in MatLab has a chapter on it. book-link I would concatenate into a single larger series, then operate the filter against the single entity. It sounds like that is what you are asking about. Did I understand you correctly? You might want to add some care about concatenation boundaries, either padding them, or aligning them using cross-correlation, or such. Jan 27 '18 at 1:55

## 1 Answer

If the parameters can be assumed to have the same value across all trials, the total likelihood (assuming independence between trials) is just the product of the likelihood for each trial. So just write a function that computes this product (or the sum of the logs) taking the unknown parameter values as a vector first argument. If you're happy with maximum likelihood estimates, then maximise this function numerically. In R, the functions you need are optim and KalmanLike (or perhaps Kfilter0 in the astsa package).

• Thanks, this is very useful. I'll spent some time looking at this, and then hopefully post something about how I get on at some point in the future.
– Eoin
Jan 31 '18 at 19:59
• Could you have a look at this question here about repeatedly applying Kalman filter?
– hhh
Oct 11 '18 at 6:36