[R] Difficulty coding time-forced functions in deSolve

Thomas Petzoldt
Wed, 02 Apr 2014 06:47:32 -0000

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:

http://desolve.r-forge.r-project.org

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

https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models

Hope it helps

Thomas Petzoldt

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