1
$\begingroup$

I'd like to use rfImpute to impute missing values in a data frame that looks something like this, but around 30 variables and much longer (~2000-3000 rows):

       v1          v2         v3         v4          v5          v6
1   0.5850206  0.31921076        NaN        NaN  0.29987225  0.78593398
2  -1.6768970 -1.53962788 -1.1870003        NaN  1.49469729         NaN
3   1.5311527  0.09445066  0.1164885        NaN         NaN  0.28354119
4   1.5559625 -0.10918918        NaN        NaN  0.38369215 -0.41637818
5  -1.0249743         NaN        NaN        NaN -0.05524857  0.26641795
6  -2.3648090  0.99893773        NaN        NaN  0.58055626  1.10529182
7  -1.5919507 -0.57658361        NaN 0.67656167 -0.42109975  0.42912082
8         NaN -0.11844412        NaN        NaN         NaN -0.43733267
9   0.2787071         NaN -0.3735646 0.06452707 -0.81838609  1.87627624
10 -1.9781018  3.44577274 -0.7030053        NaN -0.11474630  1.22530745
11 -0.0770487         NaN -1.0041712        NaN         NaN -0.05249782
12 -1.1994178  1.83499092        NaN        NaN  1.31465292 -0.52428257
13 -0.2105764         NaN        NaN        NaN  1.96982224  0.67434544
14 -1.7690616 -0.90380787        NaN 0.21390353  0.01140004         NaN
15  0.3964937         NaN -0.7337263        NaN -0.43564595  1.51972803
16        NaN -0.59568512        NaN        NaN  0.29133021 -0.28695727
17  0.5140967         NaN        NaN        NaN  0.28720247 -0.51477498
18  0.1435378         NaN  0.2705845        NaN         NaN -0.44796345
19        NaN  0.35808317        NaN        NaN  0.95784490  0.45163588
20  0.2429028  0.58598639  0.6809581        NaN         NaN  1.01592032

(this was made using rnorm, so it doesn't look like what I have)

The fraction of missing values in each column are as follows:

  v1   v2   v3   v4   v5   v6 
0.15 0.35 0.60 0.85 0.25 0.10

I was wondering how many missing values are too many to impute a given variable using rfImpute?

I'm not sure how valid the imputation is when there are ~ 3000 observations but some of the variables are missing > 50%, some ~ 90% of values (e.g. only 300 observations for say v10). I was wondering if I should base it off a percentage or a number of observations, or both? E.g., if it's 90% missing but 5000 observations, it's okay to use rfImpute, since there are still 500 obs's.

I'm using RF imputation to calculate variable importance using Random Forest, since I need complete data for that.

$\endgroup$
  • 1
    $\begingroup$ I do not know about Random Forest imputation, but for multiple imputation in general, there is no defined cut-off where imputation techniques fail. More important would be to 'consider the intended use of your model and the missing mechanism' (paraphrased from answers to this Q: stats.stackexchange.com/questions/149140/…). On a related note, more missing will probably result in greater variation across the multiple imputation datasets or less certain replacement values, which could be taken into account in subsequent analyses. $\endgroup$ – IWS Oct 13 '17 at 13:17
  • $\begingroup$ @IWS Thanks, that makes sense. I want to use RF imputation to calculate variable importance in predicting a certain output variable. If I have say only 5 observations for a specific variable (out of 2000 obs's) the variation is going to be very large, but what about when I have 200, for example? Would that be enough to calculate variable importance? I guess it's hard to quantify the amount of variation.. $\endgroup$ – Grint Oct 13 '17 at 13:25
  • $\begingroup$ What I mean, is that the amount or proportion of missing can be properly handled using the appropriate imputation techniques (for example multiple imputation through mice in conjunction with pooling according to Rubin's rules). So when using these techniques (taking into account all assumptions), the proportion of missing can range from 0-99.99% (indicating that theoretically you need only one case with a non-missing value). However, for every imputation you (the user) needs to think whether estimation based on the small number of known values is feasible technically (will the model converge?) $\endgroup$ – IWS Oct 13 '17 at 13:49
  • 1
    $\begingroup$ Also, please note that "calculat[ing] variable importance in predicting a certain output variable" is a tricky task, easy to over-interpret, even with complete data. See the extensive set of threads about feature-selection on this site. Ask yourself: if you only had 5 observations for a specific variable out of 2000 cases, would you really trust an algorithm that deemed it to be an "important" feature? $\endgroup$ – EdM Oct 13 '17 at 14:08

Your Answer

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

Browse other questions tagged or ask your own question.