fastCV2: Fast cross-validation per data block

Description Usage Arguments Details Value See Also Examples

View source: R/MultiLambdaCVfun.R

Description

Fast cross-validation for high-dimensional data. Finds optimal penalties separately per data block. Useful for initialization.

Usage

1
2
3
fastCV2(XXblocks, Y, X1 = NULL, kfold = 10, intercept = ifelse(class(Y) ==
"Surv", FALSE, TRUE), parallel   = FALSE, fixedfolds = TRUE, model = NULL,
eps = 1e-10, reltol = 0.5, lambdamax= 10^6, traceCV=TRUE)

Arguments

XXblocks

List of data frames or matrices, representing b=1,...,B data blocks of dimensions n x p_b.

Y

Response vector: numeric, binary, factor or survival.

X1

Matrix. Dimension n x p_0, p_0 < n, representing unpenalized covariates.

kfold

Integer. Desired fold.

intercept

Boolean. Should an intercept be included?

parallel

Boolean. Should computation be done in parallel? If TRUE, requires to run setupParallel first.

fixedfolds

Boolean. Should fixed splits be used for reproducibility?

model

Character. Any of c("linear", "logistic", "cox"). Is inferred from Y when NULL.

eps

Scalar. Numerical bound for IWLS convergence.

reltol

Scalar. Relative tolerance for optimization method.

lambdamax

Numeric. Upperbound for lambda.

traceCV

Boolean. Should the CV results be traced and printed?

Details

This function is basically a wrapper for applying optLambdas per data block separately using Brent optimization.

Value

Numerical vector containing penalties optimized separately per data block. Useful for initialization.

See Also

optLambdas, optLambdasWrap which optimize the penalties jointly. A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4

Examples

1
2
3
4
5
6
data(dataXXmirmeth)
resp <- dataXXmirmeth[[1]]
XXmirmeth <- dataXXmirmeth[[2]]

cvperblock2 <- fastCV2(XXblocks=XXmirmeth,Y=resp,kfold=10,fixedfolds = TRUE)
lambdas <- cvperblock2$lambdas

multiridge documentation built on June 15, 2021, 9:08 a.m.