View source: R/importance.varpro.R
| importance | R Documentation |
Calculates variable importance from compatible objects such as varpro
and uvarpro.
importance(x, ...)
## S3 method for class 'varpro'
importance(x, local.std = TRUE, y.external = NULL,
cutoff = 0.79, trim = 0.1, plot.it = FALSE, conf = TRUE, sort = TRUE,
ylab = if (conf) "Importance" else "Standardized Importance",
max.rules.tree, max.tree,
...)
## S3 method for class 'uvarpro'
importance(x, local.std = FALSE, y.external = NULL,
cutoff = 0.79, trim = 0.1, plot.it = FALSE, conf = TRUE, sort = TRUE,
ylab = if (conf) "Importance" else "Standardized Importance",
max.rules.tree, max.tree,
...)
## S3 method for class 'rhf'
importance(x, local.std = TRUE, y.external = NULL,
cutoff = 0.79, trim = 0.1, plot.it = FALSE, conf = TRUE, sort = TRUE,
ylab = if (conf) "Importance" else "Standardized Importance",
max.rules.tree, max.tree,
...)
x |
A |
local.std |
Logical. If |
y.external |
Optional user-supplied response vector. Must match the
expected dimension and outcome family. Ignored for |
cutoff |
Threshold used to highlight significant variables in the
importance plot. Applies only when |
trim |
Windsorization trim value used to robustify the mean and standard deviation calculations. |
plot.it |
Logical. If |
conf |
Logical. If |
sort |
Logical. If |
ylab |
Character string specifying the y-axis label. |
max.rules.tree |
Optional. Maximum number of rules per tree. Defaults to the value stored in the fitted object if unspecified. |
max.tree |
Optional. Maximum number of trees used for rule extraction. Defaults to the value from the fitted object if unspecified. |
... |
Additional arguments passed to internal methods. |
This page documents the public importance() generic together with the
methods for varpro and uvarpro objects.
The supervised varpro method calculates standardized importance values
for identifying and ranking variables. Optionally, graphical output is
provided, including confidence-style boxplots.
Invisibly, a table summarizing the results. Contains mean importance
mean, the standard deviation std, and standardized importance
z.
For classification, conditional z tables are additionally provided,
where the z standardized importance values are conditional on the class
label.
See cv.varpro for a data-driven cross-validation method for
selecting the cutoff value, cutoff, in supervised
varpro analyses.
Min Lu and Hemant Ishwaran
Lu, M. and Ishwaran, H., (2024). Model-independent variable selection via the rule-based variable priority. arXiv e-prints, pp.arXiv-2409.
cv.varpro
varpro
uvarpro
## ------------------------------------------------------------
## toy example - needed to pass CRAN test
## ------------------------------------------------------------
## mtcars regression
o <- varpro(mpg ~ ., mtcars, ntree = 1)
imp <- importance(o, local.std = FALSE)
print(imp)
## ------------------------------------------------------------
## iris example
## ------------------------------------------------------------
## apply varpro to the iris data
o <- varpro(Species ~ ., iris, max.tree = 5)
## print/plot the results
imp <- importance(o, plot.it = TRUE)
print(imp)
## ------------------------------------------------------------
## boston housing: regression
## ------------------------------------------------------------
data(BostonHousing, package = "mlbench")
## call varpro
o <- varpro(medv~., BostonHousing)
## extract importance values
imp <- importance(o)
print(imp)
## plot the results
imp <- importance(o, plot.it = TRUE)
print(imp)
## ------------------------------------------------------------
## illustrates y-external: regression example
## ------------------------------------------------------------
## friedman1 - standard application of varpro
d <- data.frame(mlbench::mlbench.friedman1(250),noise=matrix(runif(250*10,-1,1),250))
o <- varpro(y~.,d)
print(importance(o))
## importance using external rf predictor
print(importance(o,y.external=randomForestSRC::rfsrc(y~.,d)$predicted.oob))
## importance using external lm predictor
print(importance(o,y.external=lm(y~.,d)$fitted))
## importance using external randomized predictor
print(importance(o,y.external=sample(o$y)))
## ------------------------------------------------------------
## illustrates y-external: classification example
## ------------------------------------------------------------
## iris - standard application of varpro
o <- varpro(Species~.,iris)
print(importance(o))
## importance using external rf predictor
print(importance(o,y.external=randomForestSRC::rfsrc(Species~.,iris)$class.oob))
## importance using external randomized predictor
print(importance(o,y.external=sample(o$y)))
## ------------------------------------------------------------
## illustrates y-external: survival
## ------------------------------------------------------------
data(pbc, package = "randomForestSRC")
o <- varpro(Surv(days, status)~., pbc)
print(importance(o))
## importance using external rsf predictor
print(importance(o,y.external=randomForestSRC::rfsrc(Surv(days, status)~., pbc)$predicted.oob))
## importance using external randomized predictor
print(importance(o,y.external=sample(o$y)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.