Description Usage Arguments Value Author(s) References See Also Examples
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
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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
)
|
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 \insertCiteGhurye1969;textualBSL. “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 \insertCiteFrazier2019BSL. |
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 p by 2 numeric matrix indicating the
upper and lower bounds of parameters if a logit transformation is used on
the parameter space, where p is the number of parameters. The default
is |
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 \insertCiteBoudt2012BSL 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 ( |
An object of class bsl
is returned, see BSL
for more information of the S4 class.
Ziwen An, Leah F. South and Christopher Drovandi
Price2018BSL
\insertRefAn2019BSL
\insertRefAn2018BSL
ma2
, cell
, mgnk
and
toad
for examples. selectPenalty
for a function
to tune the BSLasso tuning parameter and plot
for functions
related to visualisation.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.