Decision tree completely different from rpart and party
I want to compare CART and CHAID algorithm, I choose rpart (basket algorithm) and party (chaid algorithm) to see the difference between them. My data is about blood pressure:
The batch function returns me:
library(party)
# par <- ctree_control(minsplit=20, minbucket=10)
arbre <- ctree(bpress_level ~ ., data = df)
arbre
plot(arbre)
The rpart package returns to me:
library(rpart)
fit <- rpart(bpress_level ~ .,
method="class", data=df)
printcp(fit) # display the results
plotcp(fit)
plot(fit, uniform=TRUE,
main="Classification Tree for pressure level")
text(fit, use.n=TRUE, all=TRUE, cex=.8)
I don't understand why the decisin tree is so different, is this normal? Why, for the party package, the algorithm ignores like smoke, stress, gender .... Thanks in advance.
source to share
First of all, ctree ([party]) does not use the CHAID algorithm. It is very similar to CHAID, but not CHAID. CHAID can only be applied when the data is categorical in nature.
Of course, there are many other recursive partitioning algorithms that are more or less similar to CHAIDs that can handle mixed data types. For example, CTree (Conditional Inference Trees) is also based on significance tests and is available in ctree () in the partykit package.
source to share