[R] Weibull survival regression
Eric Lim
eric.lim at cvsnet.org
Tue Nov 23 23:21:01 CET 2004
A big thank you to everyone who responded...
Using Ales Ziberna solution with the lung dataset, I obtained:
> plot(survfit(Surv(time,status),data=lung))
Error in Surv(time, status) : Time variable is not numeric
In addition: Warning message:
is.na() applied to non-(list or vector) in: is.na(time)
Using Thomas Lumley's solution with the lung dataset, I obtained:
> curve(pweibull(x, scale=1/coef(lung.wbs), shape=1/lung.wbs$scale,
lower.tail=FALSE),from=0, to=max(lung$time))
A Weibull survival plot appearing as a 90 degree `L' at the extremes of
the plot
I managed to obtain the solution by combining the two solutions:
lung.wbs <- survreg( Surv(futime, status)~ 1, data=lung, dist='weibull')
plot (survfit(Surv(futime,status)~1, data=lung))
curve (exp (- (exp( lung.wbs$coef[1])*x)^(1/lung.wbs$scale)),
col="black", add=T, from=0, to=30)
Kind regards,
Eric Lim
Papworth Hospital
Cambridge, UK
More information about the R-help
mailing list