Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7902981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:38:35+00:00 2026-06-03T09:38:35+00:00

I am using the randomForest package in R (R version 2.13.1, randomForest version 4.6-2)

  • 0

I am using the randomForest package in R (R version 2.13.1, randomForest version 4.6-2) for regression and noticed a significant bias in my results: the prediction error is dependent on the value of the response variable. High values are under predicted and low values are over predicted. At first I suspected this was a consequence of my data but the following simple example shows that this is inherent to the random forest algorithm:

n = 50; 
x1 = seq(1,n) 
x2 = matrix(1, n, 1)
predictors = data.frame(x1=x1, x2=x2)
response = x2 + x1
rf = randomForest(x=predictors, y=response)
plot(x1, response)
lines(x1, predict(rf, predictors), col="red")

No doubt tree methods have their limitations when it comes to linearity but even the simplest regression tree, e.g. tree() in R, does not exhibit this bias. I can’t imagine that the community would be unaware of this but haven’t found any mention, how is it generally corrected for? Thanks for any comments

EDIT: The example for this question is flawed, please see “RandomForest for regression in R – response distribution dependent bias” at stack exchange for an improved treatment https://stats.stackexchange.com/questions/28732/randomforest-for-regression-in-r-response-distribution-dependent-bias

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:38:36+00:00Added an answer on June 3, 2026 at 9:38 am

    What you’ve discovered isn’t an inherent bias in random forests, but simply a failure to properly adjust the tuning parameters on the model.

    Using your example data:

    rf = randomForest(x=predictors, y=response,mtry = 2,nodesize = 1)
    plot(x1, response)
    lines(x1, predict(rf, predictors), col="red")
    

    enter image description here

    For your real data the improvement will be unlikely to be so stark, of course, and I’d bet you’ll get more mileage out of nodesize than mtry (mtry did most of the work here).

    The reason that regular trees didn’t exhibit this “bias” is because they, by default, search over all variables for the best split.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using R's randomForest package. Is there a way for me to figure out
I'm trying to work around the randomForest package limit of 32 levels for factors.
Using this code, the following execution yields strange results: C 100 R W The
Using php's DOMDocument->LoadHTMLFile('test.html'); keeps on returning an error to me, reporting for an error
Does anyone know what the mechanism is that the R randomForest package uses to
Using online interfaces to a version control system is a nice way to have
Using LINQ on collections, what is the difference between the following lines of code?
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using Nunit, I want to be able to write a test fixture that will
Using a restful resource in Rails, I would like to be able to insert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.