4
$\begingroup$

I am somewhat new to mice but I am trying my best. So I successfully imputed my data and created five datasets.

For the sake of simplicity, let's just use the nhanes dataset that comes with mice

 imp <- mice(nhanes, seed = 23109)

In my paper, I need to show basic descriptives (so for example: mean, standard deviation, skewness, kurtosis etc.). I understand that I can pool the parameters and results of my analysis with Rubin's rules using the following syntax:

fit <- with(imp, lm(chl ~ age + bmi))
print(pool(fit))

Call: pool(object = fit)
Pooled coefficients:
(Intercept) age bmi
-34.158914 34.330666 6.212025
Fraction of information about the coefficients missing due to nonresponse:
(Intercept) age bmi
0.5747265 0.7501284 0.4795427

But how would I go about this to report basic descriptives? Is there a way to combine these and a function in the mice package that does this for me, or do I have to do this manually? So for example I tried:

mean.fit <- with(data=imp, expr=mean(bmi))
pool(mean.fit)

and , I get the warning:

Error in pool(mean.fit) : Object has no coef() method. 

which obviously means that is not how it should be done.

A different (and easier) possibility would be to pick just one of the imputed datasets to showcase (they are all very similar anyway. However, it feels like this wouldn't be a recommended thing to do because the whole upside of using multiple imputation should be that I am not pretending that the imputed values are the real values but that they come with a certain uncertainty.

If anyone could help me, I'd be very happy. Thanks.

$\endgroup$

closed as off-topic by mkt - Reinstate Monica, Michael R. Chernick, Peter Flom - Reinstate Monica Oct 11 at 11:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – mkt - Reinstate Monica, Michael R. Chernick, Peter Flom - Reinstate Monica
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I had this problem a few years ago. I cannot now remember what I did. I don't have time to dig out my archives tonight, but I'll have a look tomorrow. $\endgroup$ – timbp Jul 19 '18 at 9:44
1
$\begingroup$

If your goal is just to complete descriptives with no standard error around the descriptives (i.e., no confidence interval around the sample mean or sample standard deviation), you can use complete() to recover the imputed data sets and then perform actions on them. For example, to compute the average sample mean and variance across the imputations, you might do the following:

imp.data <- complete(imp, "long")
(means <- with(imp.data, tapply(bmi, .imp, mean)))
mean(means)
(variances <- with(imp.data, tapply(bmi, .imp, var)))
mean(variances)

If you want inference, you can manually apply Rubin's rules to the estimates.

$\endgroup$
0
$\begingroup$

Consider using miceadds package if you want to calculate standard deviations etc. See https://www.rdocumentation.org/packages/miceadds/versions/3.5-14/topics/with.miceadds

$\endgroup$

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Not the answer you're looking for? Browse other questions tagged or ask your own question.