3

I'd like to achieve picture like this, enter image description here

The following is what I have now: enter image description here

How can I modify the code to acquire the picture? I mean,how to remove the $err and $distribution in terminal nodes? I have read the Rdocumentation for party-plot but in vain. Thanks in advance.

library(openxlsx)
library('partykit')
data<- read.xlsx("2005.XLSX", sheet = 1)
tree<-ctree(inc_total~.,data=data,control = ctree_control(maxdepth = 5))
plot(tree,type='simple',inner_panel=node_inner(tree,id=FALSE),
     terminal_panel = node_terminal(tree,digits=1,id=FALSE,fill=c('white','white'),width = 14,gp=gpar(fontsize=5)))
mean((data$inc_total-predict(tree))^2)
KoenV
  • 4,113
  • 2
  • 23
  • 38
  • You can use the `FUN` argument of the terminal panel function to customize the text that is shown. See https://stackoverflow.com/questions/48322213/plot-ctree-using-rpart-plot-functionality/48340513#48340513 for a worked and reproducible example. – Achim Zeileis Mar 20 '19 at 09:24
  • @AchimZeileis Thank you.I succeed in modifyting the terminal panel. I'm sorry but I have a small question ,the left edges shown in my picture is & but I want $\leq$ ,is it a bug? – Patrick Star Mar 22 '19 at 01:06
  • If you provide a minimal reproducible example, I can have a look. – Achim Zeileis Mar 22 '19 at 07:26

0 Answers0