[R] 3-parametric Weibull regression

Terry Therneau therneau at mayo.edu
Fri Jan 27 15:17:49 CET 2012


--- begin included message ---

Hello,

I'm quite new to R and want to make a Weibull-regression with the
survival package. I know how to build my "Surv"-object and how to make a
standard-weibull regression with "survreg".
However, I want to fit a translated or 3-parametric weibull dist to
account for a failure-free time.
I think I would need a new object in survreg.distributions, but I don't
know how to create that correctly. I've tried to inherit it from the
"extreme" value distribution like so
......

---  end inclusion ------

 I don't think that this is possibile through the survreg.distributions
approach.  One problem is an early censoring: say an observation was
censored at time 10, and your delay time estimate were 15: the
underlying routine would need to drop that obs from the calculations,
and there is no mechanism to do that.
  An althernative approach would be to include survreg in an optimize
call.  Here is an example

 myfun <- function(lower, time, status, x) {
	time2 <- time-lower
	fit <- survreg(Surv(time2, status) ~x, dist="wiebull", 
	                  subset= (time2 > 0))
	fit$loglik
	}
 fit0 <- survreg(Surv(time, status) ~ x1 + x2 + ...., data=yd,
	x=T, y=T)
 ofit <- optimize(myfun, c(0, .99*min(yd$time[yd$status==1])), 
	time=fit0$y[,1], status=fit0$y[,1], x=fit0$x, maximum=T)

This will give you the optimal value for the threshold.  The .99 is to
stop the routine from an intermediate solution where there is a death at
exactly time 0.  The data set is yd="your data".

Terry Therneau



More information about the R-help mailing list