【问题标题】:R: Mixed Effects Cox Model (coxme) output in latexR:乳胶中的混合效果考克斯模型(coxme)输出
【发布时间】:2017-11-07 13:35:48
【问题描述】:

我已经用coxme 导出了一个混合效应 Cox 模型,我正在尝试将结果提取到乳胶表中。我看到texreg() 不起作用,我想知道是否还有其他选择。

【问题讨论】:

  • 你试过xtable 包吗?也许this thread 会有所帮助。
  • 是的,不适用于此类对象。
  • 我认为提取对象中的每个组件并将它们折叠到表格中似乎是一个明智的解决方案。谢谢@LAP

标签: r output


【解决方案1】:

对于这类问题,我真的很喜欢带有 pixiedust 包的扫帚。 Broom 不会开箱即用地处理 coxme 对象,但是第三个包 ehahelper 为这些对象提供了函数。

# install ehahelper, not on cran
devtools::install_github('junkka/ehahelper')

安装后整理

library(coxme)
library(ehahelper)
library(broom)
fit <- coxme(Surv(y, uncens) ~ trt + (1|center), eortc)
tidy_fit <- tidy(fit)
class(tidy_fit)
[1] "data.frame"
tidy_fit
  term  estimate  std.error statistic p.value  conf.low conf.high
1  trt 0.7086127 0.06424398     11.03       0 0.5826968 0.8345286

一旦进入数据框,您就可以导出到 xtable,或者在 markdown 文档中使用 pixiedust 到 pdf。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-19
    • 1970-01-01
    相关资源
    最近更新 更多