## same inputs as in the MCepi example
truth <- list(b=0.00218, k=10, nu=0.4, mu=0)
init <- list(S0=762, I0=1, R0=0, D0=0)
costs <- list(vac=2, death=4, infect=1)
## construct a grid of valid vaccination strategies
vacgrid <- list(fracs=seq(0,1.0,0.1), stops=seq(2,init$S0-50,50))
## calculate the cost surface of all combinations in vacgrid
out.optvac <- optvac(init, truth, vacgrid, costs)
## extract the best and worst (static) policy
best <- getpolicy(out.optvac)
worst <- getpolicy(out.optvac, which="worst")
rbind(best, worst)
## plot the cost surface along with the best and worst policy
plot(out.optvac)
## now return to MCepi for a cost comparison to no vaccination
## using these values
vac.opt <- best[3:4]
vac.opt
Run the code above in your browser using DataLab