I am working in program R. I have survival times that are both left truncated and right censored, therefor I am using the entry, exit format. The data set also contains competing events, i.e. failures from a secondary cause not under direct investigation.
Here is an example of the my dataset, min entry time is obviously 0, and max exit time is 1,000 (end of the follow up time). The 'to' variable indicates which cause the failure occurred from. I am interested in the failure caused by to=1 but need to account for the failure structure of to = 2 as well.
I am in the process of completing some basic univariate analysis to check for violations of the proportional hazards assumption and have found that some of the variables are indeed time dependent, i.e. show a greater effect at differing time intervals. It is my understanding that this can be handled by adding in an interaction term with time and the offending variable. In my case since I have both entry and exit times I am not sure which of the my time variables to add in the interaction term.
Here the basic formula form I am using.
to == 1 is a failure code, in this case failure due to the risk investigated not the competing risk.
Lets say that after a test for the proportional hazards assumption (cox.zph) we noticed the assumption is not upheld. How can I code an interaction term with shore.cat and time? Do I have to somehow code the interaction for the time span in which the observation occurred? This to me makes sense. In a situation without left truncation you simply code the term with the time variable which is just the duration of time until failure or censorship. Any help on how to code this (if this is in fact how to accomplish the interaction term) is appreciated as I cannot seem to find many useful links on other forums.