Rate Function

The rate function is calculated as:

rate(X, Y, t, m1, m2, n)

X: The X column name from the data table

Y: (optional) A column of real numbers

t: (optional) Time interval

m1: (optional) Minimum threshold

m2: (optional) Maximum threshold

n: (optional) Noise threshold

The rate function looks for the number of "cycles" during each interval and then divides that number by the interval duration and returns that value. A full cycle is detected when there's a value above the maximum threshold followed by a value below the minimum threshold followed by another value above the max and then another value below the min (or similarly but starting below the min).

The "peaks" during each interval are counted. m1 and m2 control for a noisy signal by ensuring that the peaks counted are actually peaks and not just fluctuations around 0. n is an absolute measure to eliminate signals without true cycles. If the range of the data is less than the noise value, no rate is calculated.

Here's a typical example of how to use the rate function:

rate("Heart Rate Monitor",5,40,50)

This calculation will determine the rate every 5 seconds. Transitions will be counted in the 40% to 50% range.

Note: The beatsPerMinute function is similar to the rate function except that the interval given for BMP is always in seconds and the returned value is always in minutes.