This is the main function for performing MCMC BSL, MCMC uBSL, MCMC BSLasso and MCMC semiBSL.
Parallel computing is supported with the R package foreach
. Several input arguments in 2.0.0 or earlier versions
are replaced by model
in the new update and will be deprecated in a future release.
bsl(y, n, M, model, covRandWalk, theta0, fnSim, fnSum, method = c("BSL",
"uBSL", "semiBSL")[1], shrinkage = NULL, penalty = NULL,
fnPrior = NULL, simArgs = NULL, sumArgs = NULL,
logitTransformBound = NULL, standardise = FALSE, GRC = FALSE,
parallel = FALSE, parallelArgs = NULL, thetaNames = NULL,
plotOnTheFly = FALSE, verbose = FALSE)
The observed data. Note this should be the raw dataset NOT the set of summary statistics.
The number of simulations from the model per MCMC iteration for estimating the synthetic likelihood.
The number of MCMC iterations.
A ``BSLMODEL'' object generated with function BSLModel
. See BSLModel
.
The covariance matrix of a multivariate normal random walk proposal distribution used in the MCMC.
Deprecated, will be removed in the future, use model
instead. Initial guess of the parameter
value, which is used as the starting value for MCMC.
Deprecated, will be removed in the future, use model
instead. A function that simulates data
for a given parameter value. The first argument should be the parameters. Other necessary arguments (optional) can be
specified with simArgs
.
Deprecated, will be removed in the future, use model
instead. A function for computing summary
statistics of data. The first argument should be the observed or simulated dataset. Other necessary arguments (optional)
can be specified with sumArgs
.
A string argument indicating the method to be used. The default, ``BSL'', runs standard BSL. ``uBSL'' uses the unbiased estimator of a normal density of Ghurye and Olkin (1969). ``semiBSL'' runs the semi-parametric BSL algorithm and is more robust to non-normal summary statistics.
A string argument indicating which shrinkage method to be used. The default is NULL
,
which means no shrinkage is used. Shrinkage estimation is only available for method ``BSL'' and ``semiBSL''. Current options
are ``glasso'' for the graphical lasso method of Friedman et al (2008) and ``Warton'' for the ridge regularisation method
of Warton (2008).
The penalty value to be used for the specified shrinkage method. Must be between zero and one if the shrinkage method is ``Warton''.
Deprecated, will be removed in the future, use model
instead. A function that computes the
log of prior density for a parameter. The default is NULL
, which uses an improper flat prior over the real line
for each parameter. The function must have a single input: a vector of parameter values.
Deprecated, will be removed in the future, use model
instead. A list of additional arguments
to pass into the simulation function. Only use when the input fnSim
requires additional arguments. The default is
NULL
.
Deprecated, will be removed in the future, use model
instead. A list of additional arguments
to pass into the summary statistics function. Only use when the input fnSum
requires additional arguments. The
A \(p\) by \(2\) numeric matrix indicating the upper and lower bound of parameters if a logit
transformation is used on the parameter space, where \(p\) is the number of parameters. The default is NULL
,
which means no logit transformation is used. It is also possible to define other transformations with fnSim
and fnPrior
. The first column contains the lower bound of each parameter and the second column contains the
upper bound. Infinite lower or upper bound is also supported, eg. matrix(c(1,Inf,0,10,-Inf,0.5),3,2,byrow=TRUE)
.
A logical argument that determines whether to standardise the summary statistics before applying
the graphical lasso. This is only valid if method is ``BSL'', shrinkage is ``glasso'' and penalty is not NULL
. The
diagonal elements will not be penalised if the shrinkage method is ``glasso''. The default is FALSE
.
A logical argument indicating whether the Gaussian rank correlation matrix (Boudt et al., 2012)
should be used to estimate the covariance matrix in ``BSL'' method. The default is FALSE
, which uses the
sample covariance by default.
A logical value indicating whether parallel computing should be used for simulation and summary
statistic evaluation. The default is FALSE
. When model simulation is fast, it may be preferable to perform
serial computations to avoid significant communication overhead between workers.
A list of additional arguments to pass into the foreach
function. Only used when parallel
computing is enabled, default is NULL
.
Deprecated, will be removed in the future, use model
instead. A string vector of parameter
names, which must have the same length as the parameter vector. The default is NULL
.
A logical or numeric argument defining whether or by how many iterations a posterior figure will
be plotted during running. If TRUE
, a plot of approximate univariate posteriors based on the current accepted
samples will be shown by every one thousand iterations. The default is FALSE
.
A logical argument indicating whether the iteration numbers (1:M
) and accepted proposal
flags should be printed to track progress. The default is FALSE
.
An object of class bsl
is returned, containing the following components:
theta
: MCMC samples from the joint approximate posterior distribution of the parameters.
loglike
: Accepted MCMC samples of the estimated log-likelihood values.
call
: The original code that was used to call the method.
model
: The ``BSLMODEL'' object.
acceptanceRate
: The acceptance rate of the MCMC algorithm.
earlyRejectionRate
: The early rejection rate of the algorithm (early rejection may occur when using
bounded prior distributions).
errorRate
: The error rate. If any infinite summary statistic or positive infinite loglike occurs during
the process, it is marked as an error and the proposed parameter will be rejected.
y
: The input observed data.
n
: The number of simulations from the model per MCMC iteration.
M
: The number of MCMC iterations.
covRandWalk
: The covariance matrix used in multivariate normal random walk proposals.
method
: The string argument indicating the used method.
shrinkage
: The string argument indicating the shrinkage method.
penalty
: The penalty value.
standardise
: Logical, whether to standardise the summary statistics.
GRC
: Logical, if Gaussian rank correlation matrix is used.
logitTransform
: Logical, whether a logit transformation is used in the algorithm.
logitTransformBound
: The matrix of logitTransformBound.
parallel
: Logical, whether parallel computing is used in the process.
parallelArgs
: The list of additional arguments to pass into the foreach
function.
time
: The running time of class difftime
.
Price, L. F., Drovandi, C. C., Lee, A., & Nott, D. J. (2018). Bayesian synthetic likelihood. Journal of Computational and Graphical Statistics. https://doi.org/10.1080/10618600.2017.1302882
An, Z., South, L. F., Nott, D. J. & Drovandi, C. C. (2019). Accelerating Bayesian synthetic likelihood with the graphical lasso. Journal of Computational and Graphical Statistics. https://doi.org/10.1080/10618600.2018.1537928
An, Z., Nott, D. J. & Drovandi, C. (2018). Robust Bayesian Synthetic Likelihood via a Semi-Parametric Approach. ArXiv Preprint https://arxiv.org/abs/1809.05800
Friedman J, Hastie T, & Tibshirani R. (2008). Sparse inverse covariance estimation with the graphical lasso. Biostatistics. https://doi.org/10.1093/biostatistics/kxm045
Warton, D. I. (2008). Penalized Normal Likelihood and Ridge Regularization of Correlation and Covariance Matrices, Journal of the American Statistical Association. https://doi.org/10.1198/016214508000000021
Ghurye, S. G., & Olkin, I. (1969). Unbiased estimation of some multivariate probability densities and related functions. The Annals of Mathematical Statistics. https://projecteuclid.org/euclid.aoms/1177697501
Boudt, K., Cornelissen, J., and Croux, C. (2012). The Gaussian rank correlation estimator: robustness properties. Statistics and Computing, 22(2):471-483.
ma2
, cell
and mgnk
for examples.
selectPenalty
for a function to tune the BSLasso tuning parameter
and plot
for functions related to visualisation.