3
$\begingroup$

I'm trying to understand how correlated (multicollinear) predictors affect predictive power and / or variable importance in tree models, e.g. Random Forest models. Particularly, I'd like to know if certain practice of creating correlated features in order to avoid removing / imputing missing values is acceptable / encouraged.

Let's assume I have the following data with a subset of missing points:

set.seed(10)
order_id = sample(4000:5000, 10)

set.seed(10)
rating = sample(1:5, 10, replace = TRUE)
rating[c(1,3,5,10)] <-NA

df = data.frame(order_id, rating)

> df
   order_id rating
1      4507     NA
2      4306      2
3      4426     NA
4      4691      4
5      4084     NA
6      4224      2
7      4273      2
8      4270      2
9      4611      4
10     4998     NA

For any kind of modelling I'd need to either remove all the observations that contain missing values or I'd have to impute them in one way or another. However, a third way has been suggested to me, namely, create a dummy variable stating whether the variable of interest was present or not and then replace its missing values with an out-of-range value, e.g. if the rating covers values only between 1-5, the missing values could take a value of 0:

df2 = df %>% 
mutate(rating_present = ifelse(is.na(rating), 0, 1),
       rating2 = ifelse(is.na(rating), 0, rating))


> df2
   order_id rating rating_present rating2
1      4507     NA              0       0
2      4306      2              1       2
3      4426     NA              0       0
4      4691      4              1       4
5      4084     NA              0       0
6      4224      2              1       2
7      4273      2              1       2
8      4270      2              1       2
9      4611      4              1       4
10     4998     NA              0       0

However, this way I'm creating variables that are (purposefully) strongly correlated with each other. Multicollinearity in RF models can result in biased feature selection and / or skewed Variable Importance, thus is this practice recommended?

thanks for your help!

$\endgroup$
3
  • 1
    $\begingroup$ One thing you should realize about variable importance is that it is not measuring anything statistical, i.e. it is not an approximation of some "real world" population feature that is being approximated by your model. Its purely a summary statistic of the fit model. It's best to think of it as "this is how this particular model used my data". From this lens, I don't believe it's possible for it to be "skewed", as there is no ground truth it is attempting to approximate/measure. $\endgroup$ Commented Feb 28, 2017 at 15:36
  • $\begingroup$ It's true, @MatthewDrury, that the variable importance is tightly linked to the model rather than 'the truth', but at the same time, if biased, it can pick predictors and rank them high on the variable importance ladder even though they are unrelated to response variable. See excellent examples and explanation in this article $\endgroup$ Commented Mar 1, 2017 at 11:07
  • $\begingroup$ Thanks for the link Kasia, I'll try to find some time to take a look. $\endgroup$ Commented Mar 1, 2017 at 18:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.