[R] Multiple Reponse CART Analysis
Bardwell, Jeff H
Jeff_Bardwell at baylor.edu
Mon Dec 10 21:17:38 CET 2007
Dear R friends-
I'm attempting to generate a regression tree with one gradient predictor and multiple responses, trying to test if change in size (turtle.data$Clength) acts as a single predictor of ten multiple diet taxa abundances (prey.data) Neither rpart or mvpart seem to allow me to do multiple responses. (Or if they can, I'm not using the functions properly.)
> turtle.rtree<-rpart(prey.data~., data=turtle.data$Clength, method="anova", maxsurrogate=0, minsplit=8, minbucket=4, xval=10); plot(turtle.rtree); text(turtle.rtree)
Error in terms.formula(formula, data = data) :
'.' in formula and no 'data' argument
When I switch response for predictor, it works. But this is the opposite of what I wanted to test and gives me splits at abundance values, not carapace length values.
> turtle.rtree<-rpart(turtle.data$Clength~., data=prey.data, method="anova", maxsurrogate=0, minsplit=8, minbucket=4, xval=10); plot(turtle.rtree); text(turtle.rtree)
I've heard polymars recommended for this sort of situation. I've downloaded the polyspline library, but get bogged down in the equation. Also, it doesn't seem like polymars will generate a tree even if I do get it working. Can rpart be modified in some way to accomodate multiple response parameters? If anyone's ever come across this situation before, pointers would be much appreciated. Thanks.
Jeff H Bardwell, M.S.
ENV 1101 Lab Coordinator
Goebel 115, OH: Thu 1pm-4pm
710-6596 (e-mail preferred)
More information about the R-help