Performs an inversion of an arbitrary model using a modified Metropolis Hastings algorithm with block sampling. This may be slightly slower than the implementation in Fortran, but is much more customizable, as the model can be any R function.
Arguments
- observed
Vector, matrix, or data frame (coerced to matrix) of observed values. For spectral data, wavelengths are rows and spectra are columns. Dimensions must align with the output of
model.- invert.options
R list object containing inversion settings. See details.
- quiet
Suppress progress bar and status messages. Default=FALSE
- return.resume
If
TRUE, return results as list that includes current Jump distribution (useful for continuing an ongoing run) and acceptance rate. Default =FALSE.- runID
Run-unique ID. Useful for parallel runs. Default=NULL
Details
inversion.options contains the following:
inits– Vector of initial values of model parameters to be inverted.ngibbs– Number of MCMC iterationsprior.function– Function for use as prior. Should take a vector of parameters as input and return a single value – the sum of their log-densities – as output.param.mins– Vector of minimum values for inversion parametersparam.maxs– Vector of minimum values for inversion parametersmodel– The model to be inverted. This should be an R function that takesparamsandrunIDas input and returns one column ofobserved(nrows should be the same). Constants should be implicitly included here.adapt– Number of steps for adapting covariance matrix (i.e. adapt every 'n' steps). Default=100adj_min– Minimum threshold for rescaling Jump standard deviation. Default = 0.1.target– Target acceptance rate. Default=0.234, based on recommendation for multivariate block sampling in Haario et al. 2001do.lsq– Perform least squares optimization first (seeinvert.lsq), and use outputs to initialize Metropolis Hastings. This may improve mixing time, but risks getting caught in a local minimum. Default=FALSEcatch_error– IfTRUE(default), wrap model intryCatchto prevent sampling termination on model execution error.