[R] Survreg with gamma distribution
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sun Oct 17 18:23:03 CEST 2004
On Sun, 17 Oct 2004, Kuan-Ta Chen wrote:
> Hi, all:
>
> I find survreg {survival} has provided many distributions such as weibull,
> lognormal, etc. But I wonder why it doesn't have the support for gamma
> distribution since it should be a good distr. in lifetime analysis. Can
> anybody figure out the reason?
I suspect Dr Therneau had no need of it: it is not commonly a good
distribution in medical applications. He did however provide a way for
users to specify other distributions: see ?survreg.distributions.
> I've tried to implement the likelihood function of progressively censored
> data for gamma distr. and use optim() to solve the paramemters. The
> log-likelihood function L contains some integrations. I use tryCatch() to
It should not contain numerical integrations: all you need is dgamma and
pgamma to specify the log-likelihood.
> capture the error when integration lead to divergence and return Inf.
> But if consequent two calls to the objective function return Inf, optim()
> will raise errors:
>
> Error in optim(c(ga, 1/la), fr, method = "BFGS") :
> non-finite finite-difference value [1]
>
> What can I do except for choosing better initial values?
It seems very unlikely that the log-likelihood really is Inf, and so you
need to calculate it more carefully. Finite-differencing numerical
integrations is almost bound to be unstable, and you can write down the
log-likelihood and its first derivative in terms of functions available in
R.
> The last question, by its name "survreg", survreg does its job by
> regression,
> but why p.75 in Tableman, Kim (2004) said that "We use the S function
> survReg to fit parametric models (with the MLE approach)...". Does survreg
> use regression or MLE approach?
What do you understand by these? There is no such thing as `regression
approach'. survreg fits a linear regression model to log survival times,
by maximum likelihood. Note that `regression' is often used to mean
fitting by OLS, but also often used to mean a linear model for a mean
effect.
I suggest you find a less confusing text.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list