Description Usage Arguments Examples
Solves a mathematical SIR model, with or without vaccinated portion of newborns or constant force of infection, given timings, parameters and state.
1 |
t |
Timings of the integration. |
parameters |
Contains all the model parameters: natural mortality rate mu, disease-related mortality alpha, transmission parameter beta, recovery rate nu, portion of vaccinated newborns p, and total population size N. The parameter ndims specifies the number of row and columns of the subpopulation matrix, and nparams specifies the dimension of the ‘nu’ parameter (SIR_SubPop). |
state |
The initial values of the model: S are the susceptibles, I are the infected, and R are the immune or recovered. |
fun |
This specifies which SIR model you want to use: SIR_Vac is the SIR model with a portion of vaccinated newborns (Halloran), SIR_NoVac is the SIR model without any vaccinated portion, SIR_ConstFOI is the SIR model with constant force of infection at endemic state and without a portion of vaccinated newborns, and SIR_SubPop is the SIR model that uses a mixing matrix that specifies a subpopulation. |
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 | # Without portion of vaccinated newborns
t <- seq(0,1600,0.01)
state <- c(S=4999,I=1,R=0)
params <- c(mu=1/75,beta=0.0005,nu=1,N=5000,alpha=0)
result <- solveSIR(t, params, state, SIR_NoVac)
print(result)
# With portion of vaccinated newborns
t <- seq(0,1600,0.01)
state <- c(S=4999,I=1,R=0)
params <- c(mu=1/75,beta=0.0005,nu=1,N=5000,p=0.4,alpha=0)
result <- solveSIR(t, params, state, SIR_Vac)
print(result)
# With constant force of infection
t <- seq(0,90,by=0.01)
state <- c(s=0.99,i=0.01,r=0)
params <- c(lambda = 0.05, nu=1/(14/365))
result <- solveSIR(t, params, state, SIR_ConstFOI)
print(result)
# With subpopulation mixing matrix
t <- seq(0,10000,by=0.01)
state <- c(s=c(0.8,0.8),i=c(0.2,0.2), r=c(0.0,0.0))
params <- c(betatilde=c(0.05,0.0,0.0,0.05), nu=c(1/30,1/30), mu=0.001, ndims=2, nparams=2)
result <- solveSIR(t, params, state, SIR_SubPop)
print(result)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.