[R] survival with Weibull
Remigijus Lapinskas
remigijus.lapinskas at mif.vu.lt
Tue Jan 17 17:32:46 CET 2006
Hello,
I want to test if the Weibull distribution is appropriate for the
failure time. When trying to reproduce an example from MASS (the book,
Ch. 13.2), I type
library(survival)
library(MASS)
leuk.wei <- survreg( Surv(time)~ag+log(wbc),data=leuk)
ntimes <- leuk$time*exp(-leuk.wei$linear.predictors)
plot(survfit(Surv(ntimes)),log=T)
and get (almost) the same graph as in the book (which means that the
distribution is close to exponential). On the other hand, if I want to
test for the Weibull distribution, the recommended command
> plot(survfit(Surv(ntimes)),fun="cloglog")
ends in an error message:
Error in rep.default(2, n2 - 1) : invalid number of copies in rep()
In addition: Warning message:
2 x values <= 0 omitted from logarithmic plot in: xy.coords(x, y,
xlabel, ylabel, log)
I'd appreciate any hints,
Rem
More information about the R-help
mailing list