Least absolute shrinkage and selection operator through internal cross validation
lasso.intcv.Rd
Build a LASSO classifier using internal cross validation to choose the turning parameter, with a 5-fold cross validation as default.
Arguments
- kfold
number of folds. By default,
kfold = 5
.- X
dataset to be trained. This dataset must have rows as probes and columns as samples.
- y
a vector of sample group of each sample for the dataset to be trained. It must have an equal length to the number of samples in
X
.- seed
an integer used to initialize a pseudorandom number generator.
- alp
alpha, the penalty type. It can be any numeric value from 0 to 1. By default,
alp = 1
which is for LASSO.alp = 0
is for ridge and any value in between is for elastic net.
Value
a list of 4 elements:
- mc
an internal misclassification error rate
- time
the processing time of performing internal validation with LASSO
- model
a LASSO classifier, resulted from
cv.fit
- cfs
estimated coefficients for the final classifier
References
Friedman, J., Hastie, T. and Tibshirani, R. (2008) Regularization Paths for Generalized Linear Mod- els via Coordinate Descent, http://www.stanford.edu/~hastie/Papers/glmnet.pdf Journal of Statistical Software, Vol. 33(1), 1-22 Feb 2010
Examples
set.seed(101)
biological.effect <- estimate.biological.effect(uhdata = uhdata.pl)
ctrl.genes <- unique(rownames(uhdata.pl))[grep("NC", unique(rownames(uhdata.pl)))]
biological.effect.nc <- biological.effect[!rownames(biological.effect)
%in% ctrl.genes, ]
group.id <- substr(colnames(biological.effect.nc), 7, 7)
biological.effect.train.ind <- colnames(biological.effect.nc)[c(sample(which(
group.id == "E"), size = 64),
sample(which(group.id == "V"), size = 64))]
biological.effect.nc.tr <- biological.effect.nc[, biological.effect.train.ind]
lasso.int <- lasso.intcv(X = biological.effect.nc.tr,
y = substr(colnames(biological.effect.nc.tr), 7, 7),
kfold = 5, seed = 1, alp = 1)
#>