[R] [newbie] Cox Baseline Hazard

Thomas Lumley tlumley at u.washington.edu
Fri Feb 23 17:55:56 CET 2001


On Thu, 22 Feb 2001, Daniel A. Powers wrote:

> Meles --
>
> Here are a couple of routines. One computes Aalen's estimate of the
> cumulative hazard and the other a log-likelihood based on it
>

Yes, but if you do

aalen<-function(fit, remove.centering=FALSE){
	s<-survfit(fit)
	H<- -log(s$surv)
	if (remove.centering)
	    H<-H*exp(-coef(fit)*fit$means)
	data.frame(t=s$time,Lambda=H)
	}

you have the advantage that it still works for left-truncated data, and if
you want it at the mean rather than at zero it works for stratified models
as well.  In my experience it is extremely unusual that you want to do the
numerically unstable transformation to get the baseline hazard at Z=0.

Similarly, the loglikelihood is available in fit$loglik. This works for
left-truncated data, tied failure times, and stratified models and doesn't
require a quadratic-time algorithm.

Given the recent demand I'll add a cumulative hazard function for the next
release.


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list