[R-sig-dyn-mod] lag value stability

Thomas Petzoldt thomas.petzoldt at tu-dresden.de
Tue Oct 11 09:19:37 CEST 2016


Hi,

I cannot reproduce your issue without a reproducible example, but it may 
be the following:

1) Not alls solvers support lags, see table here:

http://desolve.r-forge.r-project.org/slides/tutorial.pdf#24

2) The lagvalue must not point to a time before the start of the 
simulation, so it needs to be safeguarded with an "if" in the 
derivatives function. See ?lagvalue or:

http://desolve.r-forge.r-project.org/slides/tutorial.pdf#25

for examples.

Hope it helps,

Thomas

Am 11.10.2016 um 06:41 schrieb Tom Drake:
> Dear R-sig / Thomas Petzoldt
>
> Many thanks for your previous response about rootSolve and simecol, this was very useful.
>
> I’m experiencing some stability issues with lagvalue. I have model variants that have worked without problems for some time that have recently begun to throw errors below.
>
> Error in deSolve::lagvalue(tlag) :
>   pastvalue can only be called from 'func' or 'res' when triggered by appropriate integrator.
>
> OR
>
> Error in deSolve::lagvalue(tlag) :
>   illegal input in lagvalue - lag, 406.235, too large, at time = 415.235
>
> Sometimes it will work and sometimes it won’t, I cannot work out what is causing the problems. I have tried using “deSolve::lagvalue” to avoid conflicts with other packages but still the same.
>
> Any suggestions on what has caused these problems suddenly appear and how to address them are welcome.
>
> Best wishes
>
> Tom


-- 
Dr. Thomas Petzoldt
Technische Universitaet Dresden
Faculty of Environmental Sciences
Institute of Hydrobiology
01062 Dresden, Germany

E-Mail: thomas.petzoldt at tu-dresden.de
http://tu-dresden.de/Members/thomas.petzoldt



More information about the R-sig-dynamic-models mailing list