Closed vincentarelbundock closed 1 year ago
Thank you for the kind words :)
I don't know if I love that interface. Basically, it looks like mod
is just a placeholder containing the original function call and dat_mice
is just inserted into the data
argument of the call. I could see how the bootstrapping infrastructure would make that easy. But I don't like that the user has to essentially fit a fake model just to get its call so that it can be extracted by inferences()
. Ideally the user only fits the models that are actually being used to estimate quantities. For example, there may be no complete cases on which to fit the initial model. I also don't like method = "mi"
since "pooling with Rubin's rules" is not a mode of inference, it's a method used on top of other modes (i.e., in theory, you could bootstrap in each imputed dataset and then combine, or you could do simulation inference in each model and combine).
I think an alternative would be to allow the models to accept a list of model fits or a mira
object as an argument, which triggers a multiple imputation process that applies the estimation (i.e., slopes()
, etc.) to each model/dataset and automatically combines the results, or requires a pool()
call at the end that is smarter about how the estimates are combined than it currently is. Really it's only the last step that is holding things back. Letting users supply a list of model fits would just save them from having to use lapply()
.
Thanks for these thoughts. I agree.
marginaleffects
now supports mira
objects, and the dev version of the vignette shows how to transform Amelia
and missRanger
datasets to mira
format:
https://vincentarelbundock.github.io/marginaleffects/dev/articles/multiple_imputation.html
@ngreifer, I was reading your excellent new blog post on missing data, and it made me realize how clunky the workflow is for multiple imputation. I also realized that, by happy accident, it is almost trivial to use the existing
inferences()
infrastructure to make it much easier to pool estimates.I updated the development version of the vignette: https://vincentarelbundock.github.io/marginaleffects/dev/articles/multiple_imputation.html
Here’s a quick example using version 0.9.0.9037: