1
$\begingroup$

9I have a dataset (500 rows) with missing values in different variables for a propensity score analysis. First I created the propensity score matching by omitting the rows with missing values (about 100 rows) in the variables I used for propensity score calculation, but now I would like to try to impute the missing values with the mice package.

In a first step I imputed the data like this:

impute <- mice(mydata, method = 
  methods, predictorMatrix = 
  predictormatrix, m = 5, maxit = 
   3)
mydata <- complete(impute)

So - as far as I understand - "mydata" now is a new data frame with the imputed values, but it is the first out of 5 different attempts of imputation (because the first attempt is used by default).

Now, as "mydata" is a data frame, I have my "full" data available and can continue with my propensity score matching code:

# matching
match <- matchit(treatment ~ independent1 + independet2 + independent3, data = mydata, method = "nearest")
matched_data <- match.data(match)

# model for outcome by treatment
model <- glm(outcome ~ treatment, data = matched_data, family = binomial(link = "logit"))
publish(model)

So this obviously works if I'm fine with using only the first out of 5 possible imputed datasets (as far as I now "complete" uses the first dataset by default).

Now my question is: I read about the "pool" function, but it seems that in the end I need a regression formula (like seen here https://rdrr.io/cran/mice/man/pool.html at the end of the page > "Example"). My favorite result of the imputed data would be a completed dataset with the same number of rows as before the imputation process (5oo rows) but with imputed values (by all 5 datasets) instead of NAs.

For example:

final_imputed_data <- complete(impute) # don't use the first imputed dataset (out of 5) but all 5

Or do I misunderstand the sense of multiple imputation?

$\endgroup$
2
  • 1
    $\begingroup$ Is the end goal of this analysis to estimate the propensity scores, or are you going to use the propensity scores as one step in a further analysis? $\endgroup$ Sep 13, 2021 at 13:05
  • $\begingroup$ After propensity score matching I would like to do further analyses with the matched dataset... $\endgroup$
    – MDStat
    Sep 13, 2021 at 13:47

1 Answer 1

1
$\begingroup$

To do multiple imputation with propensity score matching, you should use the MatchThem package, which was designed specifically for this purpose. You need to do the following steps:

  1. Multiply impute the data, creating M (e.g., 5) separate datasets with the missing values filled in by estimates of the missing values. mice does this and stores the output in a mids object (which you have called impute). You should use way more than 5 (e.g., 50) imputations, as more is always better.
  2. Estimate propensity scores within each imputed dataset and then perform the matching within each imputed dataset. MatchThem does this using the matchthem() function, which uses the same sytnax as matchit() but takes in a mids object instead of a data frame.
  3. Assess balance on the matched multiply imputed data. The cobalt package works with matchthem objects (called mimids objects) to assess balance across and within imputed datasets.
  4. If balance is achieved, estimate the effect within the imputed datasets. The MatchThem functions with() and pool() (which work similarly to the corresponding functions in mice) do this, correctly incorporating the weights, matching structure, and correction for multiple imputation.

All this is described in the MatchThem paper and documentation. Remember that propensity score matching and multiple imputation are advanced statistical techniques and should only be used by someone with advanced statistical training using these methods.

$\endgroup$
9
  • 1
    $\begingroup$ What about the problem made you want to use propensity scores? And why use a matching algorithm that discards valid data? $\endgroup$ Sep 13, 2021 at 13:48
  • $\begingroup$ Hi Noah, thank you for your answer! I read the MatchThem paper you linked here, but I've still got the question, if there is a possibility, to get back a data frame after multiple imputation for further analyses similar to the match.data function, which gives back a full data frame after using matchit(). $\endgroup$
    – MDStat
    Sep 14, 2021 at 13:46
  • $\begingroup$ Use the complete() function in MatchThem. $\endgroup$
    – Noah
    Sep 14, 2021 at 14:33
  • $\begingroup$ Hi Noah, thank you again for your response. Could you maybe help me with a code snippet, how to create a "cross section dataset"? If I use complete() with default parameters the FIRST dataset of the 5 will be selected. Is there a way to create a cross section of the different datasets? Does that make sense? $\endgroup$
    – MDStat
    Sep 14, 2021 at 18:46
  • $\begingroup$ I mean, I have 5 different datasets - how do I decide, which of them to use for my subsequent analyses? $\endgroup$
    – MDStat
    Sep 14, 2021 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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