# MCmanage {amei}

Monte Carlo Epidemic Simulation with Adaptive Vaccination
Package:
amei
Version:
1.0-7

### Description

This function performs a Monte Carlo simulation of epidemic trajectories under an adaptive vaccination strategy as implemented by the `manage` function. Statistics are tallied for a collection of characteristics including the state of the epidemic (evolution of susceptibles (S), infecteds (I), recovereds (R), and deads) and the cost of the vaccination strategy employed

### Usage

```MCmanage(init, epistep, vacgrid, costs,
pinit = list(b = 0.1, k = 0.02, nu = 0.2, mu = 0.1),
hyper = list(bh = c(1,3), kh = c(1,3), nuh = c(1,1), muh = c(1,1)),
vac0 = list(frac = 0, stop = 0), T = 40, MCreps = 30,
MCvits = 50, MCMCpits = 1000, bkrate = 1, vacsamps = 50,
quant = c(0.025, 0.975), start = 7, ...)
```

### Arguments

init
a `list` containing scalar entries `\$S0`, `\$I0`, `\$R0`, `\$D0` depicting the initial number of susceptibles, infecteds, recovereds, and deads in the outbreak
epistep
a function which moves the epidemic ahead one time-step; see `epistep`
vacgrid
a `list` containing vector entries `\$fracs`, `\$stops` indicating the permissible fractions (in [0,1]) of the population to be vaccinated and the (positive integer) of stopping thresholds having a maximum of `init\$S0`
costs
a `list` containing scalar entries `\$vac`, `\$death`, and `\$infect`, depicting the costs associated with a single vaccination, death, or the daily cost of maintaining an infected individual, respectively
pinit
a `list` containing scalar entries `\$b`, `\$k`, `\$nu`, and `\$mu` depicting the initial values of parameters of the SIR model representing the transmission probability, clumpiness parameter, the recovery probability, and the mortality probability, respectively, which are subsequently sampled by MCMC from the posterior
hyper
a `list` containing 2-vector entries describing parameters to the prior distribution of the parameters listed in the `pinit` argument. The prior for `b` follows a gamma distribution with parameters \$`\$bh`\$ where the shape is given by `bh[1]` and scale by `bh[2]`. The prior for `k` specified by parameters `\$kh` is similar. The prior(s) for `nu` and `mu` are specified through p_r and p_d, respectively, which follow Beta distributions and the default specification is uniform. See `vignette("amei")` for more details
vac0
the initial (static) vaccination policy to be used before estimation of parameters begins (at `start`). This is a `list` with scalar entries `\$frac` and `\$stop` depicting the fraction to be vaccinated at each time step, and the vaccination (stopping) threshold, respectively
T
the maximum number of time steps during which the epidemic is allowed to evolve
MCreps
number of times to repeat the Monte Carlo experiment, each time starting with the state in `init` and collecting characteristics of the epidemic trajectory and (vaccination/death) costs
MCvits
scalar number of Monte Carlo iterations of forward epidemic evolution used at each time step in `manage` to determine the optimal vaccination policy
MCMCpits
scalar number of Markov chain Monte Carlo iterations used at each step to estimate the SIR model parameters in `manage`
bkrate
number of samples of `b` and `k`, relative to `mu` and `nu` before a sample of all four parameters is saved in `manage`
vacsamps
used to thin the MCMC samples of the parameters sampled from the posterior that are used to calculate optimal vaccination policies; this should be an integer scalar such that `0 < vacsamps <= MCMCpits`
quant
a 2-vector of quantiles to use in order to capture the spread in the density of characteristics of the epidemic trajectory and costs
start
at what time, after time 1 where the state is given by `init`, should vaccinations be allowed to start
...
additional arguments passed to a user-defined `epistep` function

### Details

This function simulates many (`MCreps`) trajectories of an epidemic starting out in a particular state (`init`) and evolving according the dynamics encoded in `epistep` (or some other user-defined function) under an adaptive vaccination strategy as implemented by `manage`. Many of the arguments to this function are simply passed to `manage`.

It returns a summary of characteristics of the state trajector(y/ies) and the associated `cost`s. The output can be visualized with the generic `plot.MCepi` method and costs can be extracted with `getcost`.

For more details on the parameterization and simulation of the SIR model, etc., and the calculation of the optimal vaccination strategy, please see `vignette("amei")`

### Values

`MCmanage` returns an object of class `"MCepi"`, which is a `list` containing the following components.

These quantities can be visually inspected using the `plot.MCepi` method

Q1
a `data.frame` containing 8 columns (`S`, `I`, `R`, `D`, `V`, `C`, `frac`, `stop`) depicting the first quantile (`quant[1]`) of the distribution of the evolution of the state of the epidemic (SIRD), the number of vaccinations (V), the cost (C), the fraction vaccinated (F), and the stopping threshold (S) at each time point
Mean
same as `Q1` except the mean rather than a quantile
Median
same as `Median` except the median rather than mean
Q3
same as `Q1` except the third quantile (`quant[2]`)

### References

D. Merl, L.R. Johnson, R.B. Gramacy, and M.S. Mangel (2010). “amei: An R Package for the Adaptive Management of Epidemiological Interventions”. Journal of Statistical Software 36(6), 1-32. http://www.jstatsoft.org/v36/i06/ D. Merl, L.R. Johnson, R.B. Gramacy, M.S. Mangel (2009). “A Statistical Framework for the Adaptive Management of Epidemiological Interventions”. PLoS ONE, 4(6), e5807. http://www.plosone.org/article/info:doi/10.1371/journal.pone.0005807

`manage`, `MCepi`, `plot.MCepi`

### Examples

```## adaptively manage the epidemic with the following
## initial population
init <- list(S0=762, I0=1, R0=0, D0=0)

## construct a grid of valid vaccination strategies
## and specify costs
## using a smaller grid for faster check times; try the commented out
## setting for higher fidelity
vacgrid <- list(fracs=seq(0,1.0,0.25), stops=seq(2,init\$S0-75,150))
## vacgrid <- list(fracs=seq(0,1.0,0.1), stops=seq(2,init\$S0-75,75))
costs <- list(vac=2, death=4, infect=1)

## run the Monte Carlo management experiment, reducing MCMCpits
## for faster check times; try default (commented out) version
out.MCmanage <- MCmanage(init, epistep, vacgrid, costs,
MCMCpits=100, MCreps=5)
## out.MCmanage <- MCmanage(init, epistep, vacgrid, costs)

## plot the trajectories of SIR and the associated costs
plot(out.MCmanage, type="costs")

## extract the distribution of the number of
## cumulative vaccinations via median and quantiles
getvac(out.MCmanage)

## plot the distribution fractions vaccinated and
## stopping times
plot(out.MCmanage, type="fracs")
plot(out.MCmanage, type="stops")

## get the final median cost and quantiles --
## these can be compared with the static ones
## calculated by MCepi
getcost(out.MCmanage)```

### Author(s)

Daniel Merl
Leah R. Johnson
Robert B. Gramacy
and Mark S. Mangel

Documentation reproduced from package amei, version 1.0-7. License: GPL