varImp: Returns variable importance

Description Usage Arguments Details Value See Also Examples

View source: R/varImp.R

Description

When RF is used to find nearest neighbors, the importance of each variable in the RF trees is calculated. This function returns the importance of each variable and a ggplot2 object

Usage

1
varImp(model, scaled = TRUE, plot = TRUE, plotType = "boxplot")

Arguments

model

A yai object

scaled

Logical. Should importance values be centered and scaled?

plot

Logical. If TRUE, returns a ggplot2 object based on plotType value

plotType

Either of "boxplot" or "grid"

Details

If scaled = TRUE, importance values are centered by subtracting their mean and scaled by dividing the centered importance by their standard deviation.

Value

A list containing the following objects:

importance

A data.frame object containing the importance of each response variable and the mean importance of all variables combined

plot

A ggplot object showing a plot of the importance values according to plotType

See Also

importance, yaiVarImp

Examples

1
2
3
4
5
# Load data
# kNN_model: trained kNN model (from trainNN)
load(system.file("extdata/examples/example_predictTrgs.RData", package = "foster"))

varImp(kNN_model,scaled=FALSE,plot=TRUE,plotType="boxplot")

mqueinnec/foster documentation built on March 28, 2021, 4:27 p.m.