On 12/06/2011 03:05 PM, Antonio Punzon Merino wrote:
I would like know the way to calculate the variance explained of a regression tree. I use the function "ctree" from library "party"
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) -- Patrick Breheny Assistant Professor Department of Biostatistics Department of Statistics University of Kentucky ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.