Time-dependent random effects in survival analysis

Good night. I wanted to ask to what extent a frailty model can be effective in controlling “time-dependent” confounding biases due to time-varying heterogeneity (i.e., the omission of key confounders not observed during follow-up). For example, if I try to model the effect of stopping chemotherapy at time t in cancer patients, it is most likely that this decision is due to multiple criteria or factors that were not present at baseline, and may influence the outcome. These decisions often have very variable motivations, in different scenarios, which are sometimes not well captured in the databases. The question is: have any of you used a multi-state frailty model to take into account the heterogeneity of the effect with respect to the time dependent variable, or even clustered at the patient level? Is it a good idea? Is it usually effective?

It doesn’t sound like a multistate frailty model is even possible with the data structure as you have described it. What is the exposure? The patient either continues or discontinues chemotherapy. Interruptions are a distinct clinical event in most cases. You can fit the crude effect and point to the research dimensions of capturing better data.

Good afternoon, I probably didn’t elaborate before. In its most summarized form, the exposure would be " the discontinuation of chemotherapy". The model with fixed effects would look like this:
coxph(formula = Surv(time1, time2, mortality) ~ X+ Y +td_stop_chemo + strata (to==3), data = data)
Where X and Y are fixed variables, and “TD stop chemo” is a time-dependent variable. The stratification term points to the transition to death.
The question I ask is what a frailty model of this type would bring:
coxme(Surv(time1, time2, mortality) ~ X + Y + td_stop_chemo+ (1 | td_stop_chemo)+ (1 | id), data = data).
As far as I know this would allow me to take into account the different baseline hazard of the subjects in which the chemotherapy is stopped, since this happens, as opposed to the subjects who continue with all, and the same at the individual level. However, I’m not sure if this is correct or beneficial versus the initial Cox model.