I am trying to make a regression tree in R using a combination of numeric variables and discrete variables (e.g. color). Even though I pass all the variables I want to use into the 'tree' function, only some of the variables are included in the tree (only xx and yy).

Are there any ways to make R include all my variables in the tree?

tree.logprice = tree(dtrain$logprice ~ logcarat + cut + color + clarity + depth + table + xx + yy + zz, data = dtrain)

plot(tree.logprice)
text(tree.logprice)

0 Answers