Announcement

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

  • Time-varying covariate in Cox Regression

    Hi all. After a thorough search online I can't seem to find a solution to my problem, which is why I'm now asking the experts.

    The problem: I'm doing a cox regression in 700 subjects where I want to assess the effect of the dichotomous baseline variable X on the outcome Z. In addition i have another dichotomous variable Y which is not present at baseline for any of the subjects, however some of the subjects gets this condition (Y) during the follow up at different dates, and this variable is known to be connected with Z. Furthermore X is known to sometimes lead to Y, but it isn't certain that X in itself can lead to the outcome Z, and thats what i wanna test.
    So the "known" chain of events is X --> Y ---> Z . And I want to test X --> Z. But I still want to include the effect of Y in my model as some of the subjects will follow X-->Y-->Z, and some may not have X from the beginning and still get Y later on and then reach Z. (Y--> Z) And of course then there are also other ways of reaching Z than X Y, but they are not time varying and I can more easily adjust for these.
    So i thought - how can I include Y as a time-varying covariate so as not to underestimate the effect of Y but still assess if there is a direct correlation with X and Z.
    Hope the question isn't to cryptic - I'll be happy to elaborate on the question.

    Thanks in advance. Bjorn
    Last edited by stroeier; 29 Oct 2014, 17:49.

  • #2
    Stroier (please note the preference for full real names on this forum):

    take a look at -tvc- option after -help stcox-.

    Kind regards,
    Carlo
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Bjorn (please note the preference for registering with full real names on this forum):

      type -help stcox- and take a look at -tvc- option.

      Kind regards,
      Carlo
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Dear All,
        sorry for my double-posting.
        Kind regards,
        Carlo
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          Thanks for the heads up Carlo, I wasn't aware of that. I'm not sure on how exactly to use the -tvc- option. I have stset my data with: "stset morsstrokefib14, id(lbnr) failure(stroke==1) origin(time startday) scale(365.25)" - Which means I have one failure (stroke) but three failure dates (stroke, mors, afib) I now want to incorporate the afib part as a time dependent variable - so the subjects who get afib in the follow up at different dates have a different risk from the onset of their afib. I tried using the stsplit but i'm not sure exactly how to write the the specific code.

          Comment


          • #6
            Stroier (please note the preference for full real names on this forum):
            if afib (atrial fibrillation?) is a discrete discrete time-varying covariate, there's no scope for using -tvc- option (that works for continuous covariates only): -help stcox- and related entry in Stata 13.1 .pdf manual can provide you with two examples on this topic.
            I'm not very clear with your code (and you would increase your chance of getting helpful replies if, as per FAQ, you pos it, along with Stata resuls), hence I cannot advise further.

            Kind regards,
            ​Carlo
            Kind regards,
            Carlo
            (Stata 18.0 SE)

            Comment


            • #7
              Hi stroeier,
              Here is how I usually define a time-varying covariate that is discrete using -stsplit-. The result of using this command will create two records for an individual and a discrete time-varying variable. The first record will show the discrete time-varying variable indicating that the event has not occurred up to a certain time point (x=0). The second record will show the discrete time-varying variable indicating that the event has occurred at a certain time point (x=1) and will continue to be that value until the end of follow-up (censored or outcome occurred). What you will need to create prior to using the -stsplit- command are two variables: (1) an indicator for whether the event occurred in the follow-up period (0/1), (2) a variable that contains the time when the event occurred after the start of follow-up (i.e., days from diagnosis to event).

              Here is example code of a time-varying covariate that is created for a surgery event that occurred after diagnosis.

              * Splitting records at surgery events to treat them as time-varying covariates
              Code:
              stsplit surgery_tvc, at(0) after(time = dx_to_surgery_day)
              replace surgery_tvc = surgery_tvc + 1 if surgery_dx_6ma == 1
              Tom
              Last edited by Tom Weichle; 31 Oct 2014, 09:41.

              Comment


              • #8
                Hi Tom.
                You are a genius! That was exactly what i needed. Funny how things can be extremely simple if you just know what to do. Thank you very much!

                Comment

                Working...
                X