I am trying to run survival analysis using the
survfit functions from the
survival package in R. Most of my data is left truncated, and I'm not sure if I'm entering it into the
Surv function correctly. My response variable is time (measured in years) beginning from when a bridge is classified as deficient, and ending when it collapses. I can track each bridge's deficiency status from 2012 back to 1992, but no further. The censoring occurs because many bridges were classified as deficient from the time of their collapse back to 1992, and thus I don't know exactly when they became deficient, and therefore I don't know their true "lifetime" (number of years from deficient classification to collapse). Say for example a bridge collapsed in 1995, and was classified as being deficient in 1995, 1994, 1993, and 1992. It is possible that it was first classified as being deficient in 1992, it is also possible that it has been classified as deficient since 1984. Thus I believe my censoring is considered to be left truncated.
Some example data:
Year0 = c(1992, 1992, 1999, 1992, 1993, 2007, 2005, 1992) # The years when each bridge was first observed as being deficient. Year1 = c(1993, 1994, 2002, 1996, 2004, 2012, 2011, 2000) # The years in which each bridge collapsed Defyears = Year1 - Year0 + 1 # The number of years for wich I can observe each bridge being deficient time1 = Year0 - 1992 # Since I want the time scale to be from 0 to 21 instead of 1992 - 2012, I subtract 1992 from each time observation. # This now becomes the beginning point for the lifetime of each bridge. time2 = Defyears + time1 # This is the ending point of the lifetime of each bridge. n = length(time2)
Notice that four out of the eight bridges are left truncated, bridge 1, 2, 4, and 8. I cannot observe exactly when they were first classified as being deficient. For bridges 3, 5, 6, and 7 I know their exact lifetimes since they became deficient after 1992, hence these observations are not censored.
I then fit the model:
bridges = survfit(Surv(time = time1, time2 = time2, event = rep(1,n)) ~ 1) # I do "event = rep(1,n)" because each bridge collapsed.
I'm just not sure that this model is correct. For one thing, in the documentation it says that
time is for right censored data or the starting time for interval censored data. For another, I don't see how this model accounts for the observations that aren't censored. Can anyone tell me if this is right, and if not, what I need to change and why. Any help is greatly appreciated. Thanks so much!