# Simulate an epidemic through a network of 30
set.seed(1)
examplenet <- buildER(30,0.1)
exampleepidemic <- SEIR.simulator(examplenet,30,0.3,2,5,latencydist="gamma")
# Plot the simulated epidemic
plotepi(exampleepidemic)
# Run MCMC algorithm on this epidemic
examplemcmc <- epibayesmcmc(exampleepidemic,nsamp=100000,
thinning=1000, bprior=c(0,1), tiprior=c(0,5),teprior=c(0,5),kiprior=c(0,10),
keprior=c(0,10), N=30, priordists="uniform",extrathinning=10,inferEtimes=TRUE,
inferItimes=TRUE)
# Plot starting state of epidemic from chain
plotepimcmc(examplemcmc,1)
# Plot final state of epidemic from chain
plotepimcmc(examplemcmc)
Run the code above in your browser using DataLab