# Interpreting regression inference trees

I am working with the ctree function that is implemented in R in the party and partykit packages, and I have a question about working with the output. Here is an elementary example:

x <- ctree(mpg~.,mtcars)
plot(x)


If I understand correctly, the function uses its recursive algorithm to generate the splits, and then fits a regression for the distribution at each terminal node. A predicted value is generated by finding the the terminal node associated with the input, and then finding the predicted value from that regression.

Am I correct in assuming the algorithm generates a separate regression for each terminal node? So for example, predicting the value for a car with wt>2.32 would simply mean using the regression associated with the distribution in node 2. Similarly, for a car with wt<2.32 and disp<258 would use the regression from Node 4.

The plot gives me the distribution at each terminal node, but is it possible to extract the actual regression coefficients associated with a terminal node or am I misunderstanding how ctree works?

Kind Regards

If you want to fit a tree with regression models in each node, consider using lmtree or glmtree from the partykit package (based on the mob algorithm).
• +1 Thanks for answering this one, Achim. You'd certainly be best placed to know (since you're a coauthor on the package), but this suggests that the index page for the documentation of party may be misleading for newcomers. It says: "The core of the package is ctree(), an implementation of conditional inference trees which embed tree-structured regression models into..." . It would hardly be a surprise if people interpreted that as doing regression at each node; indeed "embed" sees to suggest it. Nov 19, 2015 at 22:55
• Hmmm, ctree is still a regression tree (like rpart is), it just has a simple intercept-only model in each node. So the quote seems to fit and we didn't have many of such questions so far. But I'll have a look at whether we can improve the docs further. Nov 19, 2015 at 23:37