Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • stcox: Continuous Time Varying Covariates

    When evaluating the effect of a continuous covariate that changes from one wave to the next, (in this instance, the relationship between a continuous health index score and mortality risk) do I need to indicate that the covariate varies with time via the stcox, tvc(option), or does Stata automatically do this? While previous posts touch on this, I have seen contradictory answers. Example below for clarification.

    Sample Cox regressions:

    #1: stcox female age index_score

    #2: stcox female age, tvc(index_score)

    The first regression shows a much stronger effect of a one unit change in the index score on mortality risk than the second.

    Thank you

  • #2
    From the help.

    Code:
    Time varying:
    tvc(varlist) time-varying covariates
    texp(exp) multiplier for time-varying covariates; default is texp(_t)
    tvc() specifies those variables whose effect varies with time.

    texp() species the functional form of the dependence with time. By default, it is assumed that dependence with time is linear (i.e., a function of _t).

    Comment


    • #3
      Paul, thank you for your reply.

      To clarify, tvc() is only necessary then for variables where the effect varies with time, not for variables that have changing values over time? In my case, for example, an index score of 7 in t=1, 8 in t=2, and 5 in t=3, would likely not require use of the tvc() option?

      Comment


      • #4
        Yes, that's correct. I think the expression "time-varying covariates" for tvc is misleading, I much prefer "time-varying coefficient". tvc() specifies that the effect of the covariate changes with time and can be used both when the underlying covariate is fixed or varies with time.

        You set up the time-varying covariate by setting up the data accordingly. I'm assuming your data are set up something like this.

        Code:
        id wave sex age index_score dead
        1 1 1 34 7 0
        1 2 1 35 8 0
        1 3 1 36 5 1
        I've assumed there is a wave each year such that age increments by 1 year each wave.

        As an aside, there's a reason why the FAQ asks to show a small sample of your data (or a representative illustration if you can't show the actual data) and complete code (e.g., stset). My advice might be misleading or incomplete if your data is not how I've assumed.

        I'm assuming you have then

        Code:
        stset wave, fail(dead) id(id)
        Code:
        #1: stcox female age index_score
        The values of age and index_score are both time varying (that is a feature of your data and independent of any model you fit), but in model #1 the estimated hazard ratio (effect of index_score on mortality) is assumed to be constant over time (wave).

        Code:
        #2: stcox female age, tvc(index_score)
        The values of age and index_score are both time varying, but in model #2 the estimated hazard ratio for the effect of index_score is allowed to differ each wave. It is assumed that the HR for index_score is a linear function of time (wave). It is assumed that the HR for age is constant over time (wave).

        If you only had data measured at baseline (no waves) then index_score is, by definition, not time-varying. You could fit the same models and the interpretation would be the same.




        Comment

        Working...
        X