Re: [R] Odd results from rpart classification tree

2017-05-15 Thread Marshall, Jonathan
M., Ph.D. [thern...@mayo.edu] Sent: 16 May 2017 00:43 To: r-help@r-project.org; Marshall, Jonathan Subject: Re: Odd results from rpart classification tree You are mixing up two of the steps in rpart. 1: how to find the best candidate split and 2: evaluation of that split. With the "class&

[R] Odd results from rpart classification tree

2017-05-15 Thread Marshall, Jonathan
The following code produces a tree with only a root. However, clearly the tree with a split at x=0.5 is better. rpart doesn't seem to want to produce it. Running the following produces a tree with only root. y <- c(rep(0,65),rep(1,15),rep(0,20)) x <- c(rep(0,70),rep(1,30)) f <- rpart(y ~ x,