Description Usage Arguments Details Value Warning Author(s) References See Also Examples

View source: R/simulate_idcontrol_ode.R

Simulation of a compartmental model with several different compartments: Susceptibles (S), Infected and Pre-symptomatic (P), Infected and Asymptomatic (A), Infected and Symptomatic (I), Recovered and Immune (R) and Dead (D). Also modeled is an environmental pathogen stage (E), and susceptible (Sv) and infected (Iv) vectors.

Any initial conditions not specified below start at 0.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
simulate_idcontrol_ode(
S = 1000,
I = 1,
E = 0,
Sv = 1000,
Iv = 0,
bP = 0,
bA = 0,
bI = 0.001,
bE = 0,
bv = 0.001,
bh = 0.001,
gP = 0.5,
gA = 0.5,
gI = 0.5,
pA = 1,
pI = 10,
c = 1,
f = 0,
d = 0,
w = 0,
mh = 0,
nh = 0,
mv = 0,
nv = 0,
tmax = 300
)
``` |

`S` |
: initial number of susceptible hosts : numeric |

`I` |
: initial number of infected and symptomatic hosts : numeric |

`E` |
: initial amount of pathogen in environment : numeric |

`Sv` |
: initial number of susceptible vectors : numeric |

`Iv` |
: initial number of infected vectors : numeric |

`bP` |
: rate of transmission from pre-symptomatic to susceptible hosts : numeric |

`bA` |
: rate of transmission from asymptomatic to susceptible hosts : numeric |

`bI` |
: rate of transmission from symptomatic to susceptible hosts : numeric |

`bE` |
: rate of transmission from environment to susceptible hosts : numeric |

`bv` |
: rate of transmission from infected vectors to susceptible hosts : numeric |

`bh` |
: rate of transmission from symptomatic hosts to susceptible vectors : numeric |

`gP` |
: rate at which a person leaves the P compartment : numeric |

`gA` |
: rate at which a person leaves the A compartment : numeric |

`gI` |
: rate at which a person leaves the I compartment : numeric |

`pA` |
: rate of pathogen shedding into environment by asymptomatic hosts : numeric |

`pI` |
: rate of pathogen shedding into environment by symptomatic hosts : numeric |

`c` |
: rate of pathogen decay in environment : numeric |

`f` |
: fraction of pre-symptomatic individuals that have an asymptomatic infection : numeric |

`d` |
: fraction of symptomatic infected hosts that die due to disease : numeric |

`w` |
: rate at which recovered persons lose immunity and return to susceptible state : numeric |

`mh` |
: the rate at which new hosts enter the model (are born) : numeric |

`nh` |
: the rate of natural death of hosts (the inverse it the average lifespan) : numeric |

`mv` |
: the rate at which new vectors enter the model (are born) : numeric |

`nv` |
: the rate of natural death of vectors (the inverse it the average lifespan) : numeric |

`tmax` |
: maximum simulation time, in units of months : numeric |

A compartmental ID model with several states/compartments is simulated as a set of ordinary differential equations. The function returns the output from the odesolver as a matrix, with one column per compartment/variable. The first column is time.

This function returns the simulation result as obtained from a call to the deSolve ode solver.

This function does not perform any error checking. So if you try to do something nonsensical (e.g. have I0 > PopSize or any negative values or fractions > 1), the code will likely abort with an error message

Andreas Handel

See e.g. Keeling and Rohani 2008 for SIR models and the documentation for the deSolve package for details on ODE solvers

The UI of the Shiny app 'IDPatterns', which is part of this package, contains more details on the model.

1 2 3 4 5 6 | ```
# To run the simulation with default parameters just call the function:
result <- simulate_idcontrol_ode()
# To choose parameter values other than the standard one, specify them like such:
result <- simulate_idcontrol_ode(S = 2000, I = 10, tmax = 100, f = 0.1, d = 0.2)
# You should then use the simulation result returned from the function, like this:
plot(result$ts[ , "time"], result$ts[ , "S"],xlab='Time',ylab='Number Susceptible',type='l')
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.