For fitting non-linear ODEs in Stan, has there been any progress on adding non-linear ODE root solving functions?

Apologies for posting two questions back to back. You guys at the Stan team have been a big help to me over the years, and I feel like I owe you guys all at least a beer each at some point.

Anyhow, I remember three years ago or so hearing that Charles Margossian was working on adding non-linear ODE root solving functions into Stan to make it possible to initiate non-linear ODEs at steady state such that it would be easier to fit non-linear ODE systems to response data without needing to “spin up” the ODEs, which would then cause each MCMC iteration to take an astronomically long time. Googling around, it doesn’t seem like non-linear root solving was ultimately added, I am presuming that goal got tabled?

Sounds like this: https://mc-stan.org/docs/2_21/stan-users-guide/algebra-solver-chapter.html

The API is here: https://mc-stan.org/docs/2_21/functions-reference/functions-algebraic-solver.html

Does that seem like the thing you’re looking for?

(edit: this was coded up by @charlesm93, so I’m assuming so)

2 Likes

@bbbales2 Yes, this is what you use to find the roots and compute steady state. The relevant Stan Con publication can be found here: https://zenodo.org/record/1284375#.XcwtTDJKg_V

The current algebraic solver uses the dogleg method. @yizhang and I are also adding a Newton-Krylov method (KINSOL) and a fixed point solver. These solvers should be faster. Both features are in math and need to be exposed to the language. So expect them in the next Stan release.

3 Likes

@bbbales2 and @charlesm93, this is exactly what I am looking for, much appreciation.

Thank you, @yizhang and @charlesm93, for your hard work on this.

Saw the addition of the Newton-Krylov method on Github, this is huge. Thanks to you and @yizhang for implementing this, this is a big help for implementation of non-linear models.

1 Like