skdh.sleep.SleepAverageHazard#

class skdh.sleep.SleepAverageHazard#

Compute the average hazard summary of the hazard function as a function of the sleep bout duration. The average hazard represents a summary of the frequency of transitioning from a sleep to awake state.

Methods

predict(lengths, starts, values)

Notes

Higher values indicate higher frequency in switching from sleep to awake states.

The average hazard is computed per [1]:

\[h(t_n_i) = \frac{n\left(t_n_i\right)}{n - n^c\left(t_n_{i-1}\right)} \har{h} = \frac{1}{m}\sum_{t\in D}h(t)\]

where \(h(t_n_i)\) is the hazard for the sleep bout of length \(t_n_i\), \(n(t_n_i)\) is the number of bouts of length \(t_n_i\), \(n\) is the total number of sleep bouts, \(n^c(t_n_i)\) is the sum number of bouts less than or equal to length \(t_n_i\), and \(t\in D\) indicates all bouts up to the maximum length (\(D\)).

References

[1]

J. Di et al., “Patterns of sedentary and active time accumulation are associated with mortality in US adults: The NHANES study,” bioRxiv, p. 182337, Aug. 2017, doi: 10.1101/182337.

predict(lengths, starts, values)#
Parameters:
lengthsnumpy.ndarray

Lengths of bouts.

startsnumpy.ndarray

Indices of bout starts

valuesnumpy.ndarray

Value of the bout.

Returns:
h_sleepfloat

Sleep bout average hazard.