[R-sig-dyn-mod] metapopulation SIR model

Thomas Petzoldt Thomas.Petzoldt at tu-dresden.de
Tue Apr 23 18:14:27 CEST 2013


Dear Vincent,

I appreciate that you are fighting with the topic, but not all modelling
questions can be solved by volunteer support. As far as I see, your
fluxrate approach seems to go into a promising direction, but don't
have time to check if "it is all right".


On 23.04.2013 16:46, vincent laperriere wrote:
>
> I tried out to adapt the n-species LV model as you mention in your
> last message but did not succeed. Is it possible to specify a model
> as:
>
> model <- function(t, S, I, R, parms) {......}

This is not possible because the deSolve help file ?ode tells us:

"If func is an R-function, it must be defined as:
func <- function(t, y, parms,...)."

> and then run it as:
>
> out <- ode(S0, I0, R0, times, model, parms)

No, it would not follow the syntax of R/deSolve's "ode" function. States
have to be bound together as a vector. But, you have the option to
reorganize your states internally in the model function, as long as
states at the beginning and derivatives at the end remain a vector and
occur in the same order.

> Nevertheless, I tried another way to develop a SIR metapopulation
> model, like this: do you think it is all right with the commands
> below?

See above, sorry. Nevertheless, I've put some code together yesterday
evening, just for recreation ;-) Maybe this gives you some idea:

http://hhbio.wasser.tu-dresden.de/projects/modlim/src/SIR-metapop.R


I'm sure this can be made even simpler, more realistic or whatever.

Maybe that someone else on this list can give you more insight ?!!!
Comments are welcome.

thpe



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