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