yaiVarImp: Reports or plots importance scores for yai method...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/yaiVarImp.R

Description

When method randomforest is used to build a yai object, the randomForest package computes variable importance scores. This function computes a composite of the scores and scales them using scale. By default the scores are plotted and scores themselves are invisibly returned. For classification, the scores are derived from "MeanDecreaseAccuracy" and for regression they are based in " using importance.

Usage

1
yaiVarImp(object, nTop=20, plot=TRUE, ...)

Arguments

object

an object of class yai

nTop

the nTop most important variables are plotted (returned); if NA or zero, all are returned

plot

if FALSE, no plotting is done, but the scores are returned.

...

passed to the boxplot function.

Value

A data frame with the rows corresponding to the randomForest built for each Y-variable and the columns corresponding to the nTop most important Y-variables in sorted order.

Author(s)

Nicholas L. Crookston ncrookston.fs@gmail.com

See Also

yai, yaiRFsummary, compare.yai

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (require(randomForest))
{
  data(MoscowMtStJoe)

  # get the basal area by species columns
  yba  <- MoscowMtStJoe[,1:17]
  ybaB <- whatsMax(yba,nbig=7)  # see help on whatsMax
  
  ba <- cbind(ybaB,TotalBA=MoscowMtStJoe[,18])
  x <- MoscowMtStJoe[,37:64]
  x <- x[,-(4:5)]
  rf <- yai(x=x,y=ba,method="randomForest")
  
  yaiVarImp(rf)
  
  keep=colnames(yaiVarImp(rf,plot=FALSE,nTop=9))
  
  newx <- x[,keep]
  rf2 <- yai(x=newx,y=ba,method="randomForest")
  
  yaiVarImp(rf2,col="gray")
  
  compare.yai(rf,rf2)
}

yaImpute documentation built on July 1, 2020, 3 a.m.

Related to yaiVarImp in yaImpute...