# 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?

• The question seems to say you want to compute the median time elapsed between the first and last visits. In that case, just take the sample median. But then, why mention other measurements like lab tests, etc--is there some connection? Also, table 4 in the linked paper compares various measurements between the first and last visits. I don't see any mention there of median time elapsed between visits. Could you clarify what you're asking? Mar 4, 2021 at 14:23
• In the table, we have median follow-up at the last line Mar 4, 2021 at 14:25
• How can I compute the median time elapsed (follow up)? YOu mean get the first and last day of visit for a patient.. compute their difference (in years/months etc).. Repeart the same for other patients and finally find the median of that difference values? Mar 4, 2021 at 14:27
• Yes, given your description of follow up time, that seems to be exactly what one might do. Of course, this ignores censoring; if the data is censored, you'd use some kind of survival analysis instead. Mar 4, 2021 at 14:40
• It doesn't seem to make sense to talk of "follow-up" if we are only considering the first and the last visit. If someone visits five times, then the follow-up should be the second visit (as a follow-up to the first one). And possibly later ones as well if the patient presented with a new complaint at, say, the third visit. Mar 4, 2021 at 14:58