[R-sig-dyn-mod] Altering params for Simecol model at time step

Dougherty, Geoff geoffdougherty at gmail.com
Sat Nov 15 20:26:33 CET 2014


Hi, all. 

I am working on a simecol model for which I need to be able to change the value of a parameter at a particular time step. 

Here’s the model: 

sir <- new("odeModel",
                 main = function(time, init, parms, ...){
                   with(as.list(c(init,parms)),{

                     dS <- -beta*S*I
                     dI <- beta*S*I-I*gamma
                     dR <- I*gamma
                     list(c(dS,dI,dR))
                   })},

                 parms = c(beta=0.18,gamma=0.167),
                 times = c(from=0,to=300,by=0.01),
                 init = c(S=10000000,I=25,R=0),
                 solver = "lsoda"
)

I’d like to be able to lower beta by 0.1 at, for example, time=60. 

It looks like the events method in deSolve would accomplish this, but I’m not sure how to integrate the deSolve method into the simecol model.

Thanks for any suggestions. 



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