Cobalt and MatchThem: Post Imputation analysis

53 views Asked by At

I am using propensity score matching with multiple imputation via MatchThem and Cobalt to perform the balancing functions. In my discipline, in psm studies, it is customary to provide a table that has the means by treatment group (i.e., exposure and control) for each variable before matching and after matching. Cobalt does not seem to provide this type of information with imputed datasets, and frankly, I am surprised. So, to me, this means I will have to access the data and perform Rubin's Rules myself. I can access the imputed data for the matched datasets, but the issue I continue to run into is the inability to turn the results from the balance table (i.e., bal.tab) into a workable data frame. The list bal.tab provides cannot be coerced into a workable data frame. Does anyone have any ideas on how to do this type of coercion? Am I missing something within MICE or MatchThem that may be able to do this? Here is the minimally viable code I am working with:

require(mice) 
require(MatchThem) 
require(cobalt)
require(survey)
require(marginaleffects)
require(dplyr)

#data for use-------------------------------------------------------------------
data('osteoarthritis')

#summary checking for missing values--------------------------------------------
summary(osteoarthritis)

mean(osteoarthritis$AGE)

#imputing the missing values using pmm via mice---------------------------------
imputed.datasets<-mice(osteoarthritis,m=5)

#performing the matching--------------------------------------------------------
matched.datasets<-matchthem(OSP~AGE+SEX+BMI+RAC+SMK, 
                            datasets=imputed.datasets, 
                            method='nearest', 
                            distance = 'logit', 
                            caliper = .20)


#gets the means for each dataset into a list
bal<-bal.tab(matched.datasets, which.imp=.all, disp=c("means"))
bal

#my attempt to coerce into a data frame
df <- ldply (bal, data.frame, optional = TRUE)
View(df)

0

There are 0 answers