charlesknipp / StateSpaceInference.jl

Joint parameter and state inference for state space models using Bayesian techniques
MIT License
2 stars 0 forks source link

State Space Object Behavior #3

Open charlesknipp opened 5 months ago

charlesknipp commented 5 months ago

In it's current form, state space models have an overhead issue. Reparameterizing certain models performs redundant calculations. This isn't obvious with Harvey-Trimbur since the model definition is characterized by a linear system, but would be for a version with stochastic volatility in the cyclical component.

One idea I had was to define a "parameterized model", where model functions are compiled initially and the objects that require recalculations can be traced like in AD frameworks. I'm not sure how feasible this could be, but it may induce some much needed innovation for state space model design.

charlesknipp commented 2 months ago

After profiling the code, it was clear that much of the overhead was caused by type inference problems at the compiler.

There is still some overhead caused by parameterization, especially for linear models like the case here. I present an alternative via the UC framework, which is surprisingly lighter weight in terms of allocations.

The added gain in efficiency is partially due to the issue presented in #5, but I'm not entirely sure.