Last data update: 2014.03.03

R: Computing Missing Rate
missing.rateR Documentation

Computing Missing Rate

Description

Computes the missing rate from acceleromater data.

Usage

missing.rate(label, flag, mark.missing = 0, time.range = c("09:00", "20:59"))

Arguments

label

an N by 2 matrix including the labels corresponding to PA matrix. The first column, label[,1], includes the person id, and the second column, label[,2], includes the day label of 1 to 7, indicating Sunday to Saturday.

flag

an N by T matrix with the values of either 1 or 0 which indicating wearing or missing. This matrix can be created from create.flag().

mark.missing

If mark.missing = 0 (default), the nonwearing time is marked by 0 while the wearing time is marked by 1 in flag matrix. If mark.missing = 1, it is the opposite.

time.range

Define the time range during which the missing rate is computed. Default is 9am-9pm, coded by time.range = c("09:00", "20:59").

Value

Numeric value of a missing rate between 0 to 1. The output is a list of

total

total missing rate during the time range

table

missing rate table by subject

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 in Medical Research.

See Also

create.flag, wear.time.plot

Examples

## missing rate calculation: uncomment and run the code below
# data(acceldata); attach(acceldata)
# missing.rate(label, flag, mark.missing=0, time.range=c("09:00", "20:59"))$total  

## create missing flag by 60 min criterion
# flag60 = create.flag(PA, window=60, mark.missing=0)
# mr = missing.rate(label, flag60, mark.missing=0, time.range=c("09:00", "20:59"))
# mr$total  #28.1 percent

## missing proportion by days
# mean(mr$table < 0.1)   # 45.8 percent

Results