Extracting matched sample dataframe from MatchThem

110 Views Asked by At

I am using the R package MatchThem to match a dataset that contains 19 control samples and 13 case samples. After running the MatchThem command with nearest-neighbor one-to-one matching without replacement, I see in the summary that the matched sample should now contain 13 controls and 13 cases. I wanted to extract the matched sample dataset so that I can use other functions on this sample (e.g. survival analysis, summary table with gtsummary, etc.), and learned that the complete() function serves this purpose.

However, after running the complete() function and checking the data frame, I see that this (supposedly) matched sample contains 19 controls and 13 cases, just like the initial dataset before matching!

What is the proper way of extracting the matched sample with 13 controls and 13 matched cases?

1

There are 1 best solutions below

0
On

Please read the documentation for MatchThem::complete(). The all argument controls whether all units are included or whether those with zero weights (i.e., those that have not been matched) are dropped. Setting all = FALSE will only return matched units.

By the way, don't think you can learn anything from a sample of 26 units that have missing values. That is way too small an sample for anything meaningful to arise.