pyActigraphy.metrics.MetricsMixin.kAR¶
- MetricsMixin.kAR(threshold, start=None, period=None, frac=0.3, it=0, logit=False, freq=None, offset='15min')[source]¶
Rest->Activity transition probability
Weighted average value of pAR(t) within the constant regions, defined as the longest stretch within which the LOWESS curve varied by no more than 1 standard deviation of the pAR(t) curve [1].
- Parameters
threshold (int) – Above this threshold, data are classified as active (1) and as rest (0) otherwise.
start (str, optional) – If not None, the actigraphy recording is truncated to ‘start:start+period’, each day. Start string format: ‘HH:MM:SS’. Special keywords (‘AonT’ or ‘AoffT’) are allowed. In this case, the start is set to the activity onset (‘AonT’) or offset (‘AoffT’) time derived from the daily profile. Cf sleep.AonT/AoffT functions for more informations. Default is None
period (str, optional) – Time period for the calculation of pRA. Default is None.
frac (float) – Fraction of the data used when estimating each value. Default is 0.3.
it (int) – Number of residual-based reweightings to perform. Default is 0.
logit (bool, optional) – If True, the kRA value is logit-transformed (ln(p/1-p)). Useful when kRA is used in a regression model. Default is False.
freq (str, optional) – Data resampling frequency string applied to the daily profile if start=’AonT’ or ‘AoffT’. Default is None.
offset (str, optional) – Time offset with respect to the activity onset and offset times used as start times. Default is ‘15min’.
- Returns
kar
- Return type
float
References
- 1
Lim, A. S. P., Yu, L., Costa, M. D., Buchman, A. S., Bennett, D. A., Leurgans, S. E., & Saper, C. B. (2011). Quantification of the Fragmentation of Rest-Activity Patterns in Elderly Individuals Using a State Transition Analysis. Sleep, 34(11), 1569–1581. http://doi.org/10.5665/sleep.1400
Examples
>>> import pyActigraphy >>> rawAWD = pyActigraphy.io.read_raw_awd(fpath + 'SUBJECT_01.AWD') >>> rawAWD.kAR(4) 0.041397590252332916 >>> rawAWD.kAR(4, start='08:00:00', period='12H') 0.04372712642257519