I'm using Random Forests to determine the importance of numerous environmental predictor variables for predicting forest structural variables. One of the response variables only contains 5 unique values, and so this warning message is produced:

Warning messages:
1: In randomForest.default(m, y, ...) :
The response has five or fewer unique values.  Are you sure you want to do 

My data is legitimate regression data, so can I ignore this warning? Is it still ok to perform regression when there are limited response values?

  • $\begingroup$ Minimal requirement is that the values are on an interval scale (taking average has to make sense to evaluate the squared loss criterion in the splits) $\endgroup$
    – Michael M
    Apr 11 '18 at 6:51

You can still do it, it's a warning not an error. However, you might be looking for classification. People generally have more than 5 unique values when it comes to regression.

  • $\begingroup$ The variable is 'density of oldgrowth trees'. There are only ever up to 5 trees in a site, and many sites have none. I think this still needs to be a regression. $\endgroup$
    – LvG
    Apr 11 '18 at 6:55
  • $\begingroup$ @LvG I'll leave it up to you it's a regression or not. But it sounds like 4.56 doesn't make sense. If this is the case, regression is not appropriate. You'll need to think and make a decision. I don't understand what density we have here. $\endgroup$
    – SmallChess
    Apr 11 '18 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.