[英]Using tidycmprsk (R) when no cases are censored
I am attempting to do a competing risks analysis using the package tidycmprsk in R.我正在尝试使用 R 中的 package tidycmprsk 进行竞争风险分析。
My dataset is running into a problem because there are no censored cases (everyone in the dataset has experienced one of the three outcomes).我的数据集遇到了问题,因为没有审查案例(数据集中的每个人都经历了三种结果之一)。
From the documentation:从文档中:
The event status variable must be a factor, with the first level indicating 'censor' and subsequent levels the competing risks.事件状态变量必须是一个因素,第一级表示“审查”,随后的级别表示竞争风险。
Any ideas on how to get around this?关于如何解决这个问题的任何想法? Otherwise it's treating one of my levels/outcomes as censoring when it's actually an outcome of interest.否则,当它实际上是感兴趣的结果时,它会将我的水平/结果之一视为审查。
eg Below runs a cumulative incidence curve and gives results for two outcomes - death from cancer and death from other causes:例如,下面运行累积发病率曲线并给出两种结果的结果 - 癌症死亡和其他原因死亡:
library(tidycmprsk)
cuminc(Surv(ttdeath, death_cr) ~ trt, trial)
But if you take out the censored cases, now it just gives results for one failure type thinking the other is your censored variable:但是,如果您取出审查过的案例,现在它只会给出一种失败类型的结果,认为另一种是您的审查变量:
data <- trial %>%
mutate(death_cr_new = case_when(
death_cr=="censor" ~ 2,
death_cr=="death from cancer" ~ 2,
death_cr=="death other causes" ~ 3
))
data$death_cr_new<-as.factor(data$death_cr_new)
cuminc(Surv(ttdeath, death_cr_new) ~ trt, data)
Even if unobserved, the first level of the outcome factor must be the censoring level.即使未观察到,结果因素的第一级也必须是审查级。 Expanding your example, I added an unobserved level to the outcome to indicate censoring.扩展您的示例,我在结果中添加了一个未观察到的级别以指示审查。
library(tidycmprsk)
data <-
trial %>%
dplyr::mutate(
death_cr_new =
dplyr::case_when(
death_cr=="censor" ~ 2,
death_cr=="death from cancer" ~ 2,
death_cr=="death other causes" ~ 3
) %>%
factor(levels = 1:3)
)
data$death_cr_new %>% table()
#> .
#> 1 2 3
#> 0 145 55
cuminc(Surv(ttdeath, death_cr_new) ~ trt, data)
#>
#> ── cuminc() ────────────────────────────────────────────────────────────────────
#> • Failure type "2"
#> strata time n.risk estimate std.error 95% CI
#> Drug A 5.00 97 0.000 0.000 NA, NA
#> Drug A 10.0 94 0.020 0.014 0.004, 0.065
#> Drug A 15.0 83 0.071 0.026 0.031, 0.134
#> Drug A 20.0 61 0.173 0.039 0.106, 0.255
#> Drug B 5.00 102 0.000 0.000 NA, NA
#> Drug B 10.0 95 0.039 0.019 0.013, 0.090
#> Drug B 15.0 75 0.167 0.037 0.102, 0.246
#> Drug B 20.0 55 0.255 0.043 0.175, 0.343
#> • Failure type "3"
#> strata time n.risk estimate std.error 95% CI
#> Drug A 5.00 97 0.010 0.010 0.001, 0.050
#> Drug A 10.0 94 0.020 0.014 0.004, 0.065
#> Drug A 15.0 83 0.082 0.028 0.038, 0.147
#> Drug A 20.0 61 0.204 0.041 0.131, 0.289
#> Drug B 5.00 102 0.000 0.000 NA, NA
#> Drug B 10.0 95 0.029 0.017 0.008, 0.077
#> Drug B 15.0 75 0.098 0.030 0.050, 0.165
#> Drug B 20.0 55 0.206 0.040 0.133, 0.289
#> • Tests
#> outcome statistic df p.value
#> 2 1.03 1.00 0.31
#> 3 0.089 1.00 0.77
Created on 2022-08-17 by the reprex package (v2.0.1)由代表 package (v2.0.1) 于 2022 年 8 月 17 日创建
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.