cv_ggb: Cross Validation to Select Lambda for GGB Estimator

Description Usage Arguments Value See Also Examples

Description

Performs nfold-fold cross validation to select the tuning parameter for GGB. Takes fit object created by ggb and computes CV error at the sequence of lambda values from that object.

Usage

1
cv_ggb(x, fit, g, errfun = NULL, nfolds = 5, ...)

Arguments

x

n-by-p data matrix

fit

object of class ggb (as outputted by ggb)

g

seed graph (should match that used to compute fit)

errfun

a user-specified function measuring the loss incurred by estimating est (first argument) when the true covariance matrix is true (second argument). Default: Squared Frobenius norm.

nfolds

number of folds for cross-validation (default: 5)

...

additional arguments (passed to ggb)

Value

errs:

A nlam-by-nfolds matrix of errors. errs[l, j] is error incurred in using lamlist[l] on fold j

m:

CV error error for each value of lambda.

se:

Standard error (estimated over folds) for each value of lambda

lambda_best:

Value of lambda minimizing CV error.

ibest:

Index of lambda minimizing CV error.

lambda_1se:

Selected value of lambda using the one-standard-error rule, a common heuristic that favors a sparser model when there isn't strong evidence against it.

i1se:

Index of lambda of one-standard-error rule.

See Also

ggb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(123)
n <- 20
p <- 10
g <- igraph::graph.lattice(c(5, 2))
x <- matrix(rnorm(n * p), n, p)
S <- stats::cov(x)
fit <- ggb(S, g, type = "local")
cv <- cv_ggb(x, fit, g)
plot(cv)
Sighat <- fit$Sig[[cv$i1se]]

unix9999/insurance documentation built on May 26, 2019, 5:34 a.m.