# Random Forest's probability is biased because of data dredging?

I have two related questions:

# Question 1:

In the wikipedia definition of data dredging:

Data dredging (also data fishing, data snooping, and p-hacking) is the use of data mining to uncover patterns in data that can be presented as statistically significant, without first devising a specific hypothesis as to the underlying causality.

The process of data mining involves automatically testing huge numbers of hypotheses about a single data set by exhaustively searching for combinations of variables that might show a correlation.

I'm thinking of Random Forest when reading this definition. Although there is no hypothesis testing nor use of p-value, ... But does the predicted probability calculated by Random Forest make sense when it involve the using of data mining to find a patterns in data that can be significant in some extent?

IMHO: the predicted probability calculated by each single tree of RF is highly biased (because of data dredging), then RF tries to correct this bias by

1. adding randomness to the model (variable selected at each nodes, bootstrapped training data sets)
2. averaging the predicted probability of many trees.

But can this correct all the bias made by every single tree? If the correction of the predicted probability by this technique works? Can the same idea be applied to stepwise regression to correct its weakness cited here by @gung and @FrankHarrell?

This question is applied for other data mining methods as well.

# Question 2:

If the predicted probability of Random Forest is considered "valid": when facing the imbalanced data, one way to improve the performance of RF is to use downsampling technique on the training data set before making trees (resampling the data in such a way that the positive and negative class are "balanced" in proportion). By doing this, the probability calculated is biased, because when the data is resampled, the proportion of positive/ negative observations (predicted probability) changes in each group due to resampling. To "correct" this biased probability, I imagine that one can not simply multiply the predicted probability by the prior downsampling ratio because even though the prior distribution is uniformly resampled, after the using of data mining to find the patterns in data (RF), the posterior distribution goes in different directions than the prior resampling ratio. Thus the multiplication of the posterior probability by the prior resampling ratio isn't valid anymore.

The question is: when using resampling technique, how to correct the predicted probability in Random Forest?

Don't hesitate to modify my question if it's not clear.

1. As you note, your definition of data-dredging implicitly excludes RF there's no significance testing taking place during the RF model construction.

Your implicit question here, especially in the second paragraph, is whether RF is "trustworthy" in some sense. Fortunately, we have several reasons to believe that they are. A regular old vanilla decision tree is constructed as a forward-wise greedy algorithm that looks for the best split at every node. This is very unstable because the greedy nature of it means that a slight perturbation of the data could cause a dramatically different tree to be built: measurement noise or the exclusion of a small number of data points can entirely change the tree. In that sense, it is a high-variance estimator. On the other hand, the RF algorithm is explicitly designed to counter both of these in three ways (1) bootstrapping the sample (2) randomly subsetting features for each split and (3) averaging over many trees.

This, of course, is all theoretical. As a practical matter, we can approximate how well a RF model is doing by making the standard out-of-sample measurements you make for any other model.

To your specific claims, though, note that the "data dredging" definition doesn't mention "bias" at all. It doesn't even state that the relationships uncovered are invalid. It just says that data dredging is characterized by not forming a hypothesis formed ahead of time. I would say that by fitting the RF model, you've implicitly specified that you think the features you've presented have some bearing on the outcome, and that the relationship might be well-approximated by several decision trees (vice the relationship being linear as in a regression model). The RF hypothesis is much more flexible than in the linear regression context (the linear regression model has the hypothesis that the response is a multilinear function of the features), and I think that's more or less the source of your concern.

I might also point out that by using this specific definition of data-dredging, you've implicitly adopted the conventions of significance testing and p-values as being an important part of the enterprise. By contrast, in my work, which has involved a considerable number of RF models, doesn't care about significance testing (at least in the sense of regression coefficients).

It's difficult for me to directly address your claim that RF is "biased" because I don't think you mean statistical bias -- I think you mean that RF is untrustworthy because it engages in data dredging, but in a way that I can't quantify. Maybe you could sharpen your language here? I don't think that RF engages in data dredging, so I don't think that RF is untrustworthy for that reason. (I don't grant your premise.)

2. The question here is one of model calibration. You've outlined the problem of the RF predicted probabilities not matching the true probability of the event in some reference population which is external to your training data. The simplest way to correct this would be to collect samples from whatever reference population you desire (and disjoint from your training data) and construct a logistic regression model which takes the RF output as the independent variable. Under specific conditions which are outlined extensively elsewhere, logistic regression yields calibrated probability estimates of the outcome.

• In the second answer, when using TF output as a independent variable, do you think that there will be a problem of multicolinearity between RF output and other IVs? (in both contexts: inference and prediction)?. Otherwise, excelent answer, and thanks for understanding my implicit question. Aug 18 '16 at 7:58
• RF output is the only IV.
– Sycorax
Aug 18 '16 at 13:01