stewid / SimInf

A framework for data-driven stochastic disease spread simulations
http://stewid.github.io/SimInf/
GNU General Public License v3.0
33 stars 14 forks source link

Simulate the SIR or SEIR model on SimInf #1

Closed Spatial-R closed 7 years ago

Spatial-R commented 8 years ago

Thanks for your development of the SimInf package, which provides several types of dynamic models such as SIS. In my situation, there is no transition from the Infectious compartment to the Susceptible compartment, there i need to modify the model setting in the package. My idea is:

But that way will influence the total number of population in all nodes. Is there any other ways can help to build the SIR model using SimInf?

stewid commented 7 years ago

The latest version (v3.0.0) of SimInf on CRAN includes the SEIR and SIR models.

library("SimInf")

## Create an SIR model object.
model <- SIR(u0 = data.frame(S = 99, I = 1, R = 0),
             tspan = 1:100,
             beta = 0.16,
             gamma = 0.077)

## Run the SIR model and plot the result.
result <- run(model, seed = 123)
plot(result)

sir

## Create an SEIR model object.
model <- SEIR(u0 = data.frame(S = 99, E = 0, I = 1, R = 0),
              tspan = 1:100,
              beta = 0.16,
              epsilon = 0.25,
              gamma = 0.077)

## Run the SEIR model and plot the result.
result <- run(model, seed = 123)
plot(result)

seir

trosendal commented 7 years ago

Nice graphs!