skdh.sleep.SleepPowerLawDistribution#
- class skdh.sleep.SleepPowerLawDistribution#
Compute the scaling factor for a power law distribution over the sleep bouts lengths.
Methods
predict(lengths, starts, values)Notes
Larger alpha values indicate that the total sleeping time is accumulated with a larger portion of shorter sleep bouts.
The power law scaling factor is computer per [1]:
\[1 + \frac{n_{sleep}}{\sum_{i}\log{t_i / \left(min(t) - 0.5\right)}}\]where \(n_{sleep}\) is the number of sleep bouts, \(t_i\) is the duration of the \(ith\) sleep bout, and \(min(t)\) is the length of the shortest sleep bout.
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:
- alphafloat
Sleep bout power law distribution scaling parameter.