Announcement

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

  • Modelling exposure status as a time-dependent variable for time-dependent cox regression

    Dear Statalist forum,

    I have a study comparing users of drug X with non-users. This will be analysed with exposure to drug X as a time-dependent (time-varying) variable – where person-time for all individuals after study entry will be classified as unexposed until their first prescription for drug X; thereafter all person-time will be classified as exposed. This is to minimise immortal time bias.

    I need help correctly structuring my data prior to time-dependent cox regression. My thoughts are that my data needs to be expanded into several rows per ID, with survival-time varying by classification of unexposed/exposed if an individual changes from unexposed to exposed after study entry...

    A sample is below. Any help will be much appreciated.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float ID int entry byte exposure int exposure_date float(outcome exitdate)
     1 17267 1 17281 0 22585
     2 21920 1 21920 0 22585
     3 19703 0     . 0 20380
     4 19684 0     . 0 22586
     5 14656 1 14839 1 20306
     6 17251 1 17489 0 22581
     7 19523 1 19575 0 22586
     8 19564 0     . 0 19814
     9 19667 0     . 0 19848
    10 17210 1 19253 0 22586
    end
    format %td entry
    format %td exposure_date
    format %td exitdate

  • #2
    I've uploaded an image that may better explain what time-dependent/varying exposure is and what I need to do to the structure of my data..

    Thanks
    Attached Files

    Comment

    Working...
    X