Description Usage Arguments Value See Also
The Adaptive Metropolis-within-Gibbs algorithm. Given a starting point and the necessary MCMC parameters as set out below, performs a random-walk of the posterior space to produce an MCMC chain that can be used to generate MCMC density and iteration plots. The algorithm undergoes an adaptive period, where it changes the step size of the random walk for each parameter to approach the desired acceptance rate, popt. After this, a burn in period is established, and the algorithm then uses proposalfunction
to explore the parameter space, recording the value and posterior value at each step. The MCMC chain is saved in blocks as a .csv file at the location given by filename.
1 2 3 |
data |
the microcephaly data against which the likelihood is calculated |
ts |
vector of times to solve the ODE model over |
parTab |
a table of parameter data used for information such as bounds and prior function pointers. |
mcmcPars |
a named vector with parameters for the MCMC procedure. Iterations, popt, opt_freq, thin, burnin, adaptive_period and save_block. |
filename |
the full filepath at which the MCMC chain should be saved. "_chain.csv" will be appended to the end of this, so filename should have no file extensions |
mvrPars |
a list of parameters if using a multivariate proposal. Must contain an initial covariance matrix, weighting for adapting cov matrix, and an initial scaling parameter (0-1) |
incDat |
optional data frame of incidence data if including incidence data in the likelihood function |
peakTimes |
optional parameter - data frame of peak times for Zika incidence for each state |
allPriors |
user function of prior for model parameters. Should take values, names and local from parTab |
version |
usually just leave this as "normal". I've added a "forecast" version which expects parameters to do with the lack of second wave. |
a list with: 1) full file path at which the MCMC chain is saved as a .csv file; 2) the last used covarianec matrix; 3) the last used scale size
posterior_complex_buckets
, proposalfunction
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.