SIR_solve_model: A function to calculate the deterministic estimates of the...

Description Usage Arguments Value Examples

View source: R/SIR_solve_model.R

Description

A function to calculate the deterministic estimates of the number infected versus time and the average number of descendant infections (ANDI) for a deterministic Susceptible, Infected, Recovered (SIR) model

Usage

1
SIR_solve_model(N, R0, fsusc, delta_t = 0.01)

Arguments

N

the population size

R0

the reproduction number

fsusc

the initial fraction susceptible

delta_t

time step to solve model

Value

list model compartment values vs time and ANDI

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
  require("ANDI")
  require("deSolve")
 
  N = 1000
  I0 = 1
  S0 = N-I0
  gamma = 1
  R0 = 1.5
 
  set.seed(78998026)
  a = SIR_agent(N,I0,S0,gamma,R0)
  b = SIR_solve_model(N,R0,S0/N,0.1)
 
  par(mfrow=c(1,1))
  plot(a$time,a$I,xlab="Time",ylab="Prevalence",main=paste("R0=",R0," and N=",N,sep=""))
  lines(b$results$time,b$results$I,col=2,lwd=4)
  legend("topright",legend=c("ABMC","deterministic"),col=c(1,2),bty="n",lwd=4,cex=0.8)
 
  cat("Est ANDI, ABMC and deterministic: ",round(mean(a$ANDI),1),"  ",round(b$ANDI,1),"\n",sep="")
  cat("Est final size, ABMC and deterministic: ",a$final_size,"  ",b$final_size,"\n",sep="")

## End(Not run)

smtowers/ANDI documentation built on May 6, 2019, 7:04 p.m.