[R] computationally singular error with mice()

Joshua Wiley jwiley.psych at gmail.com
Sat Nov 26 08:41:03 CET 2011


Hi Fei,

On Fri, Nov 25, 2011 at 7:20 PM, Fei <fayechen0807 at hotmail.com> wrote:
>> imp<-mice(mydataframe, seed=1)
> When trying the above command, I got the error term:
>
>  iter imp variable
>  1   1  medu
> Error in solve.default(xtx + diag(pen)) :
>  system is computationally singular: reciprocal condition number =
> 1.16487e-025/
>
> What does that mean? How can I address this issue? My dataframe has 257
> observations for 99 variables. Could this be the origin of the problem?

Yes, your data is likely the origin  of the problem.

> Could anyone helps me out? Thank you!

Please see below---you really need to provide a reproducible example.
Right now, I can only suggest that something with variable medu (or
its relation in some model) appears to be problematic.  If you give us
a reproducible example, we can help you come up with ways around it.

This is purely speculation, but often when I see people simple use an
entire data set in MI, it is a sign they do not really know what they
are doing.  This is risky because a bad imputation model can be worse
than not doing it at all.  Have you carefully examined all 99
variables in the dataset?  Have you considered the class of each?  Do
you know what the different models available for imputation are and
have you considered whether or not you want to simply use the defaults
for all 99 variables?  It is possible to specify a different model
and method for each variable.  If you are imputing 99 variables, you
also should really be checking the results for all 99.  An excellent
book on missing data in general is Statistical Analysis with Missing
Data by Little and Rubin (2002).  It is not the easiest read ever, but
it has very useful information.  If you do not have experience and do
not have interest/time to read and learn about MI, I would strongly
urge you to seek the advice of a local statistician, as I said, bad
imputation can be worse than no imputation.  If you do know what you
are doing and carefully selected those 99 variables from a larger
dataset, checked them, etc. please ignore this paragraph with my
apologies.

Sincerely,

Josh

>
> Fei
>
> --
> View this message in context: http://r.789695.n4.nabble.com/computationally-singular-error-with-mice-tp4109583p4109583.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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

^^^^^^^^^^^^^^^^^^^^^ !!!!!this is important!!!!
> and provide commented, minimal, self-contained, reproducible code.
 this too!!! particularly the "reproducible code" part
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/



More information about the R-help mailing list