1
$\begingroup$

I'm working in Stata with a Cox model and I have a dataset in counting process style (multiple records per subject). Each observation per subject has covariants that could potentially be different depending on the time (eg. diversity in quarter 1 vs quarter 10). Not sure if this would qualify as time varying covariates or if the coefficients are just time changing, as it changes across time but not as a function of time rather due to changes in the team (joiners and leavers).

However, it is unclear to me that given this I still need to interact the variable which changes across time with time itself (in Stata for example using the tvc option) or if this is already accounted for. Furthermore do I still need to check for the PH assumption for these time-varying covariates.

Thanks in advance for the help!

Edit: I am using a Cox Proportional Hazard Model. Tvc is an option in STATA to identify time-varying covariates, namely identify it to be interacted with time.

$\endgroup$
2
  • 1
    $\begingroup$ For those of us who aren't familiar with Stata, could you please edit the question to say whether this is a Cox model and whether the "tvc option" might be something that allows for time-varying coefficients rather than time-varying covariates? It's possible to have time-varying coefficients even when the covariates are fixed in time. It's also possible to need time-varying coefficients along with time-varying covariates. $\endgroup$
    – EdM
    Commented Sep 18, 2023 at 19:33
  • $\begingroup$ @EdM thank you, I have edited the question. Would you also be able to advice me how to differentiate between the two? In my dataset the covariates are gender, age and nationality diversity of the team and can change across quarters but not always as it depends on people leaving or joining the team. Thanks! $\endgroup$
    – Laura Hill
    Commented Sep 19, 2023 at 6:03

1 Answer 1

2
$\begingroup$

Interaction with time is not automatically accounted for.

If you have a covariate that varies over time, the simplest possible scenario is that the hazard ratio at time $t$ between two individuals depends only on their covariate values at time $t$ and is constant for the same pair of covariate values. That's a model with multiple records per individual but no interaction.

There are two ways you can complicate this model

  • the hazard ratio between two given values of $X$ could vary over time (diversity matters more now that it did before)
  • the hazard ratio between two individuals depends on their covariate history, not just their current covariate value (past diversity as well as current diversity matters)

These are mathematically similar, but it turns out to be easiest to implement the first as an interaction between the covariate and (a function of) time and the second by setting up a different covariate (with its own coefficient) that represents the lagged value.

So: you have a time-varying covariate. You might want either of two time-varying effects; you don't get either one automatically.

[Stata's tvc is for implementing a combination of the two, where you are interested in the history as represented by the baseline value, and you want an interaction with some explicit function of time, and you don't want to create all the records manually]

$\endgroup$
3
  • $\begingroup$ So am I correct to assume that in my model1 in which I do not use tvc, I look at the effect of diversity at time t, meaning a HR of 1.5 for example would be that at time t the risk is 50% higher. Which would be the same as using a cloglog or logit test? However, then I would still check my PH assumption, because if not violated then one would assume that the HR is the same across all t's (eg. diversity matters the same at all times). However, if violated then I could add the tvc option as then I indeed would say for example diversity matters more in year 10 than year 1. Thanks in advance! $\endgroup$
    – Laura Hill
    Commented Sep 19, 2023 at 8:49
  • 1
    $\begingroup$ Yes, except I wouldn't use the tvc option, since it only allows you to use baseline $X$ in the history. I would create the values myself. $\endgroup$ Commented Sep 20, 2023 at 0:58
  • $\begingroup$ it might be a bit unorthodox, but I was wondering if I might ask a secondary question. Specifically, when checking the PH assumption, I get depending on the method, results I would interpret differently from each other. Schoenfeld test is highly significant, but due to sample size I check the Schoenfeld plot, which is very close to horizontal, slope between 0,02 and 0,007 depending on variable. But when subsampling based on quarters (eg. quarter 0-10, 10-20..) I get very different HR's and the interaction with tvc is significant. How should I interpret it? Thanks in advance! $\endgroup$
    – Laura Hill
    Commented Sep 20, 2023 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.