I am working on a survival analysis to look at time to preterm birth (birth before 37 weeks). I have a time-dependent exposure that can occur anytime at or after 28 weeks, defined using a heaviside function.I excluded pregnancies that ended before 28 weeks (not at risk of exposure) and censored observations at 37 weeks (no longer at risk for preterm birth).
Since exposure occurs anytime at or after 28 weeks, a pregnancy must 'survive' until the 28th week to be exposed, which results in immortal time. Because of this, I am treating week 28 as 'time 0' (subtracting the immortal time from all observations), but I'm not convinced that this is sufficient. It still seems like there is the potential for immortal time since for any given week of gestation, a pregnancy would have had to survive until that point to be exposed, which makes exposure appear protective. For example, if we were to look at t=34, there is still immortal time since pregnancies would have had to survive from the 28th week to the 34th week to be included.
How do you account for immortal time with a time-dependent exposure? Is there a different/better way to define a time-dependent exposure to account for immortal time that varies (such as using a product of exposure and time)?