FarhadPishgar / MatchThem

Matching and Weighting Multiply Imputed Datasets
14 stars 2 forks source link

possible to create mids objects from wimids objects? #10

Open go-bayes opened 2 years ago

go-bayes commented 2 years ago

PROBLEM I used weightit to create weights for the exposure in multiply imputed datasets. I'd like to pass these datasets to BRMS, which accepts mids objects but not wimids objects.

QUESTION Is it possible to covert a winmids object into a mids object?

ATTEMPTED SOLUTION When I use MatchThem's complete function, I obtain only one dataset with weights, not the many datasets with weights that I multiply-imputed.

Wonderful package, which fills a critical gap in the R ecosystem. Thank you!

TomArriaza commented 1 year ago

With the MatchThem's complete function, you should specify the argument action, like this:

MatchThem::complete(data, action = "long")

where data is a wimids or a mimids object. Thus, you will get as many dataset as you set in mice's m argument, including the original one, which is pointed out as .imp = 0.

Once you get the dataset, I suppose you can use the as.mids function. Let me know if it works.