Learn R Programming

varSelRF (version 0.7-3)

plot.varSelRFBoot: plot a varSelRFBoot object

Description

Plots of out-of-bag predictions and OOB error vs. number of variables.

Usage

## S3 method for class 'varSelRFBoot':
plot(x,  oobProb = TRUE,
                  oobProbBoxPlot = FALSE,
                  ErrorNum = TRUE,
                  subject.names = NULL,
                  class.to.plot = NULL,...)

Arguments

x
An object of class varSelRFBoot, such as returned by function varSelRFBoot.
oobProb
If TRUE plot (average) out-of-bag predictions. See prob.predictions in varSelRFBoot for more details about the out-of-bag predictions.
oobProbBoxPlot
If TRUE plot a box-plot of out-of-bag predictions.
ErrorNum
If TRUE plot OOB error (as returned by random forest) vs. the number of variables.
subject.names
If not NULL, a vector, of the same length as the number of cases (samples or subjects) with IDs for the cases/samples/subjects, that will be shown to the left of the average out-of-bag prediction.
class.to.plot
If not NULL, an integer or a vector of integers. These integers are those class levels for which out-of-bag predictions plots will be returned.
...
Not used.

Value

  • This function is only used for its side effects of producing plots.

Warning

The OOB Error rate is biased down (and can be severely biased down) because we do (potentially many) rounds of reducing the set of predictor variables until we minimize this OOB error rate. Note, however, that this is NOT the error rate reported as the estimate of the error rate for the procedure (for which we use the .632+ bootstrap rule).

References

Breiman, L. (2001) Random forests. Machine Learning, 45, 5--32.

Diaz-Uriarte, R. and Alvarez de Andres, S. (2005) Variable selection from random forests: application to gene expression data. Tech. report. http://ligarto.org/rdiaz/Papers/rfVS/randomForestVarSel.html

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

See Also

randomForest, varSelRF, summary.varSelRFBoot, varSelRFBoot

Examples

Run this code
## This is a small example, but can take some time.

x <- matrix(rnorm(25 * 30), ncol = 30)
x[1:10, 1:2] <- x[1:10, 1:2] + 2
cl <- factor(c(rep("A", 10), rep("B", 15)))  

rf.vs1 <- varSelRF(x, cl, ntree = 200, ntreeIterat = 100,
                   vars.drop.frac = 0.2)
rf.vsb <- varSelRFBoot(x, cl,
                       bootnumber = 10,
                       usingCluster = FALSE,
                       srf = rf.vs1)
rf.vsb
summary(rf.vsb)
plot(rf.vsb)

Run the code above in your browser using DataLab