让我假设我有以下数据集:
time censor treatment
6 0 A
12 1 A
4 0 B
5 0 B
3 0 C
12 1 C
6 0 B
12 1 C
4 0 A
5 0 C
3 0 B
12 1 A
所以我所做的就是重新考虑我的参考A并运行:
coxph(Surv(time,censor)~treatment)
我查看了结果,并与提供的样本协议进行了比较,发现我的exp(-coeff)在两个案例B和C中都等于它们的exp(coeff)。
因此我用参考文献B再次运行代码,用参考文献C运行一次并发现,下限和上限都与样本一致。但是我还需要log-rank p值,这不是以这种方式提供的,因此我想找出:
如何扭转模型,使反向风险比和conf。显示限制和p值(我的意思是反模型)/或者您认为其他问题出了什么问题?
答案 0 :(得分:0)
使用survdiff
执行日志排名测试:
dts <- read.table(text='
time censor treatment
6 0 A
12 1 A
4 1 B
5 0 B
3 0 C
12 1 C
6 0 B
12 1 C
4 1 A
5 0 C
3 1 B
12 1 A
', header=T)
cxp <- coxph(Surv(time,censor)~treatment, data=dts)
summary(cxp)
survdiff(formula = Surv(time,censor)~treatment, data=dts)
# Call:
# survdiff(formula = Surv(time, censor) ~ treatment, data = dts)
#
# N Observed Expected (O-E)^2/E (O-E)^2/V
# treatment=A 4 4 3.63 0.037 0.15
# treatment=B 4 2 1.10 0.736 1.10
# treatment=C 4 2 3.27 0.491 1.96
#
# Chisq= 2.2 on 2 degrees of freedom, p= 0.33