Reputation: 21
I am using coxph
to estimate the effect of a time-varying variable (tvc
) on a survival event (event
).
Following the several instructions on the Internet (considering tmerge
), I prepared the data (df
) as:
id country start stop event endpoint tvc time
1 a 0 3 0 0 0.1 9
1 a 3 6 0 0 0.2 9
1 a 6 9 0 0 0.3 9
2 a 0 3 1 0 0.1 8
2 a 3 6 1 0 0.2 8
2 a 6 8 1 1 0.3 8
3 b 0 3 1 0 0.1 5
3 b 3 5 1 1 0.2 5
Nevertheless, when I run fit = coxph(Surv(start, stop, event) ~ country + tvc, data=df)
it returns a proper coefficient only for each country and the coefficient for tvc results NA.
Therefore I do not understand whether there is something wrong with my formula or it is in some way wrong considering tvc
as time-varying covariate (since it variates on precise time steps (0-3 = 0.1, 3-6 = 0.2, 6-9 = 0.3) and in these time steps it has the same value no matter the id).
Any help would be much appreciated.
Thanks, Alberto
Upvotes: 2
Views: 1059