simongrund1 / mitml

Tools for multiple imputation in multilevel modeling
29 stars 7 forks source link

feature request: mitml.list2mids and mids2mitml #12

Open rubenarslan opened 4 years ago

rubenarslan commented 4 years ago

It would sometimes be helpful to be able to switch back and forth between mitml.list, mitml, and mids objects. mitml.lists are most helpful for post-processing using dplyr, but many more out-of-the-box diagnostics can be used on mitml and mids objects.

simongrund1 commented 4 years ago

That's a great idea. I'll see what I can do about that. Converting "mitml.list" to "mitml" may be difficult, because the "mitml.list" saves only the imputed data, whereas "mitml" includes model information, MCMC samples for model parameters, etc. But I suppose it would make sense to include with and within methods for "mitml" that don't require converting into a list first.

For converting to "mids", you can have a look at mice::as.mids. This function can be used with any list of imputed data sets but also requires the original (incomplete) data. Unfortunately, because mice depends on mitml, I can't write methods for "mitml" or "mitml.list" objects that use as.mids internally, because that would create a depency cycle.

alexanderrobitzsch commented 3 years ago

For converting to "mids", you can have a look at mice::as.mids. This function can be used with any list of imputed data sets but also requires the original (incomplete) data. Unfortunately, because mice depends on mitml, I can't write methods for "mitml" or "mitml.list" objects that use as.mids internally, because that would create a depency cycle.

If needed, I think that one can use requireNamespace("mice") for locally attaching the as.mids function. `The mice package must only appear as "Suggests", not "Imports".