VarImp: VarImp Objects

Description Usage Arguments Details See Also Examples

Description

A class for random forest variable importance measures VarImp objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
as.VarImp(object, ...)

## S3 method for class 'data.frame'
## S3 method for class 'data.frame'
as.VarImp(object, FUN = mean,
             type = c("Permutation", "Conditional Permutation", 
                      "Selection Frequency", "See Info"), 
             info = NULL, ...)

## S3 method for class 'matrix'
## S3 method for class 'matrix'
as.VarImp(object, FUN = mean,
             type = c("Permutation", "Conditional Permutation", 
                      "Selection Frequency", "See Info"), 
             info = NULL, ...)
              
## S3 method for class 'numeric'
## S3 method for class 'numeric'
as.VarImp(object, perTree = NULL, 
              type = c("Permutation", "Conditional Permutation", 
                       "Selection Frequency", "See Info"), 
              info = NULL, ...)
              
is.VarImp(VarImp)

Arguments

object

an R object.

perTree

a matrix or data frame of size ntree x p containing the variable importance measures for each tree in the random forest.

type

a character indicating the type of variable importance measure.

info

a list with additional information about the variable importance measure.

FUN

a function to compute the variable importance. See section 'Details'.

VarImp

an object of the class VarImp.

...

additional arguments.

Details

as.VarImp creates an object of class 'VarImp'. When object is a matrix or a data.frame, the final values are computed by applying FUN to its columns. is.VarImp returns a logical indicating whether the evaluated object is of class 'VarImp'.

See Also

VarImp-methods

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  ## Matrix of fake importance measures per Tree  
  set.seed(290875)
  ntree <- 500
  p <- 15
  fakeVIM <- matrix(rnorm(ntree * p), nrow = ntree, ncol = p,
                    dimnames = list(paste0("pred", seq_len(ntree)), paste0("pred", seq_len(p))))
  is.VarImp(fakeVIM)
  
  ## make a 'VarImp' object
  fakeVarImp <- as.VarImp(fakeVIM, type = "See Info", 
                    info = list("The Vims are based on fake data.", 
                    "The mean was used to aggregate across the trees")) 
  is.VarImp(fakeVarImp)

permimp documentation built on Sept. 14, 2021, 1:07 a.m.