pamr.cv: A function to cross-validate the nearest shrunken centroid...

Description Usage Arguments Details Value Author(s) Examples

View source: R/pamr.cv.R

Description

A function to cross-validate the nearest shrunken centroid classifier produced by pamr.train

Usage

1
pamr.cv(fit, data,  nfold = NULL, folds = NULL,...)

Arguments

fit

The result of a call to pamr.train

data

A list with at least two components: x- an expression genes in the rows, samples in the columns), and y- a vector of the class labels for each sample. Same form as data object used by pamr.train.

nfold

Number of cross-validation folds. Default is the smallest class size

folds

A list with nfold components, each component a vector of indices of the samples in that fold. By default a (random) balanced cross-validation is used

.

...

Any additional arguments that are to be passed to pamr.train

Details

pamr.cv carries out cross-validation for a nearest shrunken centroid classifier.

Value

A list with components

threshold

A vector of the thresholds tried in the shrinkage

errors

The number of cross-validation errors for each threshold value

loglik

The cross-validated multinomial log-likelihood value for each threshold value

size

A vector of the number of genes that survived the thresholding, for each threshold value tried.

.

yhat

A matrix of size n by nthreshold, containing the cross-validated class predictions for each threshold value, in each column

prob

A matrix of size n by nthreshold, containing the cross-validated class probabilities for each threshold value, in each column

folds

The cross-validation folds used

cv.objects

Train objects (output of pamr.train), from each of the CV folds

call

The calling sequence used

Author(s)

Trevor Hastie,Robert Tibshirani, Balasubramanian Narasimhan, and Gilbert Chu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
suppressWarnings(RNGversion("3.5.0"))
set.seed(120)
x <- matrix(rnorm(1000*20),ncol=20)
y <- sample(c(1:4),size=20,replace=TRUE)

mydata <- list(x=x,y=factor(y), geneid=as.character(1:nrow(x)),
 genenames=paste("g",as.character(1:nrow(x)),sep=""))

mytrain <-   pamr.train(mydata)
mycv <- pamr.cv(mytrain,mydata)

Example output

Loading required package: cluster
Loading required package: survival
1234567891011121314151617181920212223242526272829301234Fold 1 :123456789101112131415161718192021222324252627282930
Fold 2 :123456789101112131415161718192021222324252627282930
Fold 3 :123456789101112131415161718192021222324252627282930
Fold 4 :123456789101112131415161718192021222324252627282930

pamr documentation built on May 2, 2019, 12:35 p.m.

Related to pamr.cv in pamr...