- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在尝试使用来自 mice
的估算数据集运行 tbl_regression
通过 logistic glm 运行。我在尝试组合自定义 tidiers pool_and_tidy_mice
和 tidy_standardize
以便从合并的小鼠结果和标准化比值比估计中获得回归输出时遇到问题。
有没有一种方法可以通过将估算数据与 tbl_regression 合并来获得标准化优势比,或者我可以采取其他步骤来获得它们?
以 surival
包为例,我可以使用这段代码获得非估算数据的标准化优势比:
library(tidyverse)
library(broom.mixed)
library(broom)
library(survival)
mod <- glm(death ~ marker + grade, data = trial, family = "binomial")
tbl_regression(mod, tidy_fun = tidy_standardize,
exponentiate = TRUE, conf.int = TRUE, conf.level = 0.95)
但是,如果我尝试在下面的代码中使用 tidy_standardize
,
suppressWarnings(mice::mice(trial, m = 2)) %>%
with(glm(death ~ marker + grade, family = "binomial")) %>%
tbl_regression(tidy_fun = tidy_standardize,
exponentiate = TRUE, conf.int = TRUE, conf.level = 0.95)
我收到这个错误:
x There was an error calling `tidy_fun()`. Most likely, this is because the
function supplied in `tidy_fun=` was misspelled, does not exist, is not
compatible with your object, or was missing necessary arguments (e.g. `conf.level=` or `conf.int=`). See error message below.
Error: Error in .model_parameters_generic(model = mice::pool(model), ci = ci, : formal argument "standardize" matched by multiple actual arguments
In addition: Warning messages:
1: Could not get model data.
2: No variables could be standardized.
3: Could not get model data.
4: No variables could be standardized.
我也尝试了以下但仍然收到错误消息:
suppressWarnings(mice::mice(trial, m = 2)) %>%
with(glm(death ~ marker + grade, family = "binomial")) %>%
tbl_regression(tidy_fun = purrr::partial(tidy_standardize, method = "posthoc"),
exponentiate = TRUE, conf.int = TRUE, conf.level = 0.95)
x There was an error calling `tidy_fun()`. Most likely, this is because the
function supplied in `tidy_fun=` was misspelled, does not exist, is not
compatible with your object, or was missing necessary arguments (e.g. `conf.level=` or `conf.int=`). See error message below.
Error: Error in .model_parameters_generic(model = mice::pool(model), ci = ci, : formal argument "standardize" matched by multiple actual arguments
最佳答案
遗憾的是,整理器无法组合或堆叠。
为了获得您想要的结果,我建议您在建模步骤中对协变量进行标准化,而不是等到模型被估计出来。
下面的例子!
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.5.0'
tbl <-
suppressWarnings(mice::mice(trial, m = 2)) %>%
with(glm(death ~ scale(marker) + grade, family = "binomial")) %>%
tbl_regression(exponentiate = TRUE)
#> pool_and_tidy_mice(): Tidying mice model with
#> `mice::pool(x) %>% mice::tidy(exponentiate = TRUE, conf.int = TRUE, conf.level = 0.95)`
由 reprex package 创建于 2021-12-10 (v2.0.1)
关于r - gtsummary::tbl_regression 使用 pool_and_tidy_mice() 和 tidy_standardize(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70300331/
变量“Var2”默认设置为分类变量,而有时需要均值(sd)。所以我对如何修改它很感兴趣。 data_table_1 = data %>% dplyr::select(group, var1,
当我创建一个“自定义 pvalue 函数到 add_p()”时,我试图调整 p 值的位数,但发现函数“round”不起作用。 (参见代码“result$p % tbl_summary(by = t
我正在使用优秀的 R 包“gtsummary”创建汇总表,它确实帮助我高效准确地生成汇总表。但是我想知道是否可以像p值一样自动生成一些统计量,例如t值,F值和卡方? library(gtsummary
我正在尝试向 gtsummary 的行标签添加脚注表,但我不知道如何引用我想要的确切单元格。 预期输出 使用默认的 trial 数据集,我想在“药物 B”中添加一个脚注,写为“即安慰剂”: 特征N =
我有一个有四个结果的因变量。我使用 mlogit 包进行多项逻辑回归。 当我尝试使用 gtsummary 包呈现结果时,我的多项逻辑回归结果堆叠在一起(参见下面的代码和表格)。 有没有办法让结果并排在
我正在尝试对一些行/变量(分类的和连续的)进行分组,以帮助提高大型数据集中的表格可读性。 这是虚拟数据集: library(gtsummary) library(tidyverse) library(
有谁知道是否有可能从汇总表(tbl_summary()和add_p())中排除一些p值? 另外,我们可以更改所用测试的脚注吗? library(gtsummary) mtcars %>% tbl_su
我正在使用 gtsummary 包从逻辑回归生成表。 例如,我想使用试验数据中的阶段级别“T3”作为引用级别,而不是默认的“T1”。我怎样才能在这个示例代码中做到这一点? 我的目标是对单变量和多变量逻
我试图弄清楚如何在使用 gtsummary 时添加自定义选项——例如,pvalues、标题等的星号。 这是一个使用基本 mtcars 数据的可重现示例,以防它更有效...... library(tid
我正在使用gtsummary::tbl_summary()创建汇总表。这是一个示例数据: df tbl_summary() A 级的百分比是 50%,而不是 2/6 = 33.3%。百分比仅根据现有
我正在尝试将 {gtsummary} 表(特别是 tbl_regression() 输出)输出为图像。我正在使用 kableExtra::as_image()但结果不是很漂亮。下面是一个reprex,
我无法弄清楚在汇总分类变量时如何告诉 tbl_summary 函数显示小数位。它适用于像“mpg”这样的连续变量,但不适用于“cyl”。 library(tidyverse) library(gtsu
我想知道是否有一种简单的方法可以去除由 R 中的 gtsummary 包创建的回归表中的前导零?我喜欢这个包的功能,但不确定是否有一种简单的方法来格式化表格以符合 APA 指南(例如,p 值没有前导零
在使用 gtsummary() 包创建描述性表格时,我得到了一张很长的表格。是否可以将这样的表拆分为多个较短的表? 通过这个示例数据集,我想展示我的意思: library(gtsummary) # m
我正在尝试创建一个患者特征表(表 1),该表有效,但由于我的“by”变量有 10 个类别,因此它会溢出 PDF 页面。 我尝试截断类别名称,并将页面布局更改为横向,但 1 个类别仍然不在页面上。 您能
是否可以在 Shiny 的应用程序中使用 {gtsummary} 呈现表格? library(gtsummary) # make dataset with a few variables to sum
我想在 R 包 gtsummary 中使用 tbl_regression 生成的回归汇总表的变量名称中引入下标。任何人都可以提供有关如何执行此操作的指导吗?用于生成表和结果表的代码如下所示。我希望标签
我无法使用 gtsummary 编织成 pdf包裹。这是一个reprex: library(gtsummary) reg ...al \expandafter \let \cmrsideswitch
到此为止:r shiny reactive gt_summary table 我想要一个 gtsummary 表,其中包含以 react 方式 (Input$y) 从 SelectInput 字段中选
{gtsummary} 具有 tbl_svysummary() 函数,用于从 {survey} 包创建的 survey.design 对象生成汇总统计表. {gtsummary} website提供了
我是一名优秀的程序员,十分优秀!