【问题标题】:Using tbl_regression with imputed data/pooled regression models将 tbl_regression 与估算数据/汇集回归模型一起使用
【发布时间】:2020-12-15 22:36:35
【问题描述】:

我在使用gtsummary::tbl_regression 函数显示回归模型结果方面取得了巨大成功。但是,我看不到如何将 tbl_regression 与来自估算数据集的汇总回归模型一起使用,我真的很想这样做。

我手头没有可重复的示例,我只是想看看是否有其他人找到了一种方法来处理由tbl_regression 中的mice 包创建的mids 对象。

【问题讨论】:

  • 你能举个例子让我们看看有什么解决办法吗?

标签: imputation gtsummary


【解决方案1】:

在 gtsummary 的当前开发版本中,可以总结根据来自 mouse 包的估算数据估计的模型。这是一个例子

# install dev version of gtsummary
remotes::install_github("ddsjoberg/gtsummary")
library(gtsummary)
packageVersion("gtsummary")
#> [1] ‘1.3.5.9012’

# impute the data
df_imputed <- mice::mice(trial, m = 2)

# build the model
imputed_model <- with(df_imputed, lm(age ~ marker + grade))

# present beautiful table with gtsummary
tbl_regression(imputed_model) 
#> pool_and_tidy_mice: Tidying mice model with
#> `mice::pool(x) %>% mice::tidy(exponentiate = FALSE, conf.int = TRUE, conf.level = 0.95)`

reprex package (v0.3.0) 于 2020 年 12 月 16 日创建

请务必注意,您将老鼠模型对象传递给tbl_regression()合并结果之前。 tbl_regression() 函数需要访问各个模型才能正确识别参考行和变量标签(除其他外)。在内部,小鼠模型上使用的整理功能会先将结果汇总,然后整理结果。用于此过程的代码会打印到控制台以提高透明度(如上例所示)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-14
    • 1970-01-01
    • 2016-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-22
    相关资源
    最近更新 更多