Calculating area under and above multiple threshold-constrained curves
Show older comments
Disclosure: I am a Matlab novice.
Background to the Problem: I have a clinical dataset comprised of physiological values sampled at equal time intervals. I have established a threshold value such that over the entire epoch, there are sub-intervals during which the values exceed the threshold, and sub-intervals during which the values fall below the threshold. I have used the fill2c function that is available on the File Exchange to nicely visualize the relative time above or below the threshold. This produces a plot with multiple, discontinuous episodes where the value of the variable is below the threshold; the duration and magnitude of deviation during each of these sub-intervals is highly variable.
What I Want to Achieve: Looking at the entire epoch, in addition to qualitatively visualizing, I want to be able quantify, in some way, the duration and magnitude of deviation below the threshold, and compare it quantitatively, to the duration and magnitude of deviation above the threshold. My approach would be to use trapz function (or some other numerical method) to calculate the AUC for each sub-interval, and sum. I have made some very inefficient attempts - e.g., id'ing the respective indices where where the variables first cross the threshold in the downward direction, then recross in the upward, storing as a column vector, and then using the trapz function or colAUC.
Question: This is a VERY inefficient and inelegant approach, yet the problem seems generic. I'm wondering if someone can point me in the direction or provide hints to a more efficient approach/solution, as I need to do this over several very large datasets.
Accepted Answer
More Answers (0)
Categories
Find more on Genomics and Next Generation Sequencing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!