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)
3
  • You can use the FUN argument of the terminal panel function to customize the text that is shown. See stackoverflow.com/questions/48322213/… for a worked and reproducible example. Commented Mar 20, 2019 at 9: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? Commented Mar 22, 2019 at 1:06
  • If you provide a minimal reproducible example, I can have a look. Commented Mar 22, 2019 at 7:26

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.