||
(1) 如果遇到: Error in survdiff(surv.dfs ~ group) : Right censored data only Error in coxph(surv.dfs ~ group) : Cox model doesn't support "mright" survival data
很可能是你的 Event是 因子(factor)类型的数据
df$Event <- as.numeric(as.character(df$Event))
如果是将因子转化为数值,可以使用 as.numberica(as.character(YOUR_STRING))
参考: https://stackoverflow.com/questions/42243471/survival-not-recognizing-right-censored-data
(2)
library(survival)
kmfit<survfit(Surv(Time,Event)~Group,data=yourData)
kmfit
输出结果的时候发现medain 是NA
像:
n events median 0.95LCL 0.95UCL Group=high 332 57 NA 2134 NA Group=low 264 67 1741 1503 NA
这是因为:
“If one of the groups has not yet dropped to 50% survival at the end of the available data, you cannot compute a median survival and there will be NA values for median survival in such cases. Even if median survival has been reached in a group, it might not be possible to calculate complete confidence intervals for those median values, as you have seen.*”
(3)Time数值类型; Status 如果是0/1 可以是数值类型
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-19 22:56
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社