Re: [S] Residual Deviance and log-likelihood in survreg

Prof Brian Ripley (
Thu, 19 Feb 1998 15:36:19 GMT

I'm trying here to put together a limited-length reply to comments of
Jens Oehlschlaegel <oehl@Psyres-Stuttgart.DE> and Paul Monaghan

Jens wrote:

> So I assume the the key here to combine those two statements is "with
> respect to the same measure", i.e. cautiously comparing a Weibull with a
> Log-Normal is ok, comparing a Log-Normal with a Identity-Normal is not.

It is OK if you compute the log-likelhood with respect to time data: the
current survreg does not: see below for how to correct it.

> However, I'm struggling with some implications:
> (1)
> From what you say it looks like
> survreg(Surv(time,event)~x, link="log")
> equals
> survreg(Surv(log(time),event)~x, link="identity")
> and trying that indeed gave identical results (WinS+3.3),
> except if some cases have time<1, then log(time) < 0
> and in the second version surreg stops with an error.

Yes, and there is an example to that effect in survival4.doc that
Terry Therneau mentioned (on statlib). The problem is that although the
documentation for Surv mentions times back to -infinity, it objects to
negative times. Those checks could be removed.

> If the second version is a legal version, could I go on doing a
> hybrid version like
> psm(Surv(ifelse(time<1, log(time), time-1), event)~x
> ,link="identity")
> which treats time logarithmic close to zero and linear after time=1?
Provided you can interpret this, yes. It is an accelerated-life model
on a strange lifetime scale.

> (2)
> Furthermore, is there any way to use the following
> -2LL0 -2LL1 LR=-2LL0+2LL1 $null.deviance $deviance
> for a good-ness of fit comparision between a
> log-normal and a identity-normal parametric survival model? Or do I have
> to accept that there is no goodness of fit?

You can certainly use an AIC measure (I don't follow your notation)
provided you change the log-likelihoods to the same base measure.

The density of log(T) is the density of T, times T, so

LL(based on log T) = LL(based on T) + sum log T_i

the sum being over non-censored observations only (as only they have
densities in the likelihood). This enables you to relate the survreg
value of LL to the baseline one. More generally, if you use
transformation t(time),

LL(based on t(T)) = LL(based on T) - sum log t'(T_i)

Paul wrote:

> To 'compare' the likelihoods between models for T and log T, the term
> - (sum over uncensored observations) log T (*)
> should be added to the survreg output for log-likelihood. This is the
> constant which Professor Ripley suggested in his recent mail to
> s-news.


> I think that the amendment (*) is a property of the accelerated life
> models, and although I am not certain, would not expect it to hold for
> models fitted to log T, where T has a parametric proportional hazards
> formulation.

It is general, as the argument I gave above shows. (Sorry, I thought
that was elementary enough not to give it the first time.) The
correction comes from the change in densities and is not related to how
those densities vary with the parameters.

Jens wrote:

> 3) The Nagelkerke R-square seems not to be a Goodness of fit, rather
> evaluating the association to the covariates than the fit of the error
> distribution. But on which measure the Nagelkerke R-square should be
> computed, should it be based on the -2LLs (like in Harrell's cph-objects)
> R2.nagelkerke = R2.LR / R2.max
> where
> R2.LR = 1 - exp(-LR/n)
> R2.max= 1 - exp(LL0/n)
> or is the LL0 wrong in the latter, and should it should it be based on the
> deviance?

In his paper Nagelkerke defines this only for `discrete models, i.e.
models whose likelihood is a product of probabilities', so I don't
think it should be used for parametric survival models at all. This is
not a comment on its use in summary.coxph, where there is only a
partial likelihood, which _is_ a product of probabilities. That is
another topic.

Brian Ripley
This message was distributed by To unsubscribe
send e-mail to with the BODY of the
message: unsubscribe s-news