varband_cv {varband}R Documentation

Perform nfolds-cross validation

Description

Select tuning parameter by cross validation according to the likelihood on testing data, with and without refitting.

Usage

varband_cv(x, w = FALSE, lasso = FALSE, lamlist = NULL, nlam = 60,
  flmin = 0.01, folds = NULL, nfolds = 5)

Arguments

x

A n-by-p sample matrix, each row is an observation of the p-dim random vector.

w

Logical. Should we use weighted version of the penalty or not? If TRUE, we use general weight. If FALSE, use unweighted penalty. Default is FALSE.

lasso

Logical. Should we use l1 penalty instead of hierarchical group lasso penalty? Note that by using l1 penalty, we lose the banded structure in the resulting estimate. And when using l1 penalty, the becomes CSCS (Convex Sparse Cholesky Selection) introduced in Khare et al. (2016). Default value for lasso is FALSE.

lamlist

A list of non-negative tuning parameters lambda.

nlam

If lamlist is not provided, create a lamlist with length nulam. Default is 60.

flmin

If lamlist is not provided, create a lamlist with ratio of the smallest and largest lambda in the list equal to flmin. Default is 0.01.

folds

Folds used in cross-validation

nfolds

If folds are not provided, create folds of size nfolds.

Value

A list object containing

errs_fit:

A nlam-by-nfolds matrix of negative Gaussian log-likelihood values on the CV test data sets. errs[i,j] is negative Gaussian log-likelihood values incurred in using lamlist[i] on fold j

.

errs_refit:

A nlam-by-nfolds matrix of negative Gaussian log-likelihood values of the refitting.

folds:

Folds used in cross validation.

lamlist:

lambda grid used in cross validation.

ibest_fit:

index of lamlist minimizing CV negative Gaussian log-likelihood.

ibest_refit:

index of lamlist minimizing refitting CV negative Gaussian log-likelihood.

i1se_fit:

Selected value of lambda using the one-standard-error rule.

i1se_refit:

Selected value of lambda of the refitting process using the one-standard-error rule.

L_fit:

Estimate of L corresponding to ibest_fit.

L_refit:

Refitted estimate of L corresponding to ibest_refit.

See Also

varband varband_path

Examples

set.seed(123)
p <- 50
n <- 50
true <- varband_gen(p = p, block = 5)
x <- sample_gen(L = true, n = n)
res_cv <- varband_cv(x = x, w = FALSE, nlam = 40, flmin = 0.03)

[Package varband version 0.9.0 Index]