Learn R Programming

BSL (version 0.1.1)

bsl: Performing BSL and BSLasso

Description

This is the main function for performing MCMC BSL and MCMC BSLasso. Parallel computing is supported with the R package foreach.

Usage

bsl(y, n, M, start, cov_rw, fn_sim, fn_sum, penalty = NULL, fn_prior = NULL,
  sim_options = NULL, sum_options = NULL, standardise = FALSE,
  parallel = FALSE, parallel_packages = NULL, theta_names = NULL,
  verbose = TRUE)

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.

M

The number of MCMC iterations.

start

Initial guess of the parameter value.

cov_rw

A covariance matrix to be used in multivariate normal random walk proposals.

fn_sim

A function that simulates data for a given parameter value. The function can have at most two arguments. The first should be the vector of tuning parameters and the second (optional) argument should be a list of other necessary arguments. See sim_options.

fn_sum

A function for computing summary statistics of data. The function can have at most two arguments. The first should be the vector of tuning parameters and the second (optional) argument should be a list of other necessary arguments. See sum_options.

penalty

The penalty value of the graphical lasso. BSLasso is performed if a numeric value is specified. The default is NULL, which means that BSL is performed.

fn_prior

A function that computes the prior density for a parameter. The default is NULL, which is an improper flat prior over the real line for each parameter. The function must have a single input: the vector of proposed parameters.

sim_options

A list of additional arguments to pass into the simulation function. Only use when the input fn_sim requires additional arguments. The default is NULL.

sum_options

A list of additional arguments to pass into the summary statistics function. Only use when the input fn_sum requires additional arguments. The default is NULL.

standardise

A logical argument that determines whether to standardise the summary statistics before applying the graphical lasso. This is only valid if penalty is not NULL. The diagonal elements will not be penalised if the penalty is not NULL. The default is FALSE.

parallel

A logical value indicating whether parallel computing should be used for simulation and summary statistic evaluation. Default is FALSE.

parallel_packages

A character vector of package names to pass into the foreach function as argument '.package'. Only used when parallel computing is enabled, default is NULL.

theta_names

A character vector of parameter names, which must has the same length as the parameter vector. The default is NULL.

verbose

A logical argument indicating whether the iteration numbers (1:M) and accepted proposal flags should be printed to track progress. The default is FALSE.

Value

An object of class bsl is returned, containing the following components:

  • theta: MCMC samples from the joint approximate posterior distribution of the parameters.

  • loglike: MCMC samples of the estimated log-likelihood values.

  • 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).

  • call: The original code that was used to call the method.

  • theta_names: A character vector of parameter names.

The functions print(), summary() and plot() are all available for types of class bsl. Multiple results can be plotted with overlapping densities using combinePlotsBSL.

References

An, Z., South, L. F., Nott, D. J. & Drovandi, C. C. (2018). Accelerating Bayesian synthetic likelihood with the graphical lasso. https://eprints.qut.edu.au/102263/

Price, L. F., Drovandi, C. C., Lee, A., & Nott, D. J. (2018). Bayesian synthetic likelihood. To appear in Journal of Computational and Graphical Statistics. https://eprints.qut.edu.au/92795/

See Also

selectPenalty for a function to tune the BSLasso tuning parameter and plot for functions related to visualisation.