I have a table like as shown below

subject_id   lab_test_id    lab_test_date       value    difference

"10005606"  "20364112"  "2143-12-06 02:32:00"   "1.3"   "13:10:00"
"10005606"  "20364112"  "2143-12-06 15:42:00"   "1.3"   "02:02:00"
"10005606"  "20364112"  "2143-12-06 17:44:00"   "1.3"   "10:11:00"
"10005606"  "20364112"  "2143-12-07 03:55:00"   "1.3"      NULL
"10005866"  "20364112"  "2149-10-01 19:30:00"   "2.1"   "07:42:00"
"10005866"  "20364112"  "2149-10-02 03:12:00"   "2.2"   "08:51:00"
"10005866"  "20364112"  "2149-10-02 12:03:00"   "2.1"   "04:59:00"
"10005866"  "20364112"  "2149-10-02 17:02:00"   "1.6"     NULL

the difference column indicates the time difference between each of the lab tests

Now, the doctor likes to know how often these measurements are done for each patient?

How can I best convey this information? Should I capture the average difference between lab tests?

For example, for patient = 10005606, it is 8 hours. Meaning adding all different values and divide by total number of records. 25 hours, 30 mins (approx)/3 records = 8 hours approx

Is there any other better way to represent this using median or any other measure etc?

Can guide me with this?


1 Answer 1


The average or median seem reasonable here. A boxplot might be a good choice of visualistion:

enter image description here

The y-axis could be your time dimension, and boxplot shows the normal distributions of differences, including the median value and outliers. You could then compare certain measurements against this. But it would of course depend on if you have enough data in your sample to represent the total population.

Or simply calculate the standard deviation of differences, and report this with your median (the mean value may be warped by outliers).

  • $\begingroup$ Hi, thanks. upvoted. I have couple of questions based on your response $\endgroup$
    – The Great
    Mar 26, 2021 at 12:46
  • $\begingroup$ q1) So, you are suggesting that I compute the average or median of difference variable for EACH PATIENT $\endgroup$
    – The Great
    Mar 26, 2021 at 12:48
  • $\begingroup$ q2) I compute a similar average or median of difference for another lab measurement for each patient $\endgroup$
    – The Great
    Mar 26, 2021 at 12:49
  • $\begingroup$ q3) Then compare the output of q1) and q2) as this can suggest which of the measurement has been frequent or how one measurement fares in comparison to the other ? $\endgroup$
    – The Great
    Mar 26, 2021 at 12:50
  • $\begingroup$ The second difference changes your initial question, so you need a new question for Q3 $\endgroup$
    – WBM
    Mar 26, 2021 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.