bsl {BSL} | R Documentation |
Performing BSL, uBSL, semiBSL and BSLmisspec
Description
This is the main function for performing MCMC BSL (with a
standard or non-standard likelihood estimator) to sample from the
approximate posterior distribution. A couple of extentions to the standard
approach are available by changing the following arguments, method
,
shrinkage
, whitening
, misspecType
. Parallel computing
is supported with the R package foreach
.
Usage
bsl(
y,
n,
M,
model,
covRandWalk,
theta0,
fnSim,
fnSum,
method = c("BSL", "uBSL", "semiBSL", "BSLmisspec"),
shrinkage = NULL,
penalty = NULL,
fnPrior = NULL,
simArgs = NULL,
sumArgs = NULL,
logitTransformBound = NULL,
standardise = FALSE,
GRC = FALSE,
whitening = NULL,
misspecType = NULL,
tau = 1,
parallel = FALSE,
parallelArgs = NULL,
thetaNames = NULL,
plotOnTheFly = FALSE,
verbose = 1L
)
Arguments
y |
The observed data. Note this should be the raw dataset NOT the set of summary statistics. |
n |
The number of simulations from the model per MCMC iteration for estimating the synthetic likelihood. |
M |
The number of MCMC iterations. |
model |
A “MODEL” object generated with function
|
covRandWalk |
The covariance matrix of a multivariate normal random walk proposal distribution used in the MCMC. |
theta0 |
Deprecated, will be removed in the future, use |
fnSim |
Deprecated, will be removed in the future, use
|
fnSum |
Deprecated, will be removed in the future, use
|
method |
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. “BSLmisspec” estimates the Gaussian synthetic likelihood whilst acknowledging that there may be incompatibility between the model and the observed summary statistic (Frazier and Drovandi 2021). |
shrinkage |
A string argument indicating which shrinkage method to
be used. The default is |
penalty |
The penalty value to be used for the specified shrinkage method. Must be between zero and one if the shrinkage method is “Warton”. |
fnPrior |
Deprecated, will be removed in the future, use
|
simArgs |
Deprecated, will be removed in the future, use
|
sumArgs |
Deprecated, will be removed in the future, use
|
logitTransformBound |
A |
standardise |
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
|
GRC |
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 |
whitening |
This argument determines whether Whitening transformation
should be used in “BSL” method with Warton's shrinkage. Whitening
transformation helps decorrelate the summary statistics, thus encouraging
sparsity of the synthetic likelihood covariance matrix. This might allow
heavier shrinkage to be applied without losing much accuracy, hence
allowing the number of simulations to be reduced. By default, |
misspecType |
A string argument indicating which type of model
misspecification to be used. The two options are "mean" and "variance".
Only used when method is “BSLmisspec”. The default, |
tau |
A numeric argument, parameter of the prior distribution
for "BSLmisspec" method. For mean adjustment, |
parallel |
A logical value indicating whether parallel computing should
be used for simulation and summary statistic evaluation. The default is
|
parallelArgs |
A list of additional arguments to pass into the
|
thetaNames |
Deprecated, will be removed in the future, use |
plotOnTheFly |
A logical or numeric argument defining whether or by how
many iterations a posterior figure will be plotted during running. If
|
verbose |
An integer indicating the verbose style. 0L
means no verbose messages will be printed. 1L uses a custom progress bar to
track the progress. 2L prints the iteration numbers ( |
Value
An object of class bsl
is returned, see BSL
for more information of the S4 class.
Author(s)
Ziwen An, Leah F. South and Christopher Drovandi
References
Boudt K, Cornelissen J, Croux C (2012).
“The Gaussian Rank Correlation Estimator: Robustness Properties.”
Statistics and Computing, 22(2), 471–483.
doi: 10.1007/s11222-011-9237-0.
Frazier DT, Drovandi C (2021).
“Robust Approximate Bayesian Inference with Synthetic Likelihood.”
Journal of Computational and Graphical Statistics (In Press).
https://arxiv.org/abs/1904.04551.
Friedman J, Hastie T, Tibshirani R (2008).
“Sparse Inverse Covariance Estimation with the Graphical Lasso.”
Biostatistics, 9(3), 432–441.
Ghurye SG, Olkin I (1969).
“Unbiased Estimation of Some Multivariate Probability Densities and Related Functions.”
Ann. Math. Statist., 40(4), 1261–1271.
Warton DI (2008).
“Penalized Normal Likelihood and Ridge Regularization of Correlation and Covariance Matrices.”
Journal of the American Statistical Association, 103(481), 340–349.
doi: 10.1198/016214508000000021.
Price LF, Drovandi CC, Lee A, Nott DJ (2018). “Bayesian Synthetic Likelihood.” Journal of Computational and Graphical Statistics, 27, 1–11. doi: 10.1080/10618600.2017.1302882.
An Z, South LF, Nott DJ, Drovandi CC (2019). “Accelerating Bayesian Synthetic Likelihood With the Graphical Lasso.” Journal of Computational and Graphical Statistics, 28(2), 471–475. doi: 10.1080/10618600.2018.1537928.
An Z, Nott DJ, Drovandi C (2019). “Robust Bayesian Synthetic Likelihood via a Semi-Parametric Approach.” Statistics and Computing (In Press).
See Also
ma2
, cell
, mgnk
and
toad
for examples. selectPenalty
for a function
to tune the BSLasso tuning parameter and plot
for functions
related to visualisation.
Examples
## Not run:
# This is just a minimal test run, please see package built-in examples for more
# comprehensive usages of the function
toy_sim <- function(n, theta) matrix(rnorm(n, theta), nrow = n)
toy_sum <- function(x) x
model <- newModel(fnSimVec = toy_sim, fnSum = toy_sum, theta0 = 0)
result_toy <- bsl(y = 1, n = 100, M = 1e4, model = model, covRandWalk = matrix(1),
method = "BSL", plotOnTheFly = TRUE)
summary(result_toy)
plot(result_toy)
## End(Not run)