【问题标题】:Is there a way to conduct one tailed t-test using add_p or add_difference function in tbl_summary?有没有办法在 tbl_summary 中使用 add_p 或 add_difference 函数进行一个有尾 t 检验?
【发布时间】:2021-10-10 15:02:50
【问题描述】:

我想包含使用 gtsummary 的单尾 t 检验的结果。有没有办法做到这一点?

【问题讨论】:

  • 请提供代码示例数据

标签: r t-test gtsummary


【解决方案1】:

您可以通过add_p(test.args=) 参数将参数传递给t.test()。在您的情况下,您需要传递 t.test(alternative = "less")(或 "greater")参数。下面的例子!

library(gtsummary)

tbl <-
  trial %>%
  select(age, marker, trt) %>%
  tbl_summary(by = trt, missing = "no") %>%
  add_p(
    all_continuous() ~ "t.test",
    test.args = all_tests("t.test") ~ list(alternative = "less")
  )

reprex package (v2.0.1) 于 2021 年 10 月 10 日创建

【讨论】:

    猜你喜欢
    • 2014-06-04
    • 1970-01-01
    • 1970-01-01
    • 2021-08-15
    • 1970-01-01
    • 1970-01-01
    • 2021-09-10
    • 2013-08-12
    • 2020-03-21
    相关资源
    最近更新 更多