Learn R Programming

BSL (version 0.1.1)

selectPenalty: Selecting BSLasso Penalty

Description

This is the main function for selecting the penalty for BSLasso based on a point estimate of the parameters. Parallel computing is supported with the R package foreach.

Usage

selectPenalty(ssy, n, lambda_all, theta, M, sigma, fn_sim, fn_sum,
  sim_options = NULL, sum_options = NULL, standardise = FALSE,
  parallel_sim = FALSE, parallel_sim_packages = NULL,
  parallel_main = FALSE, verbose = TRUE)

Arguments

ssy

A summary statistic vector for the observed data.

n

A vector of possible values of n, the number of simulations from the model per MCMC iteration, to test.

lambda_all

A list, with each entry containing the vector of penalty values to test for the corresponding choice of n.

theta

A point estimate of the parameter value which all of the simulations will be based on.

M

The number of repeats to use in estimating the standard deviation of the estimated log synthetic likelihood.

sigma

The standard deviation of the log synthetic likelihood to aim for.

fn_sim

A function that simulates data for a given parameter value. The function can have at most two arguments. The first is the vector of tuning parameters and the second (optional) argument is 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 is the vector of tuning parameters and the second (optional) argument is a list of other necessary arguments. See sum_options.

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 statistic 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_sim

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

parallel_sim_packages

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

parallel_main

A logical value indicating whether parallel computing should be used to computing the graphical lasso function. Default is FALSE.

verbose

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

Value

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

  • resultsDF: A data frame containing the following:

    • n: The choices of n that were specified.

    • penalty: The choices of the penalty that were specified.

    • sigma: The standard deviation of the log synthetic likelihood under the above choices.

    • sigmaOpt: An indicator of whether it was the closest sigma to the desired one for each choice of n.

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

The functions print() and plot() are both available for types of class penbsl.

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/

See Also

bsl for a function to run BSLasso after selecting the tuning parameter and plot for functions related to visualisation.