I have a decision tree built in R using rpart() from rpart package. However, when following the nodes, we have one condition leading to both outcomes as GOOD. This is weird for me.

What does that mean? If the customer have AccB < 3.5, then he/she is a good customer. If not, he/she is also a good customer? Shouldn't the condition lead to two opposite outcomes?

This link contains the German Credit data used to plot this tree (Credibility is the dependent variable).

This is the code used: ## split train and test dataset train_index = sample(1:nrow(dados), 0.6*nrow(dados), replace = FALSE);

train = data.frame();
train = dados[train_index,];

test = data.frame();
test = dados[-train_index,];

## Use rpart to run decision tree
train_tree = rpart(Creditability~., data = train);

## plot decision tree
rpart.plot(train_tree, type = 2, yesno=F, fallen.leaves = F, extra = 102, under = T, cex=NULL, uniform=T, varlen=4, gap=0, space=0, tweak=1.2);

This is the tree generated:

Decision Tree


1 Answer 1


I'm not at all familiar with rpart, but in general with decision trees this means that one branch is more confident than the other that the customer is "good". Between the observations that are initially sorted by AccB>3.5 and AccB<3.5, there is a significant difference in the proportion of customers that are "good", but the majority of customers in each branch are still good. This is consistent with the proportions given by the tree!


Your Answer

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

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