smart (version 1.0.1)

gnsc.cv: A function to cross-validate the Group Nearest Shrunken Centroid Classifier

Description

A function to cross-validate the Group Nearest Shrunken Centroid Classifier produced by gnsc.train

Usage

gnsc.cv(fit, x, y = NULL, z = NULL, nfold = NULL, folds = NULL, verbose = T)

Arguments

fit
The result of a call to gnsc.train
x
The test data matrix (variables in the rows, samples in the columns).
y
The test class labels for samples, must have the same length as the column length of x.
z
The test class labels for variables, must have the same length as the row length of x.
nfold
Number of cross-validation folds. The default value is the smallest class size.
folds
The fold lables for each sample, must have the same length as y and max(folds)=nfold. The default value is sample(1:nfold,n,replace=T), here n is the sample size.
verbose
If verbose = FALSE, tracing information printing is disabled. The default value is TRUE.

Value

An object with S3 class "gnsccv" is returned:
lambda
A vector of the thresholds tried in the shrinkage
nlambda
The number of thresholds tried in the shrinkage
lambda.min
The index of the threshold which achieves the lowest cross-validation error
errors
The number of cross-validation errors for each threshold value
nonzero
The number of variables that survived the thresholding
Thresh.mat
A list of estimated tilde{mu}_{mk}. See Yang, et.al (2012) for details

Details

gnsc.cv carries out a cross-validation for Group Nearest Shrunken Centroid Classifier.

References

1.Juemin Yang, Fang Han, Rafa Irizarry, and Han Liu. Gene Context Analysis on Large-scale Genomic Data. Technical Report, Johns Hopkins University, 2012 2.Robert Tibshirani, Trevor Hastie, Balasubramanian Narasimhan, and Gilbert Chu. Diagnosis of multiple cancer types by shrunken centroids of gene expression PNAS, 99: 6567-6572.

See Also

gnsc.train

Examples

Run this code
set.seed(120)
x <- matrix(rnorm(1000*20),ncol=20)
y <- sample(c(1:4),size=20,replace=TRUE)
z <- sample(c(1:10),size=1000,replace=TRUE)
fit=gnsc.train(x, col.struc=y, row.struc=z,lambda.max=5, nlambda=20)
fit
plot(fit)
fit.cv=gnsc.cv(fit,x,y,z)
fit.cv
plot(fit.cv)

Run the code above in your browser using DataLab