2
$\begingroup$

I have time-varying and time-invariant predictors in my cox model. What will be the correct way to add both of them using coxph()? In my model, income, development, and gender are time invariant and gazeaway, gazepicture, and posture are time varying.

I know to add solely time-varying predictors, we need to create intervals which have a start and stop time to be fed in the Surv() function:

model <- coxph(Surv(start, stop, Listener.state) ~ income + development + gender + gazeaway +  gazepicture + posture, data=compsviv121)
suumary(model)
                         coef  exp(coef)   se(coef)      z        p
income              0.0399364  1.0407446  0.0136684  2.922  0.00348
development        -0.0006316  0.9993686  0.0005616 -1.125  0.26073
gender              0.0604521  1.0623167  0.0259312  2.331  0.01974
gazeaway            0.3122407  1.3664836  0.0608410  5.132 2.87e-07
gazepicture         0.2722540  1.3129205  0.0453264  6.007 1.90e-09
posture            -0.1379867  0.8711103  0.0861360 -1.602  0.10916

But is this correct even if I have time-invariant predictors income, development, and gender?

$\endgroup$

1 Answer 1

3
$\begingroup$

For this type of analysis, each row of the data must show all covariate values that hold for an individual during the corresponding (start, stop] time interval. If a covariate is constant in time, its value needs to be copied into each row for that individual.

See the end of Section 2 of the time dependence vignette for the R survival package. There's an example with time-varying creatinine values and a time-constant covariate of age at study entry:

In this case the variable age = age at entry to the study stays the same from line to line, while the value of creatinine varies...

$\endgroup$
1
  • $\begingroup$ Thank you @EdM. This is very helpful! $\endgroup$
    – cliu
    Commented Dec 1, 2021 at 20:00

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.