Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: FW: how to express time dependent variables in cox regression

From   Phil Clayton <>
Subject   Re: st: FW: how to express time dependent variables in cox regression
Date   Wed, 20 Jul 2011 13:55:04 +1000

Hi Dougie,

You don't need to use the -tvc- option at all. -help stcox- tells you:

tvc(varlist) specifies those variables that vary continuously with respect to time, i.e.,
        time-varying covariates.  This is a convenience option used to speed up calculations and to
        avoid having to stsplit the data over many failure times.

The -tvc- option is useful when you have an effect that violates the PH assumption (or it can be used to to test the PH assumption).

In your case you're modelling an exposure that varies discretely with time, but (at this stage) assuming that the effect of that exposure is constant over time. Assuming you've -stset- the data correctly, all you need to run is:
stcox age drugYNtime

For further information take a look at the manual entry for -stcox-, especially the section "Cox regression with discrete time-varying covariates"


On 20/07/2011, at 4:39 AM, Dougie Elder wrote:

> Dear all,
> Apologies for what is likely to be a basic question from a newbie, but I
> have hunted everywhere to try to work out the appropriate way to do this.
> I am looking at a population of patients and trying to determine the effects
> of prescribed drugs after diagnosis (index date) on survival.
> I wish to use time-dependent variables to represent the number of days on
> treatment, to minimise the potential for survival or immortality time bias
> i.e. must survive to get a drug.
> I have expanded my data set to create several time points per individual and
> used a variable to determine whether drug was prescribed at that time point
> (drugYNtime) or not. I also have a variable DrugYN which represents whether
> a drugs was ever prescribed. i.e.
> ID   age  time  drugYNtime    drugever
> 1       33   1               0        1
> 1       33   2              1        1
> 1       33   3               1        1
> 1       33   4               1        1
> 1      33    5               0        1
> 2      62    1               0        1
> 2      62    2               1        1
> I then used the following command:       stcox age, tvc(drugYNtime)
> but would stcox age drugYNtime, tvc(drugYNtime) or even stcox age drugever,
> tvc(drugever) be more appropriate ?
> I would appreciate any advice / guidance here and apologies if it is a
> rather basic question !
> PS I have Stata 11.2SE
> Dougie
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index