# Re: st: Just what are -tvc- and -texp- doing in -stcox-?

 From rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp) To statalist@hsphsun2.harvard.edu Subject Re: st: Just what are -tvc- and -texp- doing in -stcox-? Date Fri, 31 Jul 2009 10:34:01 -0500

```Jocelyn Andrel <Jocelyn.Andrel@mail.jci.tju.edu> 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
> 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)

> or

> stsplit at(failures)

-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)

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
rgutierrez@stata.com
*
*   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/
```