Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculating Area Between Curves

    I am working with time series data (sequential systolic blood pressures recorded by healthcare providers). Hypotension is defined as a systolic blood pressure less than 90 mmHg. My goal is to generate a metric that incorporates both depth (how far below 90) and duration (time spent below 90) of hypotension for each patient. To do this, I was hoping to generate a variable that includes the area below y=90 and above the curve generate by my time series data.

    I found the following command to generate total AUC, but I was unsure how to move forward. Example data shown below from another publication in the field. While searching for a solution, I stumbled upon this wonderful resource and decided to give it a try. Thank you for your time and effort!

    integ sbp vitalsign_date_time, by(pcrid) gen(total_auc)


  • #2
    I would do this by creating a new variable like this:

    Code:
    gen bp_deficit = max(0, 90 - sbp)
    integ bp_deficit vitalsign_date_time, by(pcrid) gen(total_auc)

    Comment

    Working...
    X