missing.rate: Computing Missing Rate

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/ACCELMISSING.R

Description

Computes the missing rate from acceleromater data.

Usage

1
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 on days by subject

table.wh

wearing hours on days by subject

label

wearing hours by subject id and day, same information as table.wh but different data frame

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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

accelmissing documentation built on May 2, 2019, 1:44 p.m.