pdmClass.cv: Leave One Out Crossvalidation

Description Usage Arguments Details Value Author(s) References Examples

View source: R/pdmclass.R


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


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



A vector of factors giving the class assignments for the samples to be used in the crossvalidation.


A matrix with samples in rows and observations in columns. Note that this is different than the usual paradigm for microarray data.


One of "pls", "pcr", "ridge", corresponding to partial least squares, principal components regression and ridge regression.


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.


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.


James W. MacDonald



"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).


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

Example output

Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: fibroEset
Loading required package: mda
Loading required package: class
Loaded mda 0.4-10

Warning message:

*** Deprecation warning ***
The pdmclass package is deprecated and will be removed from
Bioconductor 3.6.
predicted  b  g  h
        b 11  0  5
        g  0 12  0
        h  0  0 18

pdmclass documentation built on Nov. 17, 2017, 12:19 p.m.