plot.vimp.covregrf {CovRegRF}R Documentation

Plot variable importance measures for covregrf objects

Description

Plots variable importance measures (VIMP) for covariates for training data.

Usage

## S3 method for class 'covregrf'
plot.vimp(x, sort = TRUE, ndisp = NULL, ...)

Arguments

x

An object of class (covregrf, grow) or (covregrf, vimp).

sort

Should the covariates be sorted according to their variable importance measures in the plot? The default is TRUE.

ndisp

Number of covariates to display in the plot. If sort= TRUE, the most important ndisp covariates will be plotted. Otherwise, the first ndisp covariates in the original call will be plotted. The default value is NULL which will plot all covariates.

...

Optional arguments to be passed to other methods.

Value

Invisibly, the variable importance measures that were plotted.

See Also

vimp.covregrf

Examples

options(rf.cores=2, mc.cores=2)

## load generated example data
data(data, package = "CovRegRF")
xvar.names <- colnames(data$X)
yvar.names <- colnames(data$Y)
data1 <- data.frame(data$X, data$Y)

## define train/test split
set.seed(2345)
smp <- sample(1:nrow(data1), size = round(nrow(data1)*0.6), replace = FALSE)
traindata <- data1[smp,,drop=FALSE]
testdata <- data1[-smp, xvar.names, drop=FALSE]

## formula object
formula <- as.formula(paste(paste(yvar.names, collapse="+"), ".", sep=" ~ "))

## train covregrf
covregrf.obj <- covregrf(formula, traindata, params.rfsrc = list(ntree = 50),
  importance = TRUE)

## plot vimp
plot.vimp(covregrf.obj)



[Package CovRegRF version 2.0.1 Index]