Description Usage Arguments Value See Also
View source: R/mcmc_wrapper_script.R
This is the highest level wrapper function for the MCMC algorithm that can be applied to any generic model, data and likelihood function. Calls another function, MCMC_fit_single
to carry out the random walk. This function takes care of formatting the results and carrying out some MCMC diagnostics and plots.
1 2 3 4 5 |
temp_dat |
the data over which to calculate likelihoods |
param_table |
table of parameter data as specified in |
iterations |
number of iterations for the MCMC algorithm |
opt_freq |
how frequently the acceptance rate is adapted. Defaults to 50 |
thin |
thinning value for the MCMC chain. Default is 1 |
burnin |
the length of the burn in period. Defaults to 100 |
adaptive_period |
length of the adaptive period. Defaults to 1 |
nchain |
number of chains to run |
popt |
the desired acceptance rate. Defaults to 0.44 |
filename |
the generic file name/location at which to save plots and diagnostics. Note that the file extension will be appended to this string |
LIKELIHOOD_FUNCTION |
a valid pointer to an R function which returns a single, log likelihood of the data given the current parameters |
MODEL_FUNCTION |
a valid pointer to an R function which is used to evaluate the model for the current set of parameters |
VERBOSE |
boolean flag for additional output. Defaults to FALSE |
PARALLEL |
OPTIONAL boolean flag indicating if each MCMC chain should be run in parallel using doPar. Defaults to FALSE |
OPTIM_PARAMS |
OPTIONAL boolean flag indicating if optim should be used to find the "best fit" parameters. Otherwise the maximum likelihood parameters from the MCMC chain will be used. Defaults to FALSE |
topdir |
the top level directory where the MCMC chains will be saved. By default, a tmp folder will be created in the home folder |
returns a list containing a vector of the maximum likelihood parameters, the time points of the fitted data, and a list of the MCMC chain files
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.