how to calculate median follow-up time? I have a hospital based dataset which conatins information on patient details. Right from their visit, drugs, diagnosis, lab tests, and death info etc.
So, now I would like to compute their follow up time from the date of the 1st visit to last visit (when they visited hospital for the last time).
How can I do this? I couldn't find any tutorials online. While I did fine one resource but am not sure how can this be implemented in python?
There should be some readymade packages or tools which could this, but am unable to locate it.
I am trying to calculate something as shown in table 4 in this paper
Can guide me with this?
 A: Since the paper doesn't explain how it was calculated, I would assume they used the time until the last known followup for each participant, then calculated the usual median, and the first and third quartiles. In other words, they ignored the reason for why that was the person's last time of followup. So, if a person died on day 5, it's counted as 5; if they were lost to followup on day 30, that person is counted as 30; if they were still being followed at the time the data was analyzed, which was Day 1000, then it is 1000; etc. They end up with 12,242 numbers. Sort them. The median is the average of the 6,121 and 6,122 smallest numbers. The first and third quartiles are roughly equal to the 3,060 and 9,181st numbers sorted from smallest to largest. There are different conventions for exactly how to define the first and third quartile. There are several other methods used that incorporate the reasons for loss to followup, for example "reverse Kaplan-Meier" and the pros and cons of some of them are described here.
