0

I'm running an imputation in mice and something strange is happening with the complete function.

If I display the results using $imp from my object for a specific variable these are my results:

head(mice.train$imp$ViolentCrimesPerPop)

enter image description here

Now I run:

complete.train<-mice::complete(mice.train,1) 

which should fill in the missing values in my data using the results from the first imputation

but when I check the first index listed in imp for example,

> complete.train$ViolentCrimesPerPop[1349]
[1] 366.34

Its not 113.81 like in my imp table.

user20650
  • 24,654
  • 5
  • 56
  • 91
  • I can't reproduce this using `imp = mice(nhanes, m=5, print=0); head(imp$imp$bmi) ; complete.train <- mice::complete(imp,1) ; complete.train$bmi[4]` . Is it possible that you re-ran the imputation, but the complete data is from an earlier run? Try in a fresh r session? If not, can you add some data to your question that allows this to be replicated please. Thanks – user20650 Jun 09 '18 at 14:16

1 Answers1

0

I figured out my problem- because I sampled for the training data from my original dataset the rownames were all out of order . So those row numbers in that table aren't actually the row numbers.. Thanks!