[R] Calculating mean from wit mice (multiple imputation)

Weidong Gu anopheles123 at gmail.com
Wed Jul 20 14:33:37 CEST 2011


You can try this

mean(sapply(1:n.imp, function(x) complete(imp,x)$y))

Weidong Gu

On Wed, Jul 20, 2011 at 6:05 AM, Sarah <s1327720 at student.rug.nl> wrote:
> Hi all,
> How can I calculate the mean from several imputed data sets with the package
> mice?
> I know you can estimate regression parameters with, for example, lm and
> subsequently pool those parameters to get a point estimate using functions
> included in mice. But if I want to calculate the mean value of a variable
> over my multiple imputed data sets with
> fit <- with(data=imp, expr=mean(y)) and
> pool(fit),
> I get the warning:
> Error in pool(fit) : Object has no coef() method.
> Does anyone know what is happening, and is there another way of calculating
> means?
> Thanks.
> --
> View this message in context: http://r.789695.n4.nabble.com/Calculating-mean-from-wit-mice-multiple-imputation-tp3680347p3680347.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
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list