Hi there,

I would like to perform a time to event analysis of hospital readmissions by patient using the Andersen Gill method and have used the code on the stata FAQ for multiple failure analysis as my guide (https://www.stata.com/support/faqs/s...ure-time-data/).

With my data set, each row represents a hospitalization. Below you can see an example for 6 individuals (ID 1-6). I have defined the following variables:
  • start = time from date of birth -> admission (calculated as "date of admission - date of birth")
  • end = Time from date of birth -> Next admission OR end of study period
  • status = failure event: did readmission occur? (0 = no, 1 = yes)
  • patient_id = unique participant.
I am hoping for your feedback on any errors I have made in my set up. I suspect that I need to change the way I have set up the "start" and "end" variables.
Questions:
(1) I have labeled my failure event (status == 1) for 12,000+ observations. How come only 1,286 of these events are being considered failures (_d)?
(2) I'm not sure I understand what the following output (see below) means:
1,078 observations end on or before enter()
12,093 observations begin on or after exit

What does it mean for the observation to end on or before enter? Or to begin on or after exit?

I was expecting to have 12,102 failure events (every hospitalization is considered a failure event - a readmission - except for the final observation as this is looking at the subinterval from the final admission to the end of the study period). However, when I run the analysis I have far fewer failures (1,286) than I expected:

With command:
Code:
stset end, fail(status) exit(end) id(patient_id) enter(start)
I get the following output:

ID variable: patient_id
Failure event: status!=0 & status<.
Observed time interval: (end[_n-1], end]
Enter on or after: time start
Exit on or before: time end
--------------------------------------------------------------------------
16,428 total observations
10 multiple records at same instant PROBABLE ERROR
(end[_n-1]==end)
1,078 observations end on or before enter()
12,093 observations begin on or after exit

--------------------------------------------------------------------------
3,247 observations remaining, representing
3,247 subjects
1,286 failures in single-failure-per-subject data



Here is a sample of my data.

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(patient_id start end status) byte(_st _d) int(_t _t0)
1  361  374 1 1 1 374 361
1  375  451 1 0 .   .   .
1  452  490 1 0 .   .   .
1  491  514 1 0 .   .   .
1  515  605 1 0 .   .   .
1  606  634 1 0 .   .   .
1  635  679 1 0 .   .   .
1  680 3016 0 0 .   .   .
2  313  344 1 1 1 344 313
2  345  731 1 0 .   .   .
2  732 2691 0 0 .   .   .
3    0  395 1 0 .   .   .
3  396  445 1 0 .   .   .
3  446  579 1 0 .   .   .
3  580  593 1 0 .   .   .
3  594  601 1 0 .   .   .
3  602  765 1 0 .   .   .
3  766  808 1 0 .   .   .
3  809  829 1 0 .   .   .
3  830  847 1 0 .   .   .
3  848  933 1 0 .   .   .
3  934 1004 1 0 .   .   .
3 1005 1032 1 0 .   .   .
3 1033 1057 1 0 .   .   .
3 1058 1092 1 0 .   .   .
3 1093 1135 1 0 .   .   .
3 1136 1141 1 0 .   .   .
3 1142 1163 1 0 .   .   .
3 1164 1225 1 0 .   .   .
3 1226 1267 1 0 .   .   .
3 1268 1327 1 0 .   .   .
3 1328 1348 1 0 .   .   .
3 1349 1364 1 0 .   .   .
3 1365 1420 1 0 .   .   .
3 1421 1483 1 0 .   .   .
3 1484 1520 1 0 .   .   .
3 1521 1565 1 0 .   .   .
3 1566   66 0 1 0  66   0
4  888  909 1 1 1 909 888
4  910  931 1 0 .   .   .
4  932  979 1 0 .   .   .
4  980 1023 1 0 .   .   .
4 1024 1072 1 0 .   .   .
4 1073 1217 1 0 .   .   .
4 1218 1291 1 0 .   .   .
4 1292 2689 0 0 .   .   .
5    0  322 1 1 1 322   0
5  323  382 1 0 .   .   .
5  383  445 1 0 .   .   .
5  446  505 1 0 .   .   .
5  506  514 1 0 .   .   .
5  515  554 1 0 .   .   .
5  555  561 1 0 .   .   .
5  562  625 1 0 .   .   .
5  626 1187 0 0 .   .   .
6  935  985 1 0 .   .   .
6  986  996 1 0 .   .   .
6  997 1012 1 0 .   .   .
6 1013 1067 1 0 .   .   .
6 1068 1083 1 0 .   .   .
6 1084 1094 1 0 .   .   .
6 1095 1120 1 0 .   .   .
6 1121 1143 1 0 .   .   .
6 1144 1148 1 0 .   .   .
6 1149 1200 1 0 .   .   .
6 1201 1212 1 0 .   .   .
6 1213 1279 1 0 .   .   .
6 1280 1301 1 0 .   .   .
6 1302 1321 1 0 .   .   .
6 1322 1458 1 0 .   .   .
6 1459 1494 1 0 .   .   .
6 1495 1514 1 0 .   .   .
6 1515 1616 1 0 .   .   .
6 1617 1670 1 0 .   .   .
6 1671 1697 1 0 .   .   .
6 1698 1725 1 0 .   .   .
6 1726 1890 1 0 .   .   .
6 1891 1928 1 0 .   .   .
6 1929 1985 1 0 .   .   .
6 1986 2093 1 0 .   .   .
6 2094 2209 1 0 .   .   .
6 2210 2221 1 0 .   .   .
6 2222 2227 1 0 .   .   .
6 2228 2273 1 0 .   .   .
6 2274 2292 1 0 .   .   .
6 2293 2347 1 0 .   .   .
6 2348 2507 1 0 .   .   .
6 2508 2533 1 0 .   .   .
6 2534 2583 1 0 .   .   .
6 2584 2605 1 0 .   .   .
6 2606 2636 1 0 .   .   .
6 2637 2676 1 0 .   .   .
6 2677 2709 1 0 .   .   .
6 2710 2927 1 0 .   .   .
6 2928 2944 1 0 .   .   .
6 2945 3124 1 0 .   .   .
6 3125 3412 1 0 .   .   .
6 3413 3741 1 0 .   .   .
6 3742 4160 1 0 .   .   .
6 4161  226 0 0 .   .   .
end
Thanks in advance for any advice or resources!
Let me know if any additional information would be helpful.