在完全匹配后使用 Survey::svydesign 和 tbl_svysummary 来考虑匹配权重是否有意义?

发布于 2025-01-13 06:55:54 字数 522 浏览 0 评论 0原文

我使用 R 中的 MatchIt 包进行完全匹配,它为我提供了匹配数据集中每个观察值的权重。然后我想列出治疗组和对照组的结果汇总表。

我无法使用 Sjoberg 的 gtsummary 包中的正常 tbl_summary,因为它不考虑匹配权重。所以,我想我可能会使用 tbl_svysummary (调查包),因为它可以让我考虑匹配权重。

因此,我的代码如下所示:

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()

我的问题:这有意义吗?或者如何在完全匹配后呈现一个汇总表,以便我能够说明匹配权重?

谢谢您的任何建议!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相思碎 2025-01-20 06:55:54

您可以这样做,但是,我定期处理调查数据,根据我的经验,当我想要呈现汇总表时,使用 Survey::svymean() 或 Survey::svyby() 函数更容易。

例如使用 svyby:

svyby(~Treatment, ~outcome, design = YOURDESIGN, svymean)

请参阅文档https://www.rdocumentation.org/packages/survey/versions/4.1-1/topics/svyby

这本书“复杂” Lumley 的“调查” 也是一个很好的资源,可以阅读和了解有关调查设计的更多信息,并以简单的方式总结结果。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文