[R] Difficulty coding time-forced functions in deSolve

Thomas Petzoldt thpe at simecol.de
Wed Apr 2 08:47:32 CEST 2014

On 4/2/2014 5:51 AM, Aimee Kopolow wrote:

> Any pointers as to how I can code a function that relies on solutions
> from previous time steps?

Such a system would be called a delay differential equation (DDE). It 
can be solved with the dede function, see ?dede for details.

However if you want to model something like this:

 > Explicitly:
 > I want to introduce vaccination 7 days after the proportion of I2/N2
 > reaches 0.01.

Than this is called "root finding", that can be combined with events, 
see example "EVENTS triggered by a root function" in ?events.

More can be found in the papers listed at:


... or you may consider to ask the R-sig-dynamic models mailing list:


Hope it helps

Thomas Petzoldt

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


More information about the R-help mailing list