Class SlopeUtils

java.lang.Object
com.framed.cdss.utils.SlopeUtils

public class SlopeUtils extends Object
  • Constructor Details

    • SlopeUtils

      public SlopeUtils()
  • Method Details

    • computeSlope

      public static double computeSlope(Deque<SlopeUtils.Sample> win)
      Computes the least-squares linear regression slope of the ETCO2 signal over the provided sliding window, using time in seconds relative to the first sample in the window.

      The slope is returned in units of mmHg/sec (assuming input values are mmHg).

      Numerical stability: If the time axis degenerates (e.g., repeated identical timestamps), the denominator may be zero; in that case, the method returns 0.0.

      Parameters:
      win - Deque of recent samples (time/value) representing the current slope window.
      Returns:
      The regression slope in mmHg/sec; returns 0.0 if insufficient variance in time.