This is a bug on Torsten.
I exposed higher-order functions, following closely what was done with
integrate_ode_*. These functions act as wrappers around numerical ODE integrators to handle the event schedule of clinical trials. The code can be found at https://github.com/charlesm93/math/tree/torsten-develop and at https://github.com/charlesm93/stan/tree/torsten-develop.
generalOdeModel_*, take in the relative and absolute tolerances, and the max number of steps, but these get ignored. Instead the default values, specified in the function, get passed. I noticed this because of an error message which stated the max number of steps, 1E8, had been exceeded, when I had set max_num_steps = 10E6.
I confirmed this issue occurred for all the tuning parameters, but none of the other arguments, by adding
std::cout statements in the
If I run the unit tests on math, the function works fine and the tuning parameters specified by the users get passed. This leads me to think there is an error in the changes I made to the grammar files.
I look at the hpp file produced by the parser and the translation looks right. I get:
stan::math::assign(x, generalOdeModel_rk45(twoCptModelODE_functor__(), 3,
time, amt, rate, ii, evid, cmt, addl, ss, theta, biovar, tlag,
0.0001, 9.9999999999999995e-07, 1000000.0));
These are the arguments I specified. (although, I used 1e-06 for abs tol not 9.99e-07). Maybe something is off with stan::math::assign? No, the C++ unit tests work fine with stan::math::assign.
I removed the default values but then compilation of the model doesn't occur - no error, the compiler just keeps running and never stops (I let it run in the background for 30+ minutes).
I'm trying to think about where things could have gone wrong. Any guidance would be welcome. I also want to design a unit test in Stan to catch these kinds of errors.