Skip to content
Prev 9513 / 10988 Next

[Rcpp-devel] Using Rcpp to solve ODEs: LSODE (deSolve) says "Confusion over the length of parms"

Frank -

In the code you provided, it looks like it is "poped.db.compiled.rcpp", not
"poped.db.compiled".

I found that, after making the change to fix the error that Dirk pointed
out, the code appears to work with no error (attached).  I don't know if
the results are what you were intending, however.

Also: I would not set up the optimization like this.  When you create
the one_comp_oral_ode function with cppFunction and hand that off to
deSolve, you are still passing along an R function to get called.  Even if
the calculations are accomplished with Rcpp, it still an R function.  So
every step the solver takes, it will have to call an R function.  I don't
think this is what you want. When you write the ode function as suggested
by the deSolve package vignette, you pass off the name of a C function and
the solver calls that C function directly as the system advances.  It will
be faster than what you are doing with cppFunction.

Finally, I'll ask if you have looked at one of the more-modern simulation
packages for R that are designed for PK/PD work?
I maintain mrgsolve: https://github.com/metrumresearchgroup/mrgsolve
You could also look at RxODE: https://cran.r-project.
org/web/packages/RxODE/index.html

Hope that helps ...
Kyle
On Sun, Jan 22, 2017 at 7:50 PM, Dirk Eddelbuettel <edd at debian.org> wrote: