Can anyone recommend an R package that handles left-truncation, right censoring, AND time-dependent covariates?

I have a data set that consists of distance-to-event data rather than time-to-event as seen in traditional survival analysis. I am studying the disturbance effects of cruise ship travel in a Bay in Alaska to a small seabird that floats on the water when resting or feeding. In reaction to an approaching ship a bird can either 1.Flush from the water 2.Dive underwater 3. allow the ship to pass (treated as censored).

Since birds are selected at a certain distance from the ship and this distance decreases as the ship advances I have transformed the distances measured so that at the ship progresses the distance increases rather than decreases (Subtracted each distance from the furthest distance observed for all birds). The distances at which the bird ultimately reacts will then be back transformed when presenting the results. This allows the data to be passed to typical Survival Analysis software as if it was time-to-event (increasing each repeated observation).

I am exploring the effects of multiple different fixed covariates (weather, distance to shore, ship speed, etc.) but have one time (or distance rather) dependent covariate, the birds bearing off the bow in relation to the ships course. Unless the bird is directly in the line of the ship its relative bearing off the ships course will change as the ship approaches closer. Eventually if the bird remains on the water it will be at 90 degrees tot he bow and the ship will pass by the bird. Therefore I have repeated distance and bearing measurements on each bird allowing this variable to change over the course of the observation. I have considered this covariate to be binary (0-44 degrees and 45-90 degrees).

I am mainly interested in how the covariates effect the competing events (Flush or Dive) and whether these two avoidance strategies change based on distance to the ship (preliminary analysis appears that they do).

## Best Answer

The frailtypack package in its last version allows you to consider time-varying covariates effects in Cox, shared and joint models. Maybe It could help.