从大列表(生存)中获取汇总表

问题描述 投票:0回答:1

我有一个名为 resultados 的对象,一个列表,它是 cch 函数的结果。用于设置一个循环运行的模型,以迭代生物标记列表(111 个元素)。我想获取每个元素的摘要中显示的表格。如果您按 resultados$hsalet7a5p$coefficients 计算,此表会有所不同


resultados <- list()

# Iterate in variables where i are the 111 biomarkers

for (i in columnas) {
  # age, sex, HDL-C levels, diabetes, hypercholesterolaemia, triglyceride levels, hypertension, smoking habit, body mass index, and leisure-time  physical activity. 

  # Construir dinámicamente la fórmula
  
  formula <- as.formula(paste("Surv(tocoro, iam) ~ edat + sexe + hdldir + diabetis + fuma + box + pes + trigli + col + ", i))
  
  # Analysis
  resultado <- cch(formula, data = dat, subcoh =  ~ casecohort2, id = ~parti, cohort.size = 5404, method = "LinYing", robust = TRUE)
  
  # Almacenar el resultado en la lista
  resultados[[i]] <- resultado
}

> class(resultados$hsalet7a5p)
[1] "cch"
> summary(resultados$hsalet7a5p)
Case-cohort analysis,x$method, LinYing 
 with subcohort of 195 from cohort of 5404 

Call: cch(formula = formula, data = dat, subcoh = ~casecohort2, id = ~parti, 
    cohort.size = 5404, method = "LinYing", robust = TRUE)

Coefficients:
             Coef     HR   (95%     CI)     p
edat        0.050  1.052  1.010   1.095 0.015
sexe2      -1.753  0.173  0.060   0.502 0.001
hdldir     -0.019  0.981  0.941   1.024 0.381
diabetis    0.357  1.429  0.495   4.124 0.510
fuma       -0.310  0.733  0.556   0.967 0.028
box5        4.314 74.727 30.717 181.790 0.000
pes        -0.021  0.979  0.947   1.012 0.218
trigli      0.001  1.001  0.994   1.009 0.740
col         0.011  1.011  1.001   1.022 0.034
hsalet7a5p  0.198  1.219  1.003   1.482 0.047

提前致谢

r survival-analysis summary
1个回答
0
投票

循环列表并使用

broom::tidy
:

# data from cch help page
res <- list(fit1 = cch(Surv(edrel, rel) ~ stage + histol + age, data =ccoh.data,
                       subcoh = ~subcohort, id=~seqno, cohort.size=4028),
            fit2 = cch(Surv(edrel, rel) ~ stage, data =ccoh.data,
                       subcoh = ~subcohort, id=~seqno, cohort.size=4028))

lapply(res, function(i) broom::tidy(i))

# $fit1
# # A tibble: 5 × 7
#   term     estimate std.error statistic  p.value conf.low conf.high
#   <chr>       <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
# 1 stageII    0.735     0.168       4.36 1.30e- 5  0.404      1.06  
# 2 stageIII   0.597     0.173       3.44 5.77e- 4  0.257      0.937 
# 3 stageIV    1.38      0.205       6.76 1.40e-11  0.983      1.79  
# 4 histolUH   1.50      0.160       9.38 0         1.19       1.81  
# 5 age        0.0433    0.0237      1.82 6.83e- 2 -0.00324    0.0898
# 
# $fit2
# # A tibble: 3 × 7
#   term     estimate std.error statistic  p.value conf.low conf.high
#   <chr>       <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
# 1 stageII     0.851     0.152      5.59 2.28e- 8    0.553      1.15
# 2 stageIII    0.938     0.152      6.19 6.20e-10    0.641      1.24
# 3 stageIV     1.42      0.185      7.69 1.49e-14    1.06       1.79
© www.soinside.com 2019 - 2024. All rights reserved.