Corinne Staley
2010-Mar-16 01:51 UTC
[R] Regarding variable importance in the randomForest package
For anyone who is knowledgeable about the randomForest package in R, I have a question: When I look at the variable importance for data, I see that my response variable is included along with my predictor variables. That is, I am getting a MeanDecreaseGini for my response variable, and therefore it seems as though it is being treated as a predictor variable. my code (just in case it helps) : comm.RF<-randomForest(model.data,y=model.data$Comm_Heir,mtry=8,importance=T) Apologies if it's a stupid question, but I'm new to randomForests. Hopefully that makes sense and if anyone can let me know how remedy this situation, I would be so grateful. Cheers! [[alternative HTML version deleted]]
Liaw, Andy
2010-Mar-16 17:34 UTC
[R] Regarding variable importance in the randomForest package
Seems like you're new to R as well? The first argument should contain only the predictor variables, but you used the entire data frame that contains the response. Andy> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Corinne Staley > Sent: Monday, March 15, 2010 9:52 PM > To: r-help at r-project.org > Subject: [R] Regarding variable importance in the randomForest package > > For anyone who is knowledgeable about the randomForest > package in R, I have > a question: > > When I look at the variable importance for data, I see that > my response > variable is included along with my predictor variables. That is, I am > getting a MeanDecreaseGini for my response variable, and > therefore it seems > as though it is being treated as a predictor variable. > > my code (just in case it helps) : > comm.RF<-randomForest(model.data,y=model.data$Comm_Heir,mtry=8,importance=T)> > Apologies if it's a stupid question, but I'm new to > randomForests. Hopefully > that makes sense and if anyone can let me know how remedy > this situation, I > would be so grateful. > > Cheers! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >Notice: This e-mail message, together with any attachme...{{dropped:10}}