[R] mice - undefined columns selected

Buuren, S. (Stef) van stef.vanbuuren at tno.nl
Fri Sep 12 16:24:23 CEST 2014


Dear David, mice eliminates variables that are linearly dependent. Type 
> imp$log
To see which are removed, and why.

 You have three options:
1 forget about those remove variables since they don't carry additional information
2 don't use them as predictors, and they will be imputed (although not preserving linear relations)
3 use passive imputation to impute them

I cannot see which one is best for you, but you have a choice.

Hope this helps. Stef.

Verstuurd vanaf mijn iPad

> Op 12 sep. 2014 om 16:18 heeft "David L Carlson" <dcarlson at tamu.edu> het volgende geschreven:
> 
> I'm copying the package maintainer who can probably give a more definite answer. I'm getting the same error on your data. I can get a subset of your data to run, eg:
> 
> d.imp <- mice(d[,c(1:2, 5:6)]) works, but
> d.imp <- mice(d[,c(3:4, 7:8)]) fails. 
> 
> That suggests to me that the problem is with your data. There are some very high correlations between variables. Looking at pairwise complete observations, C1 has correlations of .998, .999, and .998 with C2, C3, and C4 while M1 has correlations of .999, .999, and .999 with M2, M3, and M4. The correlations between the C variables and the M variables are also high (consistently greater than .80). You really have only two variables C and M. This is probably the reason function mice() is failing, but the error message could be more informative. Since you are only imputing single values, you might be better off with simpler imputation methods. Package VIM has a number of options of which nearest neighbor and hot deck might work well with your data.
> 
> -------------------------------------
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77840-4352
> 
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Jeremy Miles
> Sent: Thursday, September 11, 2014 7:49 PM
> To: r-help
> Subject: [R] mice - undefined columns selected
> 
> I've got a problem with the mice package that I don't understand.
> 
> Here's the code:
> library(mice)
> d <- read.csv("https://dl.dropboxusercontent.com/u/24381951/employment.csv",
> as.is=TRUE, row.names=1)d.imp <- mice(data=d, m=1)
> 
> Result is:
> Error in `[.data.frame`(data, , jj) : undefined columns selected
> 
> I hope I'm doing something foolish,
> 
> thanks,
> 
> Jeremy
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt u verzocht dat aan de afzender te melden en het bericht te verwijderen. TNO aanvaardt geen aansprakelijkheid voor de inhoud van deze e-mail, de wijze waarop u deze gebruikt en voor schade, van welke aard ook, die verband houdt met risico's verbonden aan het elektronisch verzenden van berichten.

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.



More information about the R-help mailing list