create.flag {accelmissing} | R Documentation |
Create a Missing Flag Matrix
Description
Defines the missing interval by detecting consecutive zeros for a while (20 minutes as a default), and create a flag matrix with the binary indicator for wearing vs. nonwearing time.
Usage
create.flag(PA, window = 20, mark.missing = 0)
Arguments
PA |
an N by T matrix including activity counts, where N is the total number of daily profiles, and T is the total minutes of a day (T=1440). |
window |
Minimum minutes of missing interval. The default is 20, which means that we define the missing interval when the exact zeros continues more than 20 minutes. 30 or 60 minutes are also commonly used. |
mark.missing |
If |
Value
an N by T matrix with the elements of 0 or 1.
Author(s)
Jung Ae Lee <jungaeleeb@gmail.com>
References
[1] Lee JA, Gill J (2016). Missing value imputation for physical activity data measured by accelerometer. Statistical Methods and Medical Research.
[2] Catellier DJ, Hannan PJ, Murray DM, Addy CL, Conway TL, Yang S, Rice JC (2005). Imputation of missing data when measuring physical activity by accelerometry. Medicine and Science in Sports and Exercise; 37 (11 Suppl).
See Also
Examples
data(acceldata) # read data
PA = acceldata$PA
# create a missing flag matrix with 60 minutes criterion
flag60 = create.flag(PA, window=60, mark.missing=0)
# create a missing flag matrix with 30 minutes criterion
flag30 = create.flag(PA, window=30, mark.missing=0)