cv.catch {catch} | R Documentation |
Cross-validation for CATCH
Description
Performs k-fold cross validation for CATCH and returns the best tuning parameter \lambda
in the user-specified or automatically generated choices.
Usage
cv.catch(x, z = NULL, y, nfolds = 5, lambda = NULL,
lambda.opt = "min",...)
Arguments
x |
Input tensor or matrix list of length |
z |
Input covariate matrix of dimension |
y |
Class label. For |
nfolds |
Number of folds. Default value is |
lambda |
User-specified |
lambda.opt |
The optimal criteria when multiple elements in |
... |
Other arguments that can be passed to |
Details
The function cv.catch
runs function catch
nfolds+1
times. The first one fits model on all data. If lambda
is specified, it will check if all lambda
satisfies the constraints of dfmax
and pmax
in catch
. If not, a lambda
sequence will be generated according to lambda.factor
in catch
. Then the rest nfolds
many replicates will fit model on nfolds-1
many folds data and predict on the omitted fold, repectively. Return the lambda
with minimum average cross validation error and the largest lambda
within one standard error of the minimum.
Value
lambda |
The actual |
cvm |
The mean of cross validation errors for each |
cvsd |
The standard error of cross validaiton errors for each |
lambda.min |
The |
lambda.1se |
The largest |
catch.fit |
The fitted |
Author(s)
Yuqing Pan, Qing Mai, Xin Zhang
References
Pan, Y., Mai, Q., and Zhang, X. (2018) Covariate-Adjusted Tensor Classification in High-Dimensions, arXiv:1805.04421.
See Also
Examples
n <- 20
p <- 4
k <- 2
nvars <- p*p*p
x <- array(list(),n)
vec_x <- matrix(rnorm(n*nvars), nrow=n, ncol=nvars)
vec_x[1:10,] <- vec_x[1:10,]+2
z <- matrix(rnorm(n*2),nrow=n,ncol=2)
z[1:10,] <- z[1:10,]+0.5
y <- c(rep(1,10),rep(2,10))
for (i in 1:n){
x[[i]] <- array(vec_x[i,], dim=c(p,p,p))
}
objcv <- cv.catch(x, z, y=y)