Hi, I'm having trouble retrieving the variable importance from a univariate CART: the importance of variables (got with *varImp(function)*) does not coincide with the hierarchy of the variables in the ploted tree; they are totally different. I'm using *rpart* to construct the tree (also *prune *to simplify it) from the rpart package, and then I'm using *varImp* from the caret package to retrieve variable importance. The command line is this (dataset = fish): library(rpart) library(caret) vars <- fish[,c(2:8)] ## explanatory variables (categorical, read as factors) preys <- fish[,c(9)] ## one numeric response variable labeled Biomass cart <- rpart(Biomass ~ Time + Station + Species + Sex + Sizeclass + Lifestage + Maturity, data = fish, minsplit = 10, cp=0.001) smallcart = prune(cart, cp=0.0210) plot(smallcart, branch = 0.3, uniform=T) ## ploting tree text(smallcart, use.n=FALSE, pretty=TRUE) title(main="RegTree") varImp(smallcart) ##retrieving variable importance The importance of variables does not match the hierarchy in the tree. I could very much use some help. Thanks in advanced. Regards, *Fabio Castagnino Ugolotti* *Turismo sostenible* *Gesti?n de recursos marino costeros* *Buceo libre* Tel. +051-949171412
Univariate CART- problem with Variable Importance
1 message · Fabio Castagnino