Learn R Programming

bartMan (version 0.1.1)

localProcedure: localProcedure

Description

A variable selection approach performed by permuting the response.

Usage

localProcedure(
  model,
  data,
  response,
  numRep = 10,
  numTreesRep = NULL,
  alpha = 0.5,
  shift = FALSE
)

Value

A variable selection plot using the local procedure method.

Arguments

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.

numRep

The number of replicates to perform for the BART null model's variable inclusion proportions.

numTreesRep

The number of trees to be used in the replicates. 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.

alpha

The cut-off level for the thresholds.

shift

Whether to shift the inclusion proportion points by the difference in distance between the quantile and the value of the inclusion proportion point.

Examples

Run this code
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)
localProcedure(model = dbartModel,
               data = df,
               numRep = 5,
               numTreesRep = 5,
               alpha = 0.5,
               shift = FALSE)
}


Run the code above in your browser using DataLab