Learn R Programming

mt (version 2.0-1.20)

boot.err: Calculate .632 and .632+ Bootstrap Error Rate

Description

Calculate .632 bootstrap and .632 plus bootstrap error rate.

Usage

boot.err(err, resub)

Value

A list with the following components:

ae

Apparent error rate.

boot

Average error rate of bootstrap samples(Same as err)

b632

.632 bootstrap error rate.

b632p

.632 plus bootstrap error rate.

Arguments

err

Average error rate of bootstrap samples.

resub

A list including apparent error rate, class label and the predicted class label of the original training data (not resampled training data). Can be generated by classifier.

Author

Wanchang Lin

References

Witten, I. H. and Frank, E. (2005) Data Mining - Practical Machine Learning and Techniques. Elsevier.

Efron, B. and Tibshirani, R. (1993) An Introduction to the Bootstrap. Chapman & Hall.

Efron, B. and Tibshirani, R. (1997) Improvements on cross-validation: the .632+ bootstrap method. Journal of the American Statistical Association, 92, 548-560.

See Also

classifier

Examples

Run this code
## iris data set
data(iris)
x      <- subset(iris, select = -Species)
y      <- iris$Species

## 10 bootstrap training samples 
pars   <- valipars(sampling = "boot", niter = 1, nreps = 10)
tr.idx <- trainind(y, pars=pars)[[1]]

## bootstrap error rate
err <- sapply(tr.idx, function(i){
  pred <- classifier(x[i,,drop = FALSE],y[i],x[-i,,drop = FALSE],y[-i], 
                     method = "knn")$err
})

## average bootstrap error rate
err <- mean(err)

## apparent error rate
resub  <- classifier(x,y,method = "knn")

## 
err.boot <- boot.err(err, resub)

Run the code above in your browser using DataLab