From therneau at mayo.edu  Tue Mar  8 14:39:56 2011
From: therneau at mayo.edu (Terry Therneau)
Date: Tue, 08 Mar 2011 07:39:56 -0600
Subject: [Rd] function local to a fit
Message-ID: <1299591596.1839.21.camel@punchbuggy>

  I've added a time-transform ability to coxph: here is an example

fit <- coxph(Surv(time, status) ~ age + tt(age) + sex, data=lung,
	tt=function(x, t, ...) x*log(t) )

The only role for tt() in the formula is to be noticed as a specials by
terms().  I currently have tt defined as a function
	tt <- function(x) 
It has to be exported in the namespace, documented, etc.

Is there a way to make tt() local to coxph, but still be found by
model.frame, so that it does not have to be global?   It would seem to
be neater to do a marker transform like s() in gam, cluster() in coxph,
etc in this way, where the meaning is local to the enclosing function.

Terry Therneau



[Rd] function local to a fit
Terry Therneau