SleepEstEachDay {ActiSleep} | R Documentation |
Daily sleep estimate
Description
Obtain sleep data from accelerometer data
Usage
SleepEstEachDay(
datain,
f = 1,
id = NA,
Y_name = "max_count",
T = 0.4,
nonwear_detect = FALSE,
wear_mins = 120,
S = 3,
NoPA_cut = 0.7,
sleep_mins = 20,
wake_mins = 180,
nap_mins = 20,
UseDiary = FALSE,
diary_data = c(),
CommonBedTime = "22:00:00",
CommonWakeTime = "8:00:00",
tz = "GMT"
)
Arguments
datain |
input accelerometry dataset, must be tibble, data frame, etc. |
f |
cost function indicator |
id |
subject id |
Y_name |
column name of the activity count data to be used in analysis, for example max count of x, y, z axes or vector magnitude |
T |
threshold percentile of activity level |
nonwear_detect |
flag indicating use of nonwear detection algorithm, default is FALSE |
wear_mins |
threshold number of minutes to define wear segment |
S |
number of segments per hour |
NoPA_cut |
percent of 0 counts to define NoPA segments |
sleep_mins |
threshold number of minutes to define sleep segment |
wake_mins |
threshold number of minutes to define wake segment |
nap_mins |
threshold number of minutes to define nap segment |
UseDiary |
flag indicating if diary data to be used, default is FALSE |
diary_data |
diary data, must be a data frame |
CommonBedTime |
in-bed time if no diary data, default is "22:00:00" |
CommonWakeTime |
out-bed time if no diary data, default is "8:00:00" |
tz |
timezone, default is GMT |
Value
list containing a data frame of summary sleep data
Examples
data("AccelData")
AccelData <-
ChangeTimeVar(AccelData, col_idx = 1, format = "%m/%d/%Y %H:%M")
SleepEstEachDay(AccelData, Y_name = "VM")
data("AccelData")
AccelData <-
ChangeTimeVar(AccelData, col_idx = 1, format = "%m/%d/%Y %H:%M")
SleepEstEachDay(AccelData, Y_name = "VM", nonwear_detect = TRUE)
data("AccelData")
data("SleepDiary1Day")
SleepDiary1Day <-
ChangeTimeVar(
SleepDiary1Day,
col_idx = c(1,2),
format = "%m/%d/%Y %H:%M")
AccelData <-
ChangeTimeVar(AccelData, col_idx = 1, format = "%m/%d/%Y %H:%M")
SleepEstEachDay(
AccelData,
f = 2,
Y_name = "VM",
T = 0,
nonwear_detect = TRUE,
S = 2,
NoPA_cut = 0.45,
sleep_mins = 5,
UseDiary = TRUE,
diary_data = SleepDiary1Day
)