0

Here's a small sample of my data :

> sample_n(k,20)
         A        B         C         D       E
1      1.05     2.02       8.27     0.76    1.02
2       1.2     2.28      19.56     0.62    <NA>
3       1.2     2.31       3.45     0.65    1.22
4      <NA>     2.44       6.76     0.68    1.82
5      <NA>     2.24       6.99     0.59    1.37
6      0.87     1.71       3.32     0.64    1.87
7      <NA>     1.77        3.4      0.6    2.13
8      <NA>     2.17       4.13     0.81    1.19
9      <NA>     1.96       4.39     <NA>    1.66
10     1.15     2.28      14.73     0.73    1.57
11     <NA>     1.76       <NA>     0.79    2.66
12     <NA>     1.97          9     0.81    1.38
13     <NA>     2.18       9.32     0.78     0.9
14     <NA>     1.93        2.3     0.78    1.62
15     1.02     2.05       2.81     0.78    1.24
16     0.94     1.77       1.69     0.73    1.83
17     1.17     2.21      14.79     0.66    1.34
18     1.11     2.18       9.41     <NA>    1.32
19     1.35     2.51      20.44     0.76    0.73
20     <NA>     2.37       <NA>     0.74    1.41

I'm trying to impute the missing data using the package mice :

new_df = mice(df, method="cart")

I get the following error :

Error in edit.setup(data, setup, ...) : 
  `mice` detected constant and/or collinear variables. No predictors were left after their removal.

How can I fix this?

Akram H
  • 33
  • 4

0 Answers0