Reputation: 1
I do full matching with the MatchIt package in R, which gives me the weights for each observation in the matched dataset. I then want to present a summary table of the outcomes for the treatment and the control group.
I cannot use the normal tbl_summary from the gtsummary package by Sjoberg as it does not account for matching weights. So, I thought I might use tbl_svysummary (survey package) because it would allow me to account for matching weights.
Thus, my code would look like:
Extract<-matched_data %>% select(outcome, Treatment, weights)
survey::svydesign(~1, data = as.data.frame(Extract), weights = ~weights) %>% tbl_svysummary(by=Treatment,digits = list(all_categorical() ~ c(0, 2))) %>% add_p()
My question: Does that make sense? Or how can I present a summary table after full matching that allows me to account for the matching weights?
Thank you for any advice!
Upvotes: 0
Views: 367
Reputation: 1
You can go about it that way, however, I work with survey data regularly and in my experience its easier to use the survey::svymean() or survey::svyby() functions when I want to present summary tables.
So for example using svyby:
svyby(~ Treatment, ~ outcome, design = YOURDESIGN, svymean)
Please refer to the documentation https://www.rdocumentation.org/packages/survey/versions/4.1-1/topics/svyby
The book 'complex surveys' by Lumley is also a great resource to read and learn more about survey designs and also summarising your results in easy ways.
Upvotes: 0