1
$\begingroup$

I am attempting to create a conditional inference tree using the R-package ctree for a dataset. Unfortunately, the sample size is small and the effects are weak. As the analysis is discovery-driven, we are rather liberal with the significance level and are not doing a Bonferroni correction within ctree. However, this approach increases the risk of false positives.

I would like to know whether it would make sense to perform forward selection/prefiltering of predictors before creating the final ctree model. Is this a valid approach or are there other methods to obtain a robust decision tree? maybe you also know some papers where they tried similar strategies.

example R code:

# Load packages and data
library(partykit)
library(mlbench)
data("BostonHousing2")

# Set random seed for reproducibility
set.seed(123)

# Create a subset of samples and predictors for speed reasons
pred_df <- BostonHousing2[1:200, !(colnames(BostonHousing2) %in% c("town", "chas", "cmedv"))]

# Build cforest model and get variable importance
cforest_model <- cforest(medv ~ ., data = pred_df, ntree = 50)
predictor_varimp <- varimp(cforest_model, conditional = TRUE)

# Check variable importance and set an arbitrary threshold (will be decided otherwise)
dotchart(sort(predictor_varimp))
abline(v = 1, col = 'red')
sig_predictors <- names(predictor_varimp[predictor_varimp > 1])

# Create ctree with only important predictors
current_ctree_control <- ctree_control(testtype = "Univariate", minbucket = 20, alpha = 0.05)
ctree_model_varimp <- ctree(medv ~ ., data = pred_df[, c('medv', sig_predictors)], control = current_ctree_control)
plot(ctree_model_varimp)

# Create ctree with all predictors
ctree_model <- ctree(medv ~ ., data = pred_df, control = current_ctree_control)
plot(ctree_model)
$\endgroup$

1 Answer 1

0
$\begingroup$

It is possible to do use an approach like the one you outline but I don't think it is particularly appealing. The interpretation of the resulting tree would be rather unclear.

If your data set is rather small anyway and you want to find a small robust tree capturing its structure, I would recommend attempting to find a "globally optimal" tree (rather than using the locally optimal forward search). One way to do this in R is to use the evtree package by Grubinger et al. (2014, JSS). Using a sufficiently large number of trees (ntrees) should give you a stable and robust result on a small data set.

Alternatively, if you are really after using a forest and understanding its structure, you might try the C443 package by Sies & Van Mechelen (2020, JoC).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.