pamr.confusion: A function giving a table of true versus predicted values,...

Description Usage Arguments Details Author(s) Examples

View source: R/pamr.confusion.R

Description

A function giving a table of true versus predicted values, from a nearest shrunken centroid fit.

Usage

1
pamr.confusion(fit, threshold, extra=TRUE)

Arguments

fit

The result of a call to pamr.train or pamr.cv

threshold

The desired threshold value

extra

Should the classwise and overall error rates be returned? Default TRUE

Details

pamr.confusion Gives a cross-tabulation of true versus predicted classes for the fit returned by pamr.train or pamr.cv, at the specified threshold.

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=y)
mytrain <-   pamr.train(mydata)
mycv <- pamr.cv(mytrain,mydata)
pamr.confusion(mytrain,  threshold=2)
pamr.confusion(mycv,  threshold=2)
 

Example output

Loading required package: cluster
Loading required package: survival
1234567891011121314151617181920212223242526272829301234Fold 1 :123456789101112131415161718192021222324252627282930
Fold 2 :123456789101112131415161718192021222324252627282930
Fold 3 :123456789101112131415161718192021222324252627282930
Fold 4 :123456789101112131415161718192021222324252627282930
  1 2 3 4 Class Error rate
1 0 0 5 0                1
2 0 0 4 0                1
3 0 0 6 0                0
4 0 0 5 0                1
Overall error rate= 0.609
  1 2 3 4 Class Error rate
1 0 0 5 0        1.0000000
2 0 0 4 0        1.0000000
3 0 0 5 1        0.1666667
4 0 0 3 2        0.6000000
Overall error rate= 0.571

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

Related to pamr.confusion in pamr...