Announcement

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

  • Time varying (time-dependent) covariates questions in Stata

    I am learning time-varying covariates in Cox model now, I know there are mainly two kinds: one is defined time-varying covariates such as gender which does not meet the PH assumption, you can just put them into thestcox treat gender, tvc(gender) , or you can generate a new variable which represents the interaction term after stsplit, stsplit t, at(fail) then gen tvc = gender*t then stcox treat gender tvc
    for this kind of analysis, you are not worrying about the variables themselves because they are constant over time, but the coefficients could be changed over time because they do not meet the PH assumption.
    What I am confusing is the second type of time-varying covariates (internal/ancillary time-dependent variables), I classify them into one category because they have similar feature which is the variable themselves varies over time. Such as smoking status, one man can smoke in the first 5 years and quit smoking for 2 years and then smoke again for 3 years. If everyone in the dataset has the same situation, we want to learn how the smoke status impacts lung cancer (we have everyone's smoking status and it is time dependent variable).
    1. how to input the data in Stata and how to analysis it, I have check from the internet for a while and find the command for R and SAS but not for Stata
    R:
    fit <- coxph(Surv(time1, time2,... status) ~ smoke + age, data=mydata)
    SAS:
    proc phreg;
    model time*status(1)=smoke + age;
    smoke = time1;
    if (time >= 4) then smoke=time2;
    if (time >= 5) then smoke=time3;
    ...etc.
    run;
    I want to know how to do these in Stata
    2. I know the always smoker and always nonsmoker's outcomes (lung cancer) should be classified to smoke group or nonsmoker group, but what about those people with time-varying smoke status,
    If a person smoke for 10 years and does not smoke for 1 year and got lung cancer, this outcome should be classified to which group ? Another person hasn't smoked for 10 years but just become a smoker for less than 1 year and got lung cancer, for this person this outcome should be classified to which group?

    Thank you everyone, I am struggling for a while and wait for someone help me!!!
Working...
X