vimp.covregrf {CovRegRF}R Documentation

Variable importance for covregrf objects

Description

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

Usage

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

Arguments

object

An object of class (covregrf, grow).

...

Optional arguments to be passed to other methods.

Value

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

importance

Variable importance measures (VIMP) for covariates.

See Also

plot.vimp.covregrf

Examples


## 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


[Package CovRegRF version 1.0.1 Index]