[R] loglogistic cumulative distribution used by survreg

Terry Therneau therneau at mayo.edu
Fri Oct 31 15:43:02 CET 2008


> What is the cumulative distribution (with parameterization) used within
> survreg with respect to the log-logistic distribution?

> That is, how are the parameters linked to the survivor function?

Reference: Kalbfleisch and Prentice, The statistical analysis of failure time 
data, chapter 2.  This is the basis for survreg.

Theory:
Let z = (log(time) - X beta)/ scale = the transformed data.  Then

       S(z) = 1/(1+exp(z)) = survival function.
 
 
Practice:
  fit <- survreg(Surv(time, status) ~ ph.karno + age + sex, data=lung, 
  	         dist='loglogistic')

  # Get the survival curve for a 60 year old male with Karnofsky score of 70
  tdata <- data.frame(age=60, sex=1, ph.karno=70)
  stemp <- 99:1/100
  xtemp <- predict(fit, newdata=tdata, type='quantile', p=1-stemp)
  plot(xtemp/365, stemp, xlab="Years", ylab='Survival', type='l')

I purposefully did not ask for the 0th percentile, which can cause problems with 
the logarithm, or the 100th percentile, which is infinite (and I'd like to keep 
the plot to a reasonable scale).

	Terry Therneau



More information about the R-help mailing list