# NOT RUN {
if (require(outbreaks)) {
dat <- ebola_sim$linelist$date_of_onset
## EXAMPLE WITH A SINGLE MODEL
## compute weekly incidence
i.7 <- incidence(dat, interval=7)
plot(i.7)
plot(i.7[1:20])
## fit a model on the first 20 weeks
f <- fit(i.7[1:20])
f
names(f)
head(f$pred)
## plot model alone (not recommended)
plot(f)
## plot data and model (recommended)
plot(i.7, fit=f)
plot(i.7[1:25], fit=f)
## EXAMPLE WITH 2 PHASES
## specifying the peak manually
f2 <- fit(i.7, split=as.Date("2014-10-15"))
f2
plot(i.7, fit=f2)
## finding the best 'peak' date
f3 <- fit_optim_split(i.7)
f3
plot(i.7, fit=f3$fit)
}
# }
Run the code above in your browser using DataLab