Learn R Programming

pdmclass (version 1.44.0)

pdmClass.cv: Leave One Out Crossvalidation

Description

This function performs a leave one out crossvalidation to estimate the accuracy of a classifier built using pdmClass.

Usage

pdmClass.cv(Y, X, method = c("pls", "pcr", "ridge"))

Arguments

Y
A vector of factors giving the class assignments for the samples to be used in the crossvalidation.
X
A matrix with samples in rows and observations in columns. Note that this is different than the usual paradigm for microarray data.
method
One of "pls", "pcr", "ridge", corresponding to partial least squares, principal components regression and ridge regression.

Value

A vector of factors giving the predicted class assignments for each of the samples in the training set. A confusion matrix can be constructed using confusion.

Details

This function performs a leave one out crossvalidation, which can be used to estimate the accuracy of a classifier. Each sample is removed in turn and a classifier is built using the remaining samples. The class of the removed sample is then predicted using the classifier. This is repeated for each sample, resulting in a vector of predicted class assignments for each sample in the original training set.

Although far from perfect, this method can be used to estimate the accuracy of a given classifier without splitting data into a training and testing set.

References

http://www.sph.umich.edu/~ghoshd/COMPBIO/POPTSCORE

"Flexible Disriminant Analysis by Optimal Scoring" by Hastie, Tibshirani and Buja, 1994, JASA, 1255-1270.

"Penalized Discriminant Analysis" by Hastie, Buja and Tibshirani, Annals of Statistics, 1995 (in press).

Examples

Run this code
library(fibroEset)
data(fibroEset)
y <- as.factor(pData(fibroEset)[,2])
x <- t(exprs(fibroEset))
tmp <- pdmClass.cv(y, x)
confusion(tmp, y)

Run the code above in your browser using DataLab