I'm using the function
randomForest in R's
randomForest package to do a regression. However, when I'm trying to include an interaction term in the following codes:
library(MASS) library(randomForest) Boston_f <- within(Boston, factor(rad)) mdl <- randomForest(lstat ~ rad * . , data = Boston_f)
mdl$term does include interaction, but if I peek into the trees that
mdl is using,
getTree(mdl, 1, T)
I cannot find any split variable using interaction term.
Does anyone know how to include interaction term using
randomForest or other function?