View source: R/selectPenalty.R
selectPenalty | R Documentation |
This is the main function for selecting the shrinkage (graphical
lasso or Warton's estimator) penalty parameter for method BSL or semiBSL
based on a point estimate of the parameters. Parallel computing is
supported with the R package foreach
. The penalty selection method
is outlined in \insertCiteAn2019;textualBSL.
selectPenalty( ssy, n, lambda, M, sigma = 1.5, model, theta = NULL, method = c("BSL", "semiBSL"), shrinkage = c("glasso", "Warton"), parallelSim = FALSE, parallelSimArgs = NULL, parallelMain = FALSE, verbose = 1L, ... )
ssy |
A summary statistic vector for the observed data. |
n |
A vector of possible values of |
lambda |
A list, with each entry containing the vector of
penalty values to test for the corresponding choice of |
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 estimator to aim for, usually a value between 1 and 2. This parameter helps to control the mixing of a Markov chain. |
model |
A “MODEL” object generated with function
|
theta |
A point estimate of the parameter value which
all of the simulations will be based on. By default, if |
method |
A string argument indicating the method to be used. If the method is “BSL”, the shrinkage is applied to the Gaussian covariance matrix. Otherwise if the method is “semiBSL”, the shrinkage is applied to the correlation matrix of the Gaussian copula. |
shrinkage |
A string argument indicating which shrinkage method to be used. Current options are “glasso” for the graphical lasso method of \insertCiteFriedman2008;textualBSL and “Warton” for the ridge regularisation method of \insertCiteWarton2008;textualBSL. |
parallelSim |
A logical value indicating whether parallel
computing should be used for simulation and summary statistic evaluation.
Default is |
parallelSimArgs |
A list of additional arguments to pass into the
|
parallelMain |
A logical value indicating whether parallel
computing should be used to computing the graphical lasso function. Notice
that this should only be turned on when there are a lot of candidate values
in |
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 ( |
... |
Other arguments to pass to |
An S4 object PENALTY
of the penalty selection results. The
show
and plot
methods are provided with the S4 class.
Ziwen An, Leah F. South and Christopher Drovandi
PENALTY
for the usage of the S4 class. ma2
,
cell
and mgnk
for examples. bsl
for the main function to run BSL.
## Not run: data(ma2) model <- newModel(fnSimVec = ma2_sim_vec, fnSum = ma2_sum, simArgs = ma2$sim_args, theta0 = ma2$start, fnLogPrior = ma2_prior) theta <- c(0.6,0.2) # Performing tuning for BSLasso (BSL with glasso shrinkage estimation) ssy <- ma2_sum(ma2$data) lambda_all <- list(exp(seq(-3,0.5,length.out=20)), exp(seq(-4,-0.5,length.out=20)), exp(seq(-5.5,-1.5,length.out=20)), exp(seq(-7,-2,length.out=20))) set.seed(100) sp_ma2 <- selectPenalty(ssy = ssy, n = c(50, 150, 300, 500), lambda_all, theta = theta, M = 100, sigma = 1.5, model = model, method = 'BSL', shrinkage = 'glasso') sp_ma2 plot(sp_ma2) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.