How to derive Non-wear and Nap time windows from output

114 views
Skip to first unread message

Adithya Palle

unread,
Sep 19, 2022, 1:13:45 PM9/19/22
to R package GGIR
Hi all,

I am trying to find sleep windows, nap windows, and non-wear time windows using GGIR. So far, I have only been able to find the sleep windows by looking at the sleep onset columns in the part 5 output. 

Is there a similar time recording for non-wear and napping times, or is that data only available as proportions of the total day?

Thank You,

Adithya 

Vincent van Hees

unread,
Sep 19, 2022, 1:32:08 PM9/19/22
to Adithya Palle, R package GGIR
Hi Adithy,

GGIR does not provide nap estimates, but reports time spent in sustained inactivity bouts (abbreviated as sib). I intentionally named it like that because there is no evidence that these reflect naps. For example, they could also reflect brief episodes of sensor non-wear.

Unfortunately, authors like https://pubmed.ncbi.nlm.nih.gov/34637446/ and https://www.nature.com/articles/s41467-020-20585-3 ignored that and referred to sibs as 'naps', because that makes it easier to score publications or something, but it is not evidence based

We do have some prototype code for nap detection in 3-4 year olds based on waist worn accelerometer data, which I would not recommend you to use and which I therefore have not documented well yet. 

Best, Vincent

Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image

------- Original Message -------
--
You received this message because you are subscribed to the Google Groups "R package GGIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to RpackageGGIR...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/RpackageGGIR/cf78a4c0-0d96-48d4-b13a-ec43ffbeb6b8n%40googlegroups.com.

Adithya Palle

unread,
Sep 19, 2022, 1:41:58 PM9/19/22
to R package GGIR
Hi Vincent,

Thanks for the response, I will take your advice and not attempt to record "nap" windows.

Are there any concrete time recordings for non-wear windows available from the GGIR output? I assumed there was because the part 5 output produces data such as "nonwear_perc_day" which measures the percentage of non-wear time during the day. If there are, where would I have to look to find them?

Thank You,

Adithya 

Vincent van Hees

unread,
Oct 3, 2022, 1:56:31 PM10/3/22
to Adithya Palle, R package GGIR
Are there any concrete time recordings for non-wear windows available from the GGIR output? I assumed there was because the part 5 output produces data such as "nonwear_perc_day" which measures the percentage of non-wear time during the day. If there are, where would I have to look to find them?

See documentation on time series output files:

Cheers,
Vincent

Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image

------- Original Message -------

Adithya Palle

unread,
Nov 19, 2022, 10:37:37 PM11/19/22
to R package GGIR
Hi Vincent,

Thanks for the help.

I was able to find the time series output file, but I am having another issue where the first and last days of my data are not being included in this time series or any of the part 5 outputs (because they are partial days). I read in the documentation that this is an intended effect, but that I could remove this feature by adjusting the "minimum_MM_length.part5" parameter. 

I've tried this, but have had no success with getting the output for these first and last days.
```

g.shell.GGIR(#=======================================
# INPUT NEEDED:
mode=c(1,2,3,4,5),
datadir= c(locs[1]),
outputdir= locs[2],
studyname=id,
f0=1,
overwrite = FALSE,
# sample_rate = 80,
#-------------------------------
# Part 1:
#-------------------------------
# Key functions: reading file, auto-calibration, and extracting features
chunksize=1, printsummary=TRUE,
#-------------------------------
# Part 2:
#-------------------------------
strategy = 1,
hrs.del.start = 0, hrs.del.end = 0,
# winhr = c(5,10),
# ilevels = c(seq(0,400,by=50),8000),
mvpathreshold =c(100,120),
bout.metric = 4,
closedbout=FALSE, dofirstpage =FALSE,
#-------------------------------
# Part 3:
#-------------------------------
# Key functions: Sleep detection
ignorenonwear = FALSE,
#-------------------------------
# Part 4:
#-------------------------------
do.visual = TRUE,
#-------------------------------
# Part 5:
# Key functions: Merging physical activity with sleep analyses
#-------------------------------
threshold.lig = c(30), threshold.mod = c(100), threshold.vig = c(400),
boutcriter = 0.8, boutcriter.in = 0.9, boutcriter.lig = 0.8,
boutcriter.mvpa = 0.8, boutdur.in = c(1,10,30), boutdur.lig = c(1,10),
boutdur.mvpa = c(1), save_ms5rawlevels = TRUE,
do.sibreport = TRUE, frag.metrics="all", ,part5_agg2_60seconds=FALSE,
timewindow = c("MM", "WW"), minimum_MM_length.part5 = 1,

#-----------------------------------©
# Report generation
#-------------------------------
# Key functions: Generating reports based on meta-data
do.report=c(2,4,5),
visualreport=TRUE, # dofirstpage = TRUE,
viewingwindow = 1 )
}

```

Do you have any ideas on how to fix this so I can get time series/summary data for the first and last day as well?

Thank you so much,

Adithya Palle

Vincent van Hees

unread,
Nov 21, 2022, 2:07:59 PM11/21/22
to Adithya Palle, R package GGIR
Does argument 'save_ms5raw_without_invalid' offer a solution? Possibly you then also do not need to use `save_ms5raw_without_invalid`. I have not tried this myself, so would be good to hear back from you how it goes.

Thanks,

Vincent
------- Original Message -------

Adithya Palle

unread,
Nov 22, 2022, 1:08:35 PM11/22/22
to R package GGIR
Hi Vincent,

This worked! The time series output now does include the clipped-off days at the start and end. The day-summaries in part 5 still exclude these days, but that is fine as I should be able to find what I want in the time series output.

Thank You,

Adithya Palle

Adithya Palle

unread,
Nov 22, 2022, 7:42:08 PM11/22/22
to R package GGIR
Hi Vincent,

Thanks again for the help with the invalid day issue.

I am also working with some data with less than 2 nights of sleep, and I was hoping the 'save_ms5raw_without_invalid' argument would help me read that, but I keep getting an error:

Error in `[.data.frame`(daysummary_tmp, , MainMetric) : 

  object 'MainMetric' not found

Calls: g.shell.GGIR ... <Anonymous> -> g.plot5 -> which -> [ -> [.data.frame

Execution halted

It seems to be the same issue that is discussed in this thread :

https://github.com/wadpac/GGIR/issues/192


Do you know of any arguments in GGIR that can be tweaked to allow me to read time series data for data with only 1 or 2 days?

Thank you for your help,


Adithya



Vincent van Hees

unread,
Dec 5, 2022, 8:15:05 AM12/5/22
to Adithya Palle, R package GGIR
Are you using a different acceleration metric then the default? If yes, then specify argument acc.metric to tell GGIR that that is the accelerometer to be used for the visualreport.

Best, Vincent

Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image

------- Original Message -------
Reply all
Reply to author
Forward
0 new messages