# NOT RUN {
# }
# NOT RUN {
dat <- list(n=0)
## simulate data with at least 30 cases
while(dat$n < 30){
dat <- simOutbreak(R0 = 2, infec.curve = c(0, 1, 1, 1), n.hosts = 100)
}
dat
## plot first 30 cases
N <- dat$n
plot(dat[1:(min(N,30))], main="First 30 cases")
mtext(side=3, text="nb mutations / nb generations")
## plot a random subset (n=10) of the first cases
x <- dat[sample(1:min(N,30), 10, replace=FALSE)]
plot(x, main="Random sample of 10 of the first 30 cases")
mtext(side=3, text="nb mutations / nb generations")
## plot population dynamics
head(dat$dynam,15)
matplot(dat$dynam[1:max(dat$onset),],xlab="time",
ylab="nb of individuals", pch=c("S","I","R"), type="b")
## spatial model
w <- exp(-sqrt((1:40)))
x <- simOutbreak(2, w, spatial=TRUE,
duration=500, disp=0.1, reach=.2)
## spatial model, no dispersal
x <- simOutbreak(.5, w, spatial=TRUE,
duration=500, disp=0, reach=5)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab