permVimp | R Documentation |
A variable selection approach which creates a null model by permuting the response, rebuilding the model, and calculating the inclusion proportion (IP) on the null model. The final result displayed is the original model's IP minus the null IP.
permVimp(model, data, response, numTreesPerm = NULL, plotType = "barplot")
model |
Model created from either the BART, dbarts or bartMachine packages. |
data |
A data frame containing variables in the model. |
response |
The name of the response for the fit. |
numTreesPerm |
The number of trees to be used in the null model. As suggested by Chipman (2009), a small number of trees is recommended (~20) to force important variables to used in the model. If NULL, then the number of trees from the true model is used. |
plotType |
Either a bar plot ('barplot') or a point plot ('point') |
A variable selection plot.
if (requireNamespace("dbarts", quietly = TRUE)) {
# Load the dbarts package to access the bart function
library(dbarts)
# Get Data
df <- na.omit(airquality)
# Create Simple dbarts Model For Regression:
set.seed(1701)
dbartModel <- bart(df[2:6],
df[, 1],
ntree = 5,
keeptrees = TRUE,
nskip = 10,
ndpost = 10
)
# Tree Data
trees_data <- extractTreeData(model = dbartModel, data = df)
permVimp(model = dbartModel, data = df, response = 'Ozone', numTreesPerm = 2, plotType = 'point')
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.