[R] olesolve: stepsize
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Tue Jun 15 00:07:28 CEST 2004
"Zhixin Guan" <zguan at usc.edu> writes:
> Hi,
>
> I am doing a project on the simulation of glucose metabolism based on a
> pharmacokinetic modeling in which we have 4 differential equations. I did
> this in R by using the odesolve package. It works very well, but I have two
> questions:
>
>
>
> Here is the odemodel function
>
> _________________________________________________
>
> Ogtt.Odemodel <- function(t, y, p) {
.....
> }
> First is that The computing time for each individual simulation is about 6
> sec if I set up time from 0 - 360 min and calculate on each minute. In
> order to reduce computing time, I want to calculate for every two minutes,
> but I don't know how to do it. I try to make t to be t <- seq(0, 360, by =
> 2), however, the computing time is still about 6 sec instead of 3. I also
> found that there is a hmin parameter in odesolve. But again, it doesn't
> work.
The thing you're not telling us is what solver you are using! lsoda(),
I suppose. In that case, the times you specify are just read-off
times, whereas the actual integration proceeds in potentially much
smaller time step. If you want the solver to take larger steps, you
should probably loosen the tolerances and maybe also increase hmin.
>
> The second question is that I found that some time, the last two or three
> points of calculation is NA.
This might be due to using approxfun with values beyond the end of
your sx data.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list