View source: R/sir_subpops_model.R
sir_subpops_model | R Documentation |
Refers to section 3.5.1.
sir_subpops_model(times, state, parameters)
times |
time sequence. |
state |
the initial state of the model. |
parameters |
the parameters of the model. |
In state
:
- s
: Percent susceptible
- i
: Percent infected
- r
: Percent recovered
In parameters
:
- mu
: natural death rate (1/L).
- beta
: transmission rate w.r.t population (beta tilde)
- nu
: recovery rate
- k
: number of subpopulations
list of class sir_subpops_model with the following items
parameters |
list of parameters used for fitting the model |
output |
matrix of proportion for each compartment over time |
k <- 2
state <- c(
s = c(0.8, 0.8),
i = c(0.2, 0.2),
r = c( 0, 0)
)
beta_matrix <- c(
c(0.05, 0.00),
c(0.00, 0.05)
)
parameters <- list(
beta = matrix(beta_matrix, nrow=k, ncol=k, byrow=TRUE),
nu = c(1/30, 1/30),
mu = 0.001,
k = k
)
times<-seq(0,10000,by=0.5)
model <- sir_subpops_model(times, state, parameters)
model
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.