High Divergence Rate in Estimating Kalman Filter

Hi,
the model is a bit too complex for me to really understand but there some hints for debugging models at https://discourse.mc-stan.org/t/divergent-transitions-a-primer/17099 In particular, I think treating a subset of the parameters as known data could help you pin down where the problems arise (a bug in the code is always a possibility).

Also one thing that I’ve had problems with when building a simple 1D Kalman filter is that if you have just one time series, the data often don’t let you really distinguish between process variance and noise variance, so reparametrizing in terms of total variance as discussed e.g. at Suggestions for identifying summed random effects - #2 by martinmodrak might be helpful. But I would look into that only if it turns out that you can fit the model assuming one of the variances is known while you have problems when both are unknown.

Also the ctsem R package implements Kalman filtering in Stan, so it may serve as an inspiration on how to implement this stuff well.

Best of luck with your model

1 Like