If you are using the code, that's not really using randomForest directly. I don't understand the data structure you have (since you did not show anything) so can't really tell you much. In any case, that warning came from randomForest() when it is run in regression mode but the response has fewer than five distinct values. It may be legitimate regression data, and if so you can safely ignore the warning (that's why it's not an error). It's there to catch the cases when people try to do classification with class labels 1, 2, ..., k and forgot to make it a factor.
Best, Andy Liaw -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sean Porter Sent: Thursday, March 20, 2014 3:27 AM To: r-help@r-project.org Subject: [R] randomForest warning: The response has five or fewer unique values. Are you sure you want to do regression? Hello everyone, Im relatively new to R and new to the randomForest package and have scoured the archives for help with no luck. I am trying to perform a regression on a set of predictors and response variables to determine the most important predictors. I have 100 response variables collected from 14 sites and 8 predictor variables from the same 14 sites. I run the code to perform the randomForest regression given by Pitcher et al 2011 ( http://gradientforest.r-forge.r-project.org/biodiversity-survey.pdf ). However, after running the code I get the warning: " In randomForest.default(m, y, ...) : The response has five or fewer unique values. Are you sure you want to do regression?" And it produces a set of 500 regression trees for each of 3 species only when the number of species in the response file is 100. I noticed that in the example by Pitcher they get 500 trees from only 90 species even though they input 110 species in the response data. Why am I getting the warning/how do I solve it, and why is randomForest producing trees for only 3 species when I am looking at 100 species (response variables)? Many thanks Sean [[alternative HTML version deleted]] ______________________________________________ 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. Notice: This e-mail message, together with any attachme...{{dropped:11}} ______________________________________________ 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.