Jocelyn Andrel <[email protected]> asks:
> I'm having trouble with -stcox-. I need to produce predicted survival
> curves, but my model has a time-dependent covariate, so I can't use -tvc-
> and -texp-, I have to use -stspilt-, then -stcox-. Which would be fine,
> except my unsplit and split model simply don't match. Here's the background:
> the data is time to death from a cancer, the time-dependent covariate is
> radiation after surgery. Some people had it, some didn't, so the radiation
> variable is dichotomous (0/1) for radiation, then the time of radiation is
> there for those who had it, and missing for those who didn't.
> I really have two questions:
> 1. How do -tvc- and -texp- work?
> 2. What's wrong with this code?
> My code looks like:
> stset timetoevent, failures(censor) id(id)
> stcox age, tvc(rad) texp(timeofrad)
> or
> stsplit at(failures)
> gen radtvc = rad*(_t > timeofrad)
> stcox age radtvc
-tvc()- and -texp()- work by interacting the variables in -tvc()- with the
time expression specified in -texp()-. For example
. stcox age, tvc(rad) texp(_t > 10)
would be equivalent to
. stsplit, at(failures)
. gen radtvc = rad * (_t > 10)
. stcox age radtvc
However, what Jocelyn is encountering is that the equivalence vanishes when
the constant 10, say, is replace by the variable -timeofrad-. The reason
is that, given the time-varying nature of -texp()-, the values of -timeofrad-
correspond to observations whose analysis times coincide with observed
failures times, not with the observations as given in the original data.
As such, -texp()- should only be used with functions of analysis time that do
not include variables. This is also mentioned in the Technical Note on page
134 of the Stata 11 [ST] manual.
That stated, an error message would be more appropriate here. We'll make that
change as part of a future ado update.
--Bobby
[email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/