[R] Survreg function for loglogistic hazard estimation
Terry Therneau
therneau at mayo.edu
Mon Jun 8 15:55:25 CEST 2009
---begin included message --
I am trying to use R to do loglogistic hazard estimation. My plan is to
generate a loglogistic hazard sample data and then use survreg to estimate
it. If everything is correct, survreg should return the parameters I have
used to generate the sample data.
I have written the following code to do a time invariant hazard estimation.
The output of summary(modloglog) shows the factor loading of dfico is -0.002
instead of 0.005. Also I can not find the survreg's output of alpha and
beta of loglogistic regression. Any comments? Thanks a lot,
...
---------end inclusion ----------
The survreg function uses the location-scale parameterizations found in
Kalbfleisch and Prentice's book "The statistical analysis of failure time data".
Looking at your code, you are using something different
You K&P
1/a lambda
b gamma
And from K&P: lambda = exp(-alpha), gamma= 1/sigma, where
alpha = linear predictor from the fit
sigma = scale factor from the fit
I would suggest checking out a copy of the book to verify the above.
Second, your method of constructing a random time from the distribution is a
mystery to me. I believe your code is equivalent to
y <- min(which(runif(n) < constant))
for any given y (with changing values of the constant).
This is a value from the geometic distribution.
Terry Therneau
More information about the R-help
mailing list