正在看一个例子,是用指数分布进行生存分析数据的拟合,前面都没问题
>library(survival)
>data(ovarian)
> s2=survreg(Surv(futime, fustat)~1 , ovarian, dist=’exponential’)
> summary(s2)
Call:
survreg(formula = Surv(futime, fustat) ~ 1, data = ovarian, dist = "exponential")
Value Std. Error z p
(Intercept) 7.17 0.289 24.8 3.72e-136
Scale fixed at 1
Exponential distribution
Loglik(model)= -98 Loglik(intercept only)= -98
Number of Newton-Raphson Iterations: 4
n= 26
>plot(T,1-pexp(T,exp(-7.169)),xlab="t",ylab=expression(hat(S)*"(t)"))
就这么几行程序,我完全按照这个输的,但是图拟合出来不对,左边是例子里附的图,右边是我做出来的,因为plot里用了“T”,代表Ture,所有x和y都是1,当然不对了。
求大神指导该怎么修改这个程序才能画出左边的图