skdh.sleep.WakeAverageHazard#

class skdh.sleep.WakeAverageHazard#

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

Notes

Higher values indicate higher frequency in switching from awake to sleep 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 awake 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 awake 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.

Methods

predict(lengths, starts, values)

Parameters:

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

Lengths of bouts.

startsnumpy.ndarray

Indices of bout starts

valuesnumpy.ndarray

Value of the bout.

Returns:
h_awakefloat

Awake bout average hazard.