# classification tree with R part

I am trying to grow a classification tree with a few continuous explanatory variables and a few factor variable.

It seems the Rpart alogrithm is ignoring the factor variables. The differences are significant among the different factor levels,but there is no node associated with any of the factor variables. To make sure that it was not feature of the data set in ran the following simulation.

There was one continuous variable -Income which was random normal with mean 0 and sd 0.25. The other variable was a sector variable that was either U or R with probability 0.5.

Finally the probability of Yes was defined as

If Sector==U, then pr<-1/(1+exp(-income+1.0) If Sector==R,then pr<-1/(1+exp(-income*2 +1.5)

Hence i should expect that classification tree picks out effect of sector. But what i am getting is a lot of splits on income. Is it a general problem?

• Try setting the cp parameter to a smaller value. – Hong Ooi Jul 16 '15 at 15:17