Fitting ODE models: best/efficient practices?

~This is indeed so, is this intended behavior?~
I mean: Stan reports the step size after adaptation as 1, even though the last step size used is different.
@bbbales2

Ooo, that sounds like a bug. Can you make an issue over here: Issues · stan-dev/stan · GitHub ?

The way to dig into something like this is figure out where the stepsize is being printed (via lots of grepping) and work back from there if you wanna dig in c+±land.

Hm, I did my worst: "term_buffer = 0" leads to "# Step size = 1" in output csv · Issue #3023 · stan-dev/stan · GitHub

1 Like

Hmmm, so I’ve been trying out my method on the pleiades problem (via this answer by @jtimonen).

Thanks to the adjoint method, everything worked perfectly with tight priors (thanks @wds15).

Even with wide priors, everything worked fine, until the interesting part of the dynamics came, making everything come to a stop. Meaning a warmup that took longer than a few minutes. Who has got time for that?

Anyhow, I’ve got an even better idea. Or maybe not, we’ll see. Stay tuned, or not.

Sample output for the pleiades problem, up until I got impatient:

And (incremental) marginal plots, up until the same time. The marginals for initial positions, velocities and measurement error tighten quite nicely, while the marginals for the stellar masses stay wide, until (I think) the respective planet interacts with another planet, which is the only time we actually get the information we need. So everything works as expected, but slowly.

FYI @bbbales2, I’ve tried this “power warmup” and did not observe any benefit. Chains still got stuck. It might be possible to fiddle with the settings, but my heart’s not quite in it :)

The problem was again a simple 2x2 orbital mechanics problem. Admittedly with absurdly wide priors, but “my” warmup handled it with ease.

@robertgrant: FYI, my idealistic use case (inspiring the question here Bayes factors for a series of experiments using posteriors as priors - #10 by robertgrant) would be to

  • first fit an ODE to part of the data (say up to time t1),
  • saving the posterior distribution of the (dynamic) states and (fixed) parameters at t1,
  • continuing fitting the data from t1 to t2,
  • integrate the states backwards to get the posterior at the original initial time t0.

However, simply saving the state as a multivariate normal distribution did not work (unsuprisingly to be honest, but one can dream). It might be possible to save a better representation using your methods, but so far I have not looked into it.

1 Like

I don’t have a method that will work reliably with 36 parameters yet, but maybe soon. However
the approximation to the density will cause drift over successive iterations, and needs to be replaced with all-data analyses, and if you actually are dealing with some kind of ghostly data that’s only half there via alpha, then I don’t know how to do that waypointing.

Thanks for responding!

Oh right, I forgot to mention this:

The goal is actually mostly to more efficiently warmup the all-data sampling, as such a slightly drifted approximation would be entirely sufficient, as a final correction will have to be performed with all of the data anyways.

I’ll watch this place (the forums), I presume you will advertise any solution with which you are satisfied? It’s not in any sense urgent, so I won’t deep dive now, but I am curious.