I am using the lmtree function from the partykit package and I am looking for a function similar to the path.rpart function, ie, a function which gives in a list the splits on the path from the root to the selected node.
It would like something similar to this :
set.seed(1)
library(rpart)
x=runif(100);z=runif(100);y=jitter(ifelse(z>.5,2*x,3*x+2),amount=.1);
rp=rpart(x~y)
path.rpart(rp,5)
#node number: 5
#root
#y< 0.8785
#y>=0.4081
with lmtree :
library(partykit)
tr=lmtree(x~y|z)
#and here I need a function similar to path.rpart
I checked the node_party and get_paths functions but it is not what I need. Does any one have suggestions for extracting this info from the lmtree object ? Many thanks for your help.