amices / mice

Multivariate Imputation by Chained Equations
https://amices.org/mice/
GNU General Public License v2.0
433 stars 107 forks source link

Question: pooling ORM results using imputed data #656

Closed Judithholtjer closed 3 weeks ago

Judithholtjer commented 1 month ago

I wanted to pool results from my ORM function after imputing my data (m=100).

This is what the code looks like;

MT_empty <- with (Trajectories_imp, orm (class ~ BIA_BMI + Age + Gender + Educationlevel)) MT_empty1 <- pool (MT_empty)

the first line works fine, however when I try to pool I get the following error: Error: No tidy method for objects of class orm

I also tried loading broom.mixed before, but that doesn't seem to fix the issue. Any suggestions?

thomvolker commented 1 month ago

Direct pooling requires that the analysis-function, orm() in this case, has an associated broom::tidy()-method to output the parameters in an organized way. To put it differently, if there is no broom::tidy() method associated with the analysis function, mice::pool() does not now which parameters to combine. You can solve this by collecting the parameters that you want to pool from the MT_empty list, with their respective variances, and using mice::pool.scalar(). You can check how this function works using ?mice::pool.scalar, but the function expects Q, a vector with the parameter estimates of a single parameter for all imputed data sets, U, a vector with the estimated variances of the corresponding parameters, n, the size of the sample on which the analysis is performed, and k, the number of parameters in your model. Accordingly, you can run this function for every parameter in your model. Note that these pooling rules assume normality on the parameters of interest.