[R] Fitting weibull and exponential distributions to left censoring data
Terry Therneau
therneau at mayo.edu
Fri Oct 31 14:27:03 CET 2008
Use the survreg function.
There are many different ways to parameterize a Weibull. The survreg function
imbeds it a general location-scale familiy, which is a different
parameterization than the rweibull function.
> y <- rweibull(1000, shape=2, scale=5)
> survreg(Surv(y)~1, dist="weibull")
Coefficients:
(Intercept)
1.592543
Scale= 0.5096278
Loglik(model)= -2201.9 Loglik(intercept only)= -2201.9
----
survreg's scale = 1/(rweibull shape)
survreg's intercept = log(rweibull scale)
For the log-likelihood all parameterizations lead to the same value.
There is not "right" or "wrong" parameterization for a Weibull (IMHO), but
there certainly is a lot of room for confusion. This comes up enough that I
have just added it as an example in the survreg help page, which will migrate to
the general R distribution in due course.
Terry Therneau
More information about the R-help
mailing list