Borja Soto Varela
2008-Oct-28 15:27 UTC
[R] Fitting weibull and exponential distributions to left censoring data
Dear R-users I have some datasets, all left-censoring, and I would like to fit distributions to (weibull,exponential, etc..). I read one solution using the function survreg in the survival package. i.e survreg(Surv(...)~1, dist="weibull") but it returns only the scale parameter. Does anyone know how to successfully fit the exponential, weibull etc... distributions to left-censoring data? Thanks Borja [[alternative HTML version deleted]]
Fernando Marmolejo Ramos
2008-Oct-28 21:15 UTC
[R] Fitting weibull and exponential distributions to left censoring data
Dear Barja Have you looked at "gamlss" y "gamlss.dist" libaries? There some functions called WEI, WEI2, and WEI3 Cheers, Fer
Terry Therneau
2008-Oct-31 13:27 UTC
[R] Fitting weibull and exponential distributions to left censoring data
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