0

I'm using the party package in R to build a decision tree that has gender as one of my variables (1 for male, 2 for female, 99 for unknown) and my tree output only shows one node (basically not splitting into female or male). Below is the code that I'm using. I want to be able to see if my target variable (income) varies by gender.

library(party)
tree <- ctree(Mean_Incomef~Gender, data = mdftrain,controls = ctree_control(mincriterion=0.95,minsplit=20))
tree
plot(tree)
ChesuCR
  • 9,352
  • 5
  • 51
  • 114
Maria
  • 1
  • 1
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Mar 30 '18 at 16:20
  • Possibly, in your data, there is no significant difference in income based on gender. Try `aggregate(Mean_Incomef~Gender, data=mdftrain, FUN=mean)` – G5W Mar 30 '18 at 17:08

0 Answers0