Learn R Programming

CovRegRF (version 2.0.1)

vimp.covregrf: Variable importance for covregrf objects

Description

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

Usage

# S3 method for covregrf
vimp(object, ...)

Value

An object of class (covregrf, vimp) which is a list with the following component:

importance

Variable importance measures (VIMP) for covariates.

Arguments

object

An object of class (covregrf, grow).

...

Optional arguments to be passed to other methods.

See Also

plot.vimp.covregrf

Examples

Run this code
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)

## get the variable importance measures
vimp <- covregrf.obj$importance
vimp2 <- vimp(covregrf.obj)$importance


Run the code above in your browser using DataLab