[R] mice library / survival analysis

John Fox jfox at mcmaster.ca
Wed Mar 1 14:39:39 CET 2006


Dear Brian,

The mice() function returns an object of class mids that contains
information for constructing the multiply-imputed data sets; you can extract
these data sets using complete(). The general idea is then to perform your
analysis in parallel on the completed data sets. Take a look at how, e.g.,
lm.mids() does this. The key lines are 

    analyses <- as.list(1:data$m)
    for (i in 1:data$m) {
        data.i <- complete(data, i)
        analyses[[i]] <- lm(formula, data = data.i, ...)
    }

Simply substitute the analysis that you wish to perform for the call to
lm(). You could do this directly in commands, or, better, by writing a small
function similar to lm.mids(). In either case, the class of the variable
"analyses" (which would be returned by your function) should be set to
"mira".

If the Cox regression model objects that you produce have methods for coef()
and vcov(), then you can proceed with the tools in mice. Use the pool()
function to combine information from the imputed data sets, producing an
object of class mipo. There are summary() and print() methods for mipo
objects.

If your Cox-regression objects don't have methods for coef() and vcov(),
then you could write such methods, create the mipo object yourself, or, as
you suggest, use mitools. The simplest approach would probably be the first.

I hope this helps,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
-------------------------------- 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Brian Perron
> Sent: Tuesday, February 28, 2006 10:00 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] mice library / survival analysis
> 
> Hello folks,
> 
> I am a relatively new user of R and created multiply imputed 
> data sets with the 'mice' library.  This library provides two 
> functions for complete-data analysis on multiply imputed data 
> set objects (lm.mids and glm.mids).  I am trying to estimate 
> a series of Cox PH regression models and cannot figure out 
> the best way to do this.  Is it possible with the mitools 
> library?  If so, it would be great if somebody could forward 
> me some code or provide a simple example of this?  Any 
> comments or suggestions would be appreciated. 
> 
> Regards,
> Brian
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list