# Re: [R] loglogistic cumulative distribution used by survreg

From: Terry Therneau <therneau_at_mayo.edu>
Date: Fri, 31 Oct 2008 09:43:02 -0500 (CDT)

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

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

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 31 Oct 2008 - 14:51:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 31 Oct 2008 - 15:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.