Skip to content

varaince explined of a regression tree using ctree

2 messages · Antonio Punzon, Patrick Breheny

#
On 12/06/2011 03:05 PM, Antonio Punzon Merino wrote:
ctree does not provide this information by default, but it is not 
difficult to calculate:

X <- matrix(rnorm(100*10),ncol=10)
y <- X%*%c(rep(2,5),rep(0,5))+rnorm(100)
fit <- ctree(y~.,data=as.data.frame(X))
r <- y - predict(fit)
1-var(r)/var(y)