diff --git a/NEWS.md b/NEWS.md
index 02c06a9ec..4d6582a76 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,9 +1,11 @@
# CHANGES IN GGIR VERSION 3.3-
-- Updated documentation to point to the new web dashboard URL (#1509)
-
- Part 1: Fixed an issue in g.calibrate() where large data chunks caused out-of-bounds errors (#1513)
+- Documentation:
+ - Made each chapter more readable as a stand-alone tutorial (#1517)
+ - Updated documentation to point to the new web dashboard URL (#1509)
+
- Part 2: Fixed bug where activity log (qwindow) segments could be assigned to the day before, because g.analyse.perday() derived the recording-day dates with as.Date() defaulting to UTC instead of desiredtz (#1518)
- Part 2: Fixed regression in g.impute() where using a study_dates_file raised "NA/NaN argument" for participants whose listed start or end date is not a midnight present in the recording (e.g. an evening start, or a device that stopped recording before the listed end date). #1508
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 958ab9804..91e1738cf 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -64,6 +64,8 @@ navbar:
annexes:
text: Annexes
menu:
+ - text: Glossary
+ href: articles/Glossary.html
- text: GGIR Parameters
href: articles/GGIRParameters.html
- text: GGIR Output
diff --git a/vignettes/Glossary.Rmd b/vignettes/Glossary.Rmd
new file mode 100644
index 000000000..2c3fb8d87
--- /dev/null
+++ b/vignettes/Glossary.Rmd
@@ -0,0 +1,277 @@
+---
+title: "Glossary of GGIR Terms"
+output: rmarkdown::html_vignette
+vignette: >
+ %\VignetteIndexEntry{Glossary of GGIR Terms}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+```
+
+This page is a single reference for all GGIR-specific terms used across the documentation chapters.
+Each chapter links to the relevant entries here via its **Key terms** callout.
+If you spot a missing or incorrect definition, please open an issue on the [GGIR GitHub discussion page](https://github.com/wadpac/GGIR/discussions).
+
+---
+
+## A
+
+### ABI (Activity Balance Index) {#glossary-abi}
+A transformation of the Self-Similarity Parameter (SSP) from Detrended Fluctuation Analysis. ABI measures how balanced the pattern of activity is over the observed period; values closer to 1 reflect a more balanced pattern. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+### Acrophase / Acrotime {#glossary-acrophase}
+Output of Cosinor analysis. Acrophase is the peak of the fitted cosine curve expressed in radians; acrotime is the same peak expressed as a clock time (hours from midnight). See [Chapter 13](chapter13_CircadianRhythm.html).
+
+### Auto-calibration {#glossary-auto-calibration}
+An algorithm that uses non-movement periods in a free-living recording to estimate and correct sensor calibration error, without requiring a separate laboratory experiment. The calibration uses gravitational acceleration as a reference. See [Chapter 3](chapter3_QualityAssessment.html).
+
+---
+
+## B
+
+### Behavioural bout {#glossary-bout}
+A sustained period of time in a given behavioural class (e.g., MVPA, inactivity) that satisfies user-specified duration and intensity criteria. Bouts are detected in GGIR parts 2 and 5. See [Chapter 11](chapter11_DescribingDataCutPoints.html).
+
+### Behavioural fragmentation {#glossary-fragmentation}
+A set of metrics that quantify how frequently the pattern of behaviour alternates between activity and inactivity (or sleep and wakefulness) over a recording. See [Chapter 14](chapter14_BehaviouralFragmentation.html).
+
+---
+
+## C
+
+### Circadian rhythm {#glossary-circadian-rhythm}
+Physical, mental, and behavioural changes an organism experiences over a 24-hour cycle. GGIR quantifies the movement component of circadian rhythms using metrics such as MXLX, Cosinor, IV, IS, phi, and DFA. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+### Cleaningcode {#glossary-cleaningcode}
+A per-night integer value in the GGIR part 4 output that records the outcome of the sleep detection process: 0 = sleep log used; 1 = alternative guider used; 2 = insufficient valid data; 3 = no data; 4 = no nights to analyse; 5 = SPT estimated from guider only; 6 = fallback estimates used. See [Chapter 10](chapter10_SleepAnalysis.html).
+
+### Clipping {#glossary-clipping}
+A data quality flag applied when a sustained proportion of acceleration values in a 15-minute window are close to or exceed the dynamic range of the sensor, indicating the sensor may have been used inappropriately or was stuck at an extreme value. Clipping time is treated as invalid (non-wear) by GGIR. See [Chapter 3](chapter3_QualityAssessment.html).
+
+### CoV (Coefficient of Variance) {#glossary-cov}
+A fragmentation metric calculated as the standard deviation divided by the mean of log-transformed fragment lengths. Requires at least 10 fragments. See [Chapter 14](chapter14_BehaviouralFragmentation.html).
+
+### Cut-point {#glossary-cut-point}
+An acceleration threshold used to classify epochs into behavioural intensity categories (e.g., inactivity, LIPA, MVPA). See [Chapter 11](chapter11_DescribingDataCutPoints.html).
+
+---
+
+## D
+
+### Data masking {#glossary-data-masking}
+The process of excluding parts of a recording that fall outside the intended wear period, based on prior knowledge of the study protocol (e.g., hours before the participant first put on the device). Controlled with parameter `data_masking_strategy`. See [Chapter 5](chapter5_StudyProtocol.html).
+
+### Daysleeper {#glossary-daysleeper}
+A participant whose main sleep period starts before noon but ends after noon (e.g., a shift worker sleeping in the morning). GGIR detects this and shifts its analysis window from noon–noon to 6pm–6pm for that night. See [Chapter 9](chapter9_SleepFundamentalsGuiders.html).
+
+### DFA (Detrended Fluctuation Analysis) {#glossary-dfa}
+A method to quantify fractal temporal correlations in a time series. GGIR uses DFA in part 6 to derive the Self-Similarity Parameter (SSP) and Activity Balance Index (ABI). See [Chapter 13](chapter13_CircadianRhythm.html).
+
+### Dynamic range {#glossary-dynamic-range}
+The maximum absolute acceleration value a sensor can record. Used in clipping detection: values exceeding 150% of the dynamic range trigger a clipping flag. See [Chapter 3](chapter3_QualityAssessment.html).
+
+---
+
+## E
+
+### ENMO (Euclidean Norm Minus One) {#glossary-enmo}
+The default acceleration metric in GGIR. Computed as the vector magnitude of the three acceleration axes minus 1 *g*, with resulting negative values rounded to zero. Expressed in m*g* (milli-gravitational units). See [Chapter 4](chapter4_AccMetrics.html).
+
+### Epoch {#glossary-epoch}
+A fixed-length time window (default 5 seconds in GGIR) over which raw acceleration data are aggregated into summary metrics. All GGIR parts use the same epoch length for consistency. See [Chapter 4](chapter4_AccMetrics.html).
+
+---
+
+## F
+
+### Factory calibration {#glossary-factory-calibration}
+Sensor calibration performed by the manufacturer prior to shipping, using local gravitational acceleration as a reference. GGIR's auto-calibration refines (but does not replace) factory calibration. See [Chapter 3](chapter3_QualityAssessment.html).
+
+### Fragment {#glossary-fragment}
+In the context of behavioural fragmentation: a sequence of consecutive epochs belonging to the same behavioural class (e.g., a stretch of inactivity, or a stretch of physical activity). See [Chapter 14](chapter14_BehaviouralFragmentation.html).
+
+---
+
+## G
+
+### g (gravitational unit) {#glossary-g}
+The unit of acceleration used throughout GGIR. One *g* equals the mean gravitational acceleration at Earth's surface (~9.81 m/s²). Metric values are often expressed in m*g* (milli-*g*, i.e., 1/1000 of *g*).
+
+### Guider {#glossary-guider}
+A method used by GGIR to estimate the main sleep window each night. The guider defines a candidate time window within which sustained inactivity bouts are then assessed to determine the Sleep Period Time (SPT). Available guiders include sleeplog, HDCZA, HorAngle, L5+/−12, HLRB, NotWorn, MotionWare, and markerbutton. See [Chapter 9](chapter9_SleepFundamentalsGuiders.html).
+
+### Gini index {#glossary-gini}
+A fragmentation metric measuring inequality in the distribution of fragment durations. Calculated using the `ineq` R package. Requires at least 10 fragments. See [Chapter 14](chapter14_BehaviouralFragmentation.html).
+
+---
+
+## H
+
+### HASIB.algo {#glossary-hasib-algo}
+GGIR parameter that selects the Sustained Inactivity Bout (SIB) detection algorithm. Options include `"vanHees2015"` (default), `"Sadeh1994"`, `"ColeKripke1992"`, `"Galland2012"`, `"Oakley1997"`, `"NotWorn"`, and `"data"`. See [Chapter 8](chapter8_SleepFundamentalsSibs.html).
+
+### HASPT.algo {#glossary-haspt-algo}
+GGIR parameter that selects the guider algorithm for sleep window estimation. Options include `"HDCZA"` (default), `"HorAngle"`, `"L5+/-12"`, `"setwindow"`, `"HLRB"`, `"NotWorn"`, `"MotionWare"`, and `"markerbutton"`. See [Chapter 9](chapter9_SleepFundamentalsGuiders.html).
+
+### HDCZA {#glossary-hdcza}
+A guider algorithm for wrist-worn accelerometer data that identifies the longest period of limited postural change in a day as the candidate sleep window. First described by [van Hees et al. 2018](https://dx.doi.org/10.1038/s41598-018-31266-z). See [Chapter 9](chapter9_SleepFundamentalsGuiders.html).
+
+### HLRB (Heuristic Longest Rest Bout) {#glossary-hlrb}
+An experimental guider designed for devices that store count data, detecting the longest rest bout in the day as the candidate sleep window. See [Chapter 9](chapter9_SleepFundamentalsGuiders.html).
+
+### HorAngle {#glossary-horangle}
+An experimental guider for hip-worn accelerometers that identifies the candidate sleep window by looking for the longest period with a horizontal trunk orientation. See [Chapter 9](chapter9_SleepFundamentalsGuiders.html).
+
+---
+
+## I
+
+### Idle sleep mode {#glossary-idle-sleep-mode}
+An ActiGraph device feature that pauses data collection during sustained non-movement periods to conserve battery, creating time gaps in the recording. These gaps are treated as non-wear by GGIR. See [Chapter 3](chapter3_QualityAssessment.html).
+
+### Intensity gradient {#glossary-intensity-gradient}
+The slope of the log-log linear regression fitted to time spent in successive acceleration bins. Proposed by [Rowlands et al.](https://pubmed.ncbi.nlm.nih.gov/29360664/) as a summary of the physical activity intensity distribution. Enabled with parameter `iglevels`. See [Chapter 7](chapter7_DescribingDataWithoutKnowingSleep.html).
+
+### Interdaily Stability (IS) {#glossary-is}
+A circadian rhythm metric ranging from 0 to 1 measuring how constant an individual's daily activity routine is across days. Values close to 1 indicate a more stable routine. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+### Intradaily Variability (IV) {#glossary-iv}
+A circadian rhythm metric measuring the hour-by-hour variability in activity throughout a day. Values close to 2 indicate a fragmented rhythm. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+### Imputation (epoch-level) {#glossary-imputation}
+The replacement of invalid epoch values (e.g., from non-wear or clipping) with estimates based on the mean metric value from the same time of day on other valid days in the recording. See [Chapter 6](chapter6_DataImputation.html).
+
+---
+
+## L
+
+### LFENMO {#glossary-lfenmo}
+A low-pass filtered version of ENMO. The raw signal is filtered before computing the Euclidean Norm Minus One, suppressing high-frequency components. See [Chapter 4](chapter4_AccMetrics.html).
+
+### LIPA (Light Physical Activity) {#glossary-lipa}
+An intensity category for waking behaviour, defined as acceleration at or above the light threshold (`threshold.lig`) but below the moderate threshold (`threshold.mod`). See [Chapter 11](chapter11_DescribingDataCutPoints.html) and [Chapter 12](chapter12_TimeUseAnalysis.html).
+
+### L5 / M10 {#glossary-l5-m10}
+**L5**: the least active continuous 5-hour window in a day (average acceleration and timing). **M10**: the most active continuous 10-hour window in a day. Both are MXLX metrics controlled by parameter `winhr`. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+---
+
+## M
+
+### MAD (Mean Amplitude Deviation) {#glossary-mad}
+An acceleration metric computed as the absolute difference between the Euclidean norm and its epoch-level average. An alternative to ENMO that uses frequency-based gravity separation. See [Chapter 4](chapter4_AccMetrics.html).
+
+### Milestone data {#glossary-milestone-data}
+Intermediate RData files saved by each GGIR part (e.g., `meta/basic` for part 1, `meta/ms2.out` for part 2). They allow subsequent parts to resume without re-running earlier parts. See [Chapter 2](chapter2_Pipeline.html).
+
+### MVPA (Moderate-to-Vigorous Physical Activity) {#glossary-mvpa}
+The combination of moderate and vigorous physical activity intensity categories, defined by acceleration at or above the moderate threshold (`threshold.mod`). See [Chapter 11](chapter11_DescribingDataCutPoints.html).
+
+### MX metrics {#glossary-mx-metrics}
+Acceleration values corresponding to user-specified quantiles of the daily activity distribution, representing the minimum acceleration in the most active accumulated X minutes. Proposed by [Rowlands et al.](https://pubmed.ncbi.nlm.nih.gov/31808014/) Enabled with parameter `qlevels`. See [Chapter 7](chapter7_DescribingDataWithoutKnowingSleep.html).
+
+### MXLX {#glossary-mxlx}
+A family of circadian rhythm metrics that identify the most (MX) and least (LX) active continuous X-hour windows in a day. The window length is controlled by parameter `winhr`. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+---
+
+## N
+
+### Non-wear {#glossary-non-wear}
+Time periods during which the accelerometer is not worn by the participant. GGIR detects non-wear using the standard deviation and value range of the raw signal over 60-minute windows. Non-wear time is treated as invalid data. See [Chapter 3](chapter3_QualityAssessment.html).
+
+### NFrag / NFragPM {#glossary-nfrag}
+Fragmentation metrics. **NFrag** is the total number of fragments per behavioural class. **NFragPM** (Number of Fragments Per Minute) is the fragmentation index: total fragments divided by total duration. See [Chapter 14](chapter14_BehaviouralFragmentation.html).
+
+---
+
+## P
+
+### Parts (GGIR pipeline parts) {#glossary-parts}
+GGIR's computational pipeline is divided into six sequential parts (1–6): Part 1 loads raw data and computes metrics; Part 2 does quality assessment and basic description; Part 3 estimates rest periods; Part 4 labels sleep; Part 5 creates time-use summaries; Part 6 handles recording-spanning analyses. See [Chapter 2](chapter2_Pipeline.html).
+
+### phi {#glossary-phi}
+First-order autocorrelation from the AR(1) model applied to the acceleration time series shifted by one hour. A higher phi indicates a stronger day-to-day rhythm; phi near zero or negative indicates more fragmented behaviour. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+---
+
+## R
+
+### Raw accelerometer data {#glossary-raw-data}
+Acceleration data stored in gravitational units (*g*) at the native sampling rate of the sensor (e.g., 30–100 Hz), as opposed to pre-aggregated epoch-level data (counts). GGIR is primarily designed for raw data. See [Chapter 1](chapter1_WhatIsGGIR.html).
+
+### Recording {#glossary-recording}
+A continuous period of accelerometer data collection for one participant (or a set of appended periods treated as one). GGIR processes one recording per file (or per set of files when appending). See [Chapter 1](chapter1_WhatIsGGIR.html) and [Chapter 2](chapter2_Pipeline.html).
+
+---
+
+## S
+
+### Sampling rate {#glossary-sampling-rate}
+The number of data points recorded per second by the accelerometer (unit: Hertz, Hz). Common rates are 25, 30, 50, 80, 100 Hz. GGIR accounts for minor variations in sampling rate through interpolation. See [Chapter 3](chapter3_QualityAssessment.html).
+
+### SIB (Sustained Inactivity Bout) {#glossary-sib}
+A continuous period of limited body movement detected from the acceleration signal, used as a proxy for sleep. The term is preferred over "sleep" because accelerometers cannot directly measure sleep physiology. See [Chapter 8](chapter8_SleepFundamentalsSibs.html).
+
+### Sleep log (sleeplog) {#glossary-sleeplog}
+A self-reported diary in which participants record their sleep onset and wake-up times each day. When available, GGIR uses the sleep log as the preferred guider. Two formats are supported: basic and advanced. See [Chapter 9](chapter9_SleepFundamentalsGuiders.html).
+
+### Sleep Period Time window (SPT) {#glossary-spt}
+The time window from the start of the first SIB to the end of the last SIB within the guider window, representing the main daily sleep episode. See [Chapter 10](chapter10_SleepAnalysis.html).
+
+### Sleep Regularity Index (SRI) {#glossary-sri}
+A metric quantifying the day-to-day consistency of sleep timing. Documented separately at [SleepRegularityIndex](SleepRegularityIndex.html). See [Chapter 10](chapter10_SleepAnalysis.html).
+
+### SPT window – see [SPT](#glossary-spt)
+
+### SSP (Self-Similarity Parameter) {#glossary-ssp}
+The scaling exponent derived from Detrended Fluctuation Analysis. GGIR splits SSP into short-term (SSP_short, time scales ≤ 90 min) and long-term (SSP_long, 120–600 min) components to separate general mobility from circadian patterning. See [Chapter 13](chapter13_CircadianRhythm.html).
+
+---
+
+## T
+
+### Time gap {#glossary-time-gap}
+A missing or unreadable segment in the raw accelerometer data, caused by corrupted data blocks (Axivity, Parmay Matrix) or idle sleep mode (ActiGraph). GGIR detects and imputes time gaps. See [Chapter 3](chapter3_QualityAssessment.html).
+
+### Time in Bed (TimeInBed) {#glossary-timeinbed}
+The period from going to bed (lights out / in-bed time) to getting out of bed. When a sleep log specifies time in bed rather than SPT, set `sleepwindowType = "TimeInBed"` to enable estimation of sleep latency and sleep efficiency. See [Chapter 10](chapter10_SleepAnalysis.html).
+
+### Transition probability (TP) {#glossary-tp}
+A fragmentation metric expressing the probability of switching from one behavioural class to another (e.g., from inactivity to physical activity: IN2PA, or from physical activity to inactivity: PA2IN). See [Chapter 14](chapter14_BehaviouralFragmentation.html).
+
+---
+
+## V
+
+### vanHees2015 {#glossary-vanhees2015}
+The default SIB detection algorithm in GGIR. It identifies periods where the z-angle of the sensor does not change by more than 5 degrees for at least 5 consecutive minutes. First described in a [2015 article](https://doi.org/10.1371/journal.pone.0142533). See [Chapter 8](chapter8_SleepFundamentalsSibs.html).
+
+### Valid day {#glossary-valid-day}
+A calendar day that contains at least a minimum number of valid hours as specified with parameter `includedaycrit`. Only valid days are included in GGIR part 2 summary statistics. See [Chapter 7](chapter7_DescribingDataWithoutKnowingSleep.html).
+
+---
+
+## W
+
+### WASO (Wake After Sleep Onset) {#glossary-waso}
+Time spent awake (not classified as SIB) within the Sleep Period Time window, after the initial sleep onset. See [Chapter 10](chapter10_SleepAnalysis.html).
+
+### windowsizes {#glossary-windowsizes}
+A GGIR parameter vector with three values controlling time resolution: (1) epoch length (default 5 s), (2) non-wear detection window step size (default 900 s = 15 min), (3) non-wear detection window length (default 3600 s = 60 min). See [Chapter 3](chapter3_QualityAssessment.html) and [Chapter 4](chapter4_AccMetrics.html).
+
+---
+
+## Z
+
+### z-angle {#glossary-z-angle}
+The angle of the sensor's z-axis relative to the vertical, derived from the raw acceleration signal. Used by the `vanHees2015` SIB algorithm: limited change in z-angle over time indicates sustained inactivity. See [Chapter 8](chapter8_SleepFundamentalsSibs.html).
+
+### Zero-crossing count {#glossary-zero-crossing}
+An acceleration metric (zcx, zcy, zcz) that counts the number of times the band-pass filtered signal crosses zero per epoch. An attempt to replicate the Motionlogger Actigraph count used in 1990s sleep algorithms (e.g., Sadeh1994, ColeKripke1992). See [Chapter 4](chapter4_AccMetrics.html).
diff --git a/vignettes/chapter0_Contributing.Rmd b/vignettes/chapter0_Contributing.Rmd
index a03bcf780..0084648fc 100644
--- a/vignettes/chapter0_Contributing.Rmd
+++ b/vignettes/chapter0_Contributing.Rmd
@@ -20,6 +20,22 @@ editor_options:
knitr::opts_chunk$set(echo = TRUE)
```
+::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"}
+
+**⏱ Reading time:** ~5 min
+
+**What you will find here**
+
+- How to contribute code, documentation, or funding to GGIR
+- How to report bugs and questions publicly
+- Community initiatives complementing GGIR
+
+**Prerequisites**
+
+- Familiarity with GitHub is helpful but not required for non-code contributions.
+
+
+
## If you have coding skills…
@@ -35,3 +51,109 @@ You might not have the coding skills to contribute to the code base of GGIR, and
- **Proofread the GGIR documentation** and inform us if you miss something or if you found it difficult to follow.
- **Take independent initiatives to complement our efforts**. For example, Prof. Stuart Fairclough created a [series of GGIR video tutorials](https://www.youtube.com/watch?v=AbHgJYTyuiA), Wei Guo and colleagues created the R package [mMARCH.AC](https://doi.org/10.32614/CRAN.package.mMARCH.AC) to post-process GGIR output as described in the supporting [journal article](https://doi.org/10.1123/jmpb.2022-0018), and maybe there are other initiatives we are not aware of. To avoid duplicated work and to support each other where needed, please communicate about your initiatives via the [GGIR GitHub discussion page](https://github.com/wadpac/GGIR/discussions) and/or with GGIR maintainer [Vincent van Hees](https://www.accelting.com/).
+---
+
+::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"}
+
+### Summary
+
+There are many ways to contribute to GGIR – code, documentation, funding, outreach, and reporting. Every contribution helps sustain this free software.
+
+### What to read next
+
+➡ [Chapter 1: What is GGIR?](chapter1_WhatIsGGIR.html)
+
+### Related materials
+
+- 📹 [Stuart Fairclough: GGIR video tutorial playlist](https://www.youtube.com/watch?v=AbHgJYTyuiA)
+- 📄 [GGIR contributing guidelines (GitHub)](https://github.com/wadpac/GGIR/blob/main/CONTRIBUTING.md)
+- 🔗 [GGIR GitHub Discussions](https://github.com/wadpac/GGIR/discussions)
+
+
+
+
+
+
diff --git a/vignettes/chapter0_GetStarted.Rmd b/vignettes/chapter0_GetStarted.Rmd
index 2baee874c..a154d2cc0 100644
--- a/vignettes/chapter0_GetStarted.Rmd
+++ b/vignettes/chapter0_GetStarted.Rmd
@@ -20,6 +20,23 @@ editor_options:
knitr::opts_chunk$set(echo = TRUE)
```
+::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"}
+
+**⏱ Reading time:** ~5 min
+
+**What you will find here**
+
+- A quick orientation to how GGIR is used
+- The minimum GGIR call to get your first analysis running
+- Links to installation, support, and training materials
+
+**Prerequisites**
+
+- R and RStudio installed – see [Installation](chapter0_Installation.html)
+
+
+
+
If you arrive here with the expectation to find a quick instruction to run and use GGIR for your research then we have to disappoint you. The number of GGIR functionalities is vast and mastering them requires a time investment. In this section we will only provide you with a brief introduction on how GGIR is used. However, to fully benefit from all the functionality GGIR offers we recommend that you read the chapters on this website.
The first step to get started is to install R, Rstudio, and GGIR as discussed [here](https://wadpac.github.io/GGIR/articles/chapter0_Installation.html).
@@ -56,3 +73,113 @@ This command will let GGIR run with all its default settings (parameters), so th
- [Install R and GGIR](https://wadpac.github.io/GGIR/articles/chapter0_Installation.html)
- [Get support](https://wadpac.github.io/GGIR/articles/chapter0_Support.html)
- [Suitable file formats for GGIR](https://wadpac.github.io/GGIR/articles/chapter2_Pipeline.html#input-files)
+
+---
+
+::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"}
+
+### Summary
+
+You have seen the minimal GGIR call and where to go next. The documentation chapters on this site will guide you through tailoring the analysis to your study design.
+
+### What to read next
+
+➡ [Chapter 1: What is GGIR?](chapter1_WhatIsGGIR.html)
+
+### Related materials
+
+- 📄 [GGIR Parameters reference](GGIRParameters.html)
+- 📄 [Cookbook: common recipes](Cookbook.html)
+
+
Video tutorial by Prof. Stuart Fairclough
+ + +::: + + + diff --git a/vignettes/chapter0_Installation.Rmd b/vignettes/chapter0_Installation.Rmd index 57f74ba23..a6a23103f 100644 --- a/vignettes/chapter0_Installation.Rmd +++ b/vignettes/chapter0_Installation.Rmd @@ -20,6 +20,19 @@ editor_options: knitr::opts_chunk$set(echo = TRUE) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~5 min + +**What you will find here** + +- Step-by-step instructions to install R, RStudio, and GGIR +- How to install optional dependencies for specific data formats +- How to install older GGIR versions for reproducibility + + + + ## Install R and RStudio - [Download and install R](https://cran.r-project.org/) @@ -81,3 +94,108 @@ require(remotes) install_github("wadpac/GGIR", ref = "2.4-0") ``` To see which releases are available on CRAN check out: https://github.com/wadpac/GGIR/releases. + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +You have installed R, RStudio, and GGIR (and any optional packages you need). You are ready to run your first analysis. + +### What to read next + +➡ [Get started: your first GGIR run](chapter0_GetStarted.html) + +### Related materials + +- 📄 [Get support](chapter0_Support.html) +- 📄 [GGIR release history on GitHub](https://github.com/wadpac/GGIR/releases) + +::: + + + diff --git a/vignettes/chapter0_Support.Rmd b/vignettes/chapter0_Support.Rmd index a37dea5e7..08d2bcb5a 100644 --- a/vignettes/chapter0_Support.Rmd +++ b/vignettes/chapter0_Support.Rmd @@ -18,6 +18,22 @@ editor_options: The website in front of you is the main source of GGIR documentation, which we recommend as starting point for new users. +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~5 min + +**What you will find here** + +- Where and how to post questions to get the fastest response +- How to report bugs with a reproducible example +- Pointers to commercial training and dedicated support options + +**Prerequisites** + +- You have GGIR installed – see [Installation](chapter0_Installation.html) + + + ## Questions and problems Asking questions is valuable as they help us understand the challenges you run @@ -70,4 +86,108 @@ Also of interest may be the brief [free R introduction tutorial](https://www.acc ## Dedicated support -If you need dedicated support with the use of GGIR, want GGIR to be modified or enhanced to your needs, then please contact [Vincent van Hees](https://www.accelting.com/). \ No newline at end of file +If you need dedicated support with the use of GGIR, want GGIR to be modified or enhanced to your needs, then please contact [Vincent van Hees](https://www.accelting.com/). + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +You know where to post questions (GitHub Discussions), how to file reproducible bug reports (Issue Tracker), and who to contact for dedicated support. + +### What to read next + +➡ [Contributing to GGIR](chapter0_Contributing.html) + +### Related materials + +- 🔗 [GGIR GitHub Discussions](https://github.com/wadpac/GGIR/discussions) +- 🔗 [GGIR Issue Tracker](https://github.com/wadpac/GGIR/issues) + + + + diff --git a/vignettes/chapter10_SleepAnalysis.Rmd b/vignettes/chapter10_SleepAnalysis.Rmd index b3a528d52..71083e047 100644 --- a/vignettes/chapter10_SleepAnalysis.Rmd +++ b/vignettes/chapter10_SleepAnalysis.Rmd @@ -14,13 +14,34 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~15 min | **Chapter:** 10 of 14 + +**What you will learn** + +- How GGIR combines SIBs and guider windows to define the Sleep Period Time (SPT) +- The difference between SPT and Time in Bed, and when to use each +- How to use the cleaningcode to assess and quality-control night-level results +- The structure of part 4 output files and how cleaned vs. full results differ + +**Prerequisites** + +- Read the previous chapters: [Chapter 8: SIB Detection](chapter8_SleepFundamentalsSibs.html) and [Chapter 9: Guiders](chapter9_SleepFundamentalsGuiders.html) + + +**Key terms:** SPT (Sleep Period Time window), TimeInBed, cleaningcode, WASO, SRI (Sleep Regularity Index), guider, SIB +– see the [full Glossary](Glossary.html) for all definitions. + +::: + Sleep analysis in GGIR comes at three stages: 1. The discrimination of sustained inactivity and wakefulness periods, discussed in chapter 8. 2. Identification of time windows that guide the eventual sleep detection, as discussed chapter 9. -3. Assess overlap between the windows identified in step 1 and 2, which we use to define the Sleep Period Time window (SPT) or the time in bed window (TimeInBed) as discussed in this chapter. +3. Assess overlap between the windows identified in step 1 and 2, which we use to define the Sleep Period Time window (SPT) or the time in bed window (TimeInBed) as discussed in this chapter. In the previous two chapters you learnt about the first two steps in this chapter we will discuss the last step. @@ -28,7 +49,7 @@ In the previous two chapters you learnt about the first two steps in this chapte Here we have two scenarios: -1. If the guider reflects an approximation of the Sleep Period Time window, which is the window between sleep onset and waking up at the end of the night, then any SIB that fully or partially overlaps with the guider is considered sleep. +1. If the guider reflects an approximation of the Sleep Period Time window, which is the window between sleep onset and waking up at the end of the night, then any SIB that fully or partially overlaps with the guider is considered sleep. 2. If a guider reflects the Time in Bed then any SIB that fully overlaps with the guider is considered sleep. In this scenario sleep latency and sleep efficiency can be estimated and are included in the GGIR part 4 report. @@ -46,7 +67,7 @@ want SIB to only be counted as sleep if they fully overlap with TimeInBed but pr ### Cleaningcode -To monitor possible problems with the sleep detection, the output variable **cleaningcode** is stored per night. Cleaningcode per night (noon-noon or 6pm-6pm as described above) can have one of the following values: +To monitor possible problems with the sleep detection, the output variable **cleaningcode** is stored per night. Cleaningcode per night (noon-noon or 6pm-6pm as described above) can have one of the following values: - 0: sleep log available and SPT is identified. @@ -82,9 +103,9 @@ Among these we assume that most are intuitive: - Sleep duration during SPT, which is the accumulate sleep time (sustained inactivity bouts classified as sleep) -- WASO, the time spent in wakefulness after sleep onset. However, there are possible a few concepts that need clarifications: +- WASO, the time spent in wakefulness after sleep onset. However, there are possible a few concepts that need clarifications: -### Sleep Regularity Index (SRI) +### Sleep Regularity Index (SRI) A discussion of the Sleep Regularity Index has been moved toVideo tutorial by Prof. Stuart Fairclough
+ +- 📹 [GGIR tutorial playlist by Prof. Stuart Fairclough](https://www.youtube.com/watch?v=AbHgJYTyuiA) + +::: + + + diff --git a/vignettes/chapter13_CircadianRhythm.Rmd b/vignettes/chapter13_CircadianRhythm.Rmd index c0ecfd411..e861db0a3 100644 --- a/vignettes/chapter13_CircadianRhythm.Rmd +++ b/vignettes/chapter13_CircadianRhythm.Rmd @@ -14,7 +14,28 @@ knitr::opts_chunk$set( ) ``` -Circadian rhythm are the physical, mental, and behavioral changes an organism experiences over a 24-hour cycle. GGIR facilitates a number of techniques to quantify the movement-component of circadian rhythms as discussed in this chapter. +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~20 min | **Chapter:** 13 of 14 + +**What you will learn** + +- The circadian rhythm metrics available in GGIR (MXLX, Cosinor, IS, IV, phi, DFA/SSP, ABI) +- The difference between part 2 and part 6 implementations +- How to enable and interpret circadian rhythm outputs + +**Prerequisites** + +- Read the previous chapter: [Chapter 12: Time-use Analysis](chapter12_TimeUseAnalysis.html) +- 📄 [Danilevicz et al. 2024: IS/IV/phi/DFA paper](https://doi.org/10.1186/s12874-024-02255-w) + + +**Key terms:** circadian rhythm, MXLX, L5 / M10, IS (Interdaily Stability), IV (Intradaily Variability), phi, DFA (Detrended Fluctuation Analysis), SSP (Self-Similarity Parameter), ABI (Activity Balance Index), acrophase / acrotime +– see the [full Glossary](Glossary.html) for all definitions. + +::: + +Circadian rhythm are the physical, mental, and behavioral changes an organism experiences over a 24-hour cycle. GGIR facilitates a number of techniques to quantify the movement-component of circadian rhythms as discussed in this chapter. Most of the techniques are applied in both GGIR part 2 and 6. The main differences between these implementations are: @@ -23,7 +44,7 @@ Most of the techniques are applied in both GGIR part 2 and 6. The main differenc As a result, when your intention is to compare physical activity or sleep estimates derived in GGIR, part 6 estimates ensure that the same days and time points are used as in the other parts of GGIR. Whereas, part 2 does not attempt to do so. -Further, part 6 offers a few additional circadian rhythm estimates such as DFA (discussed below), and when fragmentation analysis is turned on (see parameter `frag.metrics` as discussed in the [next chapter](https://wadpac.github.io/GGIR/articles/chapter14_BehaviouralFragmentation.html)) activity and sleep fragmentation are also estimated. +Further, part 6 offers a few additional circadian rhythm estimates such as DFA (discussed below), and when fragmentation analysis is turned on (see parameter `frag.metrics` as discussed in the [next chapter](https://wadpac.github.io/GGIR/articles/chapter14_BehaviouralFragmentation.html)) activity and sleep fragmentation are also estimated. ## Controlling which circadian rhythm estimates are derived @@ -31,7 +52,7 @@ Cosinor, IV, IS, and phi as discussed below are not derived by default. To activ ## MXLX -MXLX looks for the continuous least (LX) and most (MX) active X hour window in a day, where X is defined by parameter `winhr`. For both LX and MX, GGIR calculates the average acceleration, the start time, and if argument `iglevels` is specified also the intensity gradient. If parameter `winhr` is a vector then MX and LX are derived for each value in the vector. +MXLX looks for the continuous least (LX) and most (MX) active X hour window in a day, where X is defined by parameter `winhr`. For both LX and MX, GGIR calculates the average acceleration, the start time, and if argument `iglevels` is specified also the intensity gradient. If parameter `winhr` is a vector then MX and LX are derived for each value in the vector. Within GGIR part 2 MXLX is calculated per calendar day and, if argument `qwindow` is specified, per segment of the day. Within GGIR part 6 MXLX is calculated per [window](https://wadpac.github.io/GGIR/articles/chapter12_TimeUseAnalysis.html#defining-the-time-windows). If used in combination with the GENEActiv or Axivity accelerometer brands, LUX estimates per LX and MX are also included in GGIR part 6 csv reports. @@ -50,12 +71,12 @@ The implementation of Cosinor and Extended Cosinor in GGIR is as follows: 5. GGIR looks for the first valid data point in the time series and then selects the maximum integer number of recording days following this data point. 6. If Day Saving Time occurs in the time series then duplicated timestamps when clock moves backward are ignored and missing timestamps when clock moves forward are inserted as missing values. 7. Cosinor models are fitted using functions `ActCosinor` and `ActExtendCosinor` from R package [ActCR](https://CRAN.R-project.org/package=ActCR). Here, `ActExtendCosinor` uses an anti-logistic function for the transformation. -8. The time offset between the start of the time series as used and the following midnight is used to reverse offset the ActCR results, to ensure that acrophase and acrotime can be interpreted relative to midnight. +8. The time offset between the start of the time series as used and the following midnight is used to reverse offset the ActCR results, to ensure that acrophase and acrotime can be interpreted relative to midnight. 9. Time series corresponding to the fitted models are stored inside the part 2 milestone data as stored in output subfolder `meta/ms2.out` to facilitate visual inspection. For the moment they are not used in any GGIR visualisation, but you may want to look them up and try to plot them yourself. They are stored in object `SUM$cosinor_ts`. ## Intradaily Variability (IV) and Interdaily Stability (IS) -IV and IS were first proposed by [Witting W et al. 1990](https://doi.org/10.1016/0006-3223(90)90523-5) and [van Someren EJ, et al. 1996](https://doi.org/10.1016/0006-3223(95)00370-3). +IV and IS were first proposed by [Witting W et al. 1990](https://doi.org/10.1016/0006-3223(90)90523-5) and [van Someren EJ, et al. 1996](https://doi.org/10.1016/0006-3223(95)00370-3). - IS measures how constant is the routine of activity over several days and ranges from 0 to 1, values close to 1 indicate more constant routine. @@ -72,13 +93,13 @@ IS is sometimes used as a measure of behavioural robustness when conducting Cosi ## phi -Phi indicates how correlated the multi-day acceleration time series is with itself when there is an hour shift, also known as first-order auto-correlation from the first-order autoregressive model AR(1). A higher phi value indicates a higher autocorrelation, while a phi close to zero or even negative indicates more fragmented behavior. For a detailed discussion of phi see [Dickey and Fuller (1979)](https://doi.org/10.1080/01621459.1979.10482531) and [Danilevicz et al. 2024](https://doi.org/10.1186/s12874-024-02255-w). Phi is calculated by default in GGIR part 2 and in part 6 only when parameter `part6CR` is set to TRUE. +Phi indicates how correlated the multi-day acceleration time series is with itself when there is an hour shift, also known as first-order auto-correlation from the first-order autoregressive model AR(1). A higher phi value indicates a higher autocorrelation, while a phi close to zero or even negative indicates more fragmented behavior. For a detailed discussion of phi see [Dickey and Fuller (1979)](https://doi.org/10.1080/01621459.1979.10482531) and [Danilevicz et al. 2024](https://doi.org/10.1186/s12874-024-02255-w). Phi is calculated by default in GGIR part 2 and in part 6 only when parameter `part6CR` is set to TRUE. ## Detrended fluctuation analysis (DFA) ### Self-Similarity Parameter (SSP) -The self-similarity parameter (SSP) is also known as scaling exponent or alpha. The overall SSP is a real number between zero and two. Values in the range (0, 1) indicate stationary motion behaviour. Values int he range (1, 2 indicate non-stationary motion behaviour. For details see [Mesquita et al 2020](https://doi.org/10.1093/bioinformatics/btaa955) and [Danilevicz et al. 2024](https://doi.org/10.1186/s12874-024-02255-w). +The self-similarity parameter (SSP) is also known as scaling exponent or alpha. The overall SSP is a real number between zero and two. Values in the range (0, 1) indicate stationary motion behaviour. Values int he range (1, 2 indicate non-stationary motion behaviour. For details see [Mesquita et al 2020](https://doi.org/10.1093/bioinformatics/btaa955) and [Danilevicz et al. 2024](https://doi.org/10.1186/s12874-024-02255-w). In human motor activity, researchers often observe that the scaling behaviour is not uniform across all time scales but exhibits a "crossover point" around 1.5 to 2 hours. To capture distinct biological mechanisms, GGIR splits the DFA into two distinct time-scale regions: @@ -92,7 +113,7 @@ Additionally, the output includes the difference between the short-term and long ### Activity Balance Index (ABI) -The Activity Balance Index (ABI) was introduced by [Danilevicz et al. 2024](https://doi.org/10.1186/s12874-024-02255-w) and is a transformation of SSP. ABI measures how the activity over the observed period is balanced, higher values reflect a more balanced pattern of activity. ABI is a real number between zero and one and calculated from the acceleration metric time series directly without the need for cut-points. A higher ABI reflects a more balanced pattern of activity. +The Activity Balance Index (ABI) was introduced by [Danilevicz et al. 2024](https://doi.org/10.1186/s12874-024-02255-w) and is a transformation of SSP. ABI measures how the activity over the observed period is balanced, higher values reflect a more balanced pattern of activity. ABI is a real number between zero and one and calculated from the acceleration metric time series directly without the need for cut-points. A higher ABI reflects a more balanced pattern of activity. In addition to the overall ABI (**ABI_overall**), GGIR calculates **ABI_short** and **ABI_long**, which are the Activity Balance Indices transformed from the short-term (SSP_short) and long-term (SSP2) scaling exponents, respectively. This allows for a direct evaluation of behavioural balance at both the general mobility and circadian levels. @@ -109,3 +130,122 @@ A discussion of the Sleep Regularity Index can be found inVideo tutorial by Prof. Stuart Fairclough
+ +- 📹 [GGIR tutorial playlist by Prof. Stuart Fairclough](https://www.youtube.com/watch?v=AbHgJYTyuiA) + +::: + + + diff --git a/vignettes/chapter2_Pipeline.Rmd b/vignettes/chapter2_Pipeline.Rmd index 6e8d1bbe4..36497a5ca 100644 --- a/vignettes/chapter2_Pipeline.Rmd +++ b/vignettes/chapter2_Pipeline.Rmd @@ -14,6 +14,27 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~25 min | **Chapter:** 2 of 14 + +**What you will learn** + +- How the GGIR pipeline is structured into six parts and what each part does +- How to invoke GGIR with a single function call and configure it with parameters +- How milestone data enables efficient, resumable processing across multiple files +- How to work with externally derived epoch-level data + +**Prerequisites** + +- Read the previous chapter: [Chapter 1: What is GGIR?](chapter1_WhatIsGGIR.html) + + +**Key terms:** milestone data, epoch, raw accelerometer data, Parts (GGIR pipeline), non-wear +– see the [full Glossary](Glossary.html) for all definitions. + +::: + As explained in chapter 1, GGIR offers a vast amount of functionality. If you arrive here with the expectation to find a quick instruction to run and use GGIR then we have to disappoint you. Learning to use GGIR requires some time investment. In this chapter we start with explaining the GGIR pipeline, which you could see as the high level structure of GGIR. Understanding this structure will help you navigate the following chapters. ## The GGIR function @@ -51,7 +72,7 @@ The specific order and content of the parts is a result of how GGIR evolved over #### Milestone data -Each part, when run, stores its output in an R-data file that has `.RData` as its extension, which we refer to as the milestone data. As user, you are unlikely to ever need to interact directly with the milestone data files because all relevant output for you is stored in csv, png and pdf files in the output folder `results`. +Each part, when run, stores its output in an R-data file that has `.RData` as its extension, which we refer to as the milestone data. As user, you are unlikely to ever need to interact directly with the milestone data files because all relevant output for you is stored in csv, png and pdf files in the output folder `results`. The milestone files are read by the next GGIR part. The advantage of this design is that it offers internal modularity. For example, we can run part 1 now and continue with part 2 another time without having to repeat part 1 again. So, this design eases re-processing and is also helpful when developing and testing the GGIR code. @@ -74,7 +95,7 @@ The milestone files are potentially useful for you for the following reasons: The parameters of all GGIR package functions can be used as parameter to the GGIR function. The parameters are internally grouped thematically, independently of the six parts they are used in: - **params_rawdata:** parameters related to handling the raw data such as resampling or calibrating. -- **params_metrics:** parameters related to aggregating the raw data to epoch level summary measures (metrics). +- **params_metrics:** parameters related to aggregating the raw data to epoch level summary measures (metrics). - **params_sleep:** parameters related to sleep detection. - **params_phyact:** parameters related to physical (in)activity. - **params_247:** parameters related to 24/7 behaviours that do not fall into the typical sleep or physical (in)activity research category such as measures of circadian rhythm or more 24 hour data description techniques. @@ -203,7 +224,7 @@ By default GGIR assumes that the data is raw as discussed in chapter 1. However, See [GGIR CookBook](https://wadpac.github.io/GGIR/articles/Cookbook.html) for example recipes for working with these externally derived epoch-level data. -To process these files, GGIR loads their content and saves it as GGIR part 1 milestone data, essentially fooling the rest of GGIR to think that GGIR part 1 created them based on raw data input. As will be discussed in chapter 3, GGIR does non-wear detection in two steps: The first step is done in part 1 and the second step is done in part 2. In relation to externally derived epoch data non-wear is detected by looking for consecutive zeros of one hour (default) expanded by all time point for which data is missing. However, the consecutive zero approach is not used for all brands: +To process these files, GGIR loads their content and saves it as GGIR part 1 milestone data, essentially fooling the rest of GGIR to think that GGIR part 1 created them based on raw data input. As will be discussed in chapter 3, GGIR does non-wear detection in two steps: The first step is done in part 1 and the second step is done in part 2. In relation to externally derived epoch data non-wear is detected by looking for consecutive zeros of one hour (default) expanded by all time point for which data is missing. However, the consecutive zero approach is not used for all brands: - For UK Biobank csv data the non-wear detection is available in the data, which is what GGIR uses. - For Fitbit and Sensewear we use missingness in data as an indicator of nonwear, and any one hour time window with a standard deviation in calorie or METS values less than 0.0001 and an average value below 2. @@ -369,7 +390,7 @@ Some tips on how you may be able to address this: - Make sure your machine has 8GB or more RAM memory. Using GGIR on old machines with only 4GB is known to be slow. However, total memory is not the only bottle neck. Also consider the number of processes (threads) your CPU can run relative to the amount of memory. Ending up with 2GB per process seems a good target. It can be helpful to turn off parallel processing with `do.parallel = FALSE`. - Avoid doing other computational activities on your machine while running GGIR. For example, if you use DropBox or OneDrive make sure they do not sync while you are running GGIR. It is probably best not to use the machine when using GGIR to process large datasets. Make sure the machine is configured not to automatically turn off after X hours as that would terminate GGIR. Further, you may want to configure the machine to not fall asleep as this pauses GGIR. - Lower value of parameter `maxNcores` which by default uses the number of available cores derived with command `parallel::detectCores()` minus 1. This might in some cases be too demanding for your operating system. -- Reduce the amount of data GGIR loads in memory with parameter `chunksize`, which can be useful on machines with limited memory or when processing many files in parallel. A `chunksize` value of 0.2 will make GGIR load the data in chunks of only 20% of the size relative to the chunks it loads by default, which is approximately 12 hours of data for the auto-calibration routine and 24 hours of data for the calculation of signal metrics. +- Reduce the amount of data GGIR loads in memory with parameter `chunksize`, which can be useful on machines with limited memory or when processing many files in parallel. A `chunksize` value of 0.2 will make GGIR load the data in chunks of only 20% of the size relative to the chunks it loads by default, which is approximately 12 hours of data for the auto-calibration routine and 24 hours of data for the calculation of signal metrics. ## GGIR output @@ -427,3 +448,126 @@ See parameter [visualreport](https://wadpac.github.io/GGIR/articles/GGIRParamete : A detailed discussion of each output can be found in the other chapters. +## Minimal example + +```r +library(GGIR) +GGIR( + datadir = "C:/mystudy/mydata", # folder with accelerometer files + outputdir = "D:/myresults", # where GGIR saves all output + do.report = c(2, 4, 5) # generate summary reports for parts 2, 4, 5 +) +``` + +This single call runs all six pipeline parts in sequence and saves milestone data so that individual parts can be re-run without restarting from scratch. + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +The GGIR pipeline consists of six sequential parts. A single `GGIR()` call with at minimum `datadir` and `outputdir` runs all parts and saves intermediate milestone data for each recording. Parameters are passed directly to the `GGIR()` function or via a `config.csv` file. + +### What to read next + +➡ [Chapter 3: Data Quality Assurance](chapter3_QualityAssessment.html) + +### Related materials + +- 📄 [GGIR Parameters reference](GGIRParameters.html) +- 📄 [GGIR Output reference](GGIRoutput.html) +Video tutorial by Prof. Stuart Fairclough
+ +- 📹 [GGIR tutorial playlist by Prof. Stuart Fairclough](https://www.youtube.com/watch?v=AbHgJYTyuiA) + +::: + + + diff --git a/vignettes/chapter3_QualityAssessment.Rmd b/vignettes/chapter3_QualityAssessment.Rmd index 4cb2ef83c..267bf642c 100644 --- a/vignettes/chapter3_QualityAssessment.Rmd +++ b/vignettes/chapter3_QualityAssessment.Rmd @@ -14,13 +14,33 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~20 min | **Chapter:** 3 of 14 + +**What you will learn** + +- How GGIR detects and imputes time gaps in raw data files +- How auto-calibration corrects sensor errors using free-living data +- How GGIR detects non-wear and clipping, and what happens to those periods + +**Prerequisites** + +- Read the previous chapter: [Chapter 2: The GGIR pipeline](chapter2_Pipeline.html) + + +**Key terms:** auto-calibration, non-wear, clipping, dynamic range, time gap, sampling rate, factory calibration, windowsizes +– see the [full Glossary](Glossary.html) for all definitions. + +::: + Data quality assurance is an important part of GGIR. GGIR undertakes several key tasks aimed at evaluating, and, where possible, enhancing the quality of the data, as well as documenting what was done. These tasks are explained in this chapter. ## Time gaps identification and imputation Accelerometer data stored in binary format (e.g. .bin or .cwa) is typically structured in data blocks. Each data block has a header at the top and a constant number of data points per block, usually the equivalent of a few seconds of data. For the Axivity accelerometer with data stored in '.cwa' file format and for the Parmay Matrix sensor with data stored in '.bin' or '.BIN' format those blocks can, on rare occasions, be corrupted and unreadable, therefore creating a gap in the information recorded. -For the ActiGraph accelerometer, but also some other sensor brands that export data in ‘csv’ file format, it is possible that the recording stops at certain time when it is not moved for a while and starts recording after some time, therefore creating a time gap. +For the ActiGraph accelerometer, but also some other sensor brands that export data in ‘csv’ file format, it is possible that the recording stops at certain time when it is not moved for a while and starts recording after some time, therefore creating a time gap. GGIR has been developed to efficiently identify and manage these time gaps. @@ -28,7 +48,7 @@ GGIR has been developed to efficiently identify and manage these time gaps. Although this is not expected to occur often, Axivity cwa and Parmay Matrix bin/BIN data can come with faulty data blocks. By 'faulty' we mean that the data in the block is not interpretable. For example, faulty blocks may occur when the device in recording mode is connected to a computer with a USB cable. To address this, the R package `GGIRread`, as used by GGIR, identifies these faulty blocks and imputes them by the last recorded non-faulty acceleration value normalised to 1 *g* (*g* is the unit for gravitational acceleration). In the case that no previous non-faulty value is found, then acceleration is imputed by 0, 0, and 1 for x, y, and z axis, respectively. -The sampling rate of an accelerometer refers to the number of data points recorded and stored per second. Axivity and Parmay Matrix devices are expected by design to have a slightly variable sampling rate over time, which is accounted for by interpolating the data after it is loaded into R. For example, the data may have been collected at 99.7 Hertz for one block, and the interpolation technique will then interpolate the data such that it is 100 Hertz. The interpolation happens inside the R package `GGIRread`. The exact technique used for the interpolation is set by parameter `interpolationType` and uses linear interpolation by default (`interpolationType = 1`), but you can also set it to nearest neighbour interpolation (`interpolationType = 2`). As a quality assurance, `GGIRread` keeps track of the variation in sampling rate per data block and automatically imputes blocks (smallest segment of data in a cwa file, typically a few seconds long) where the sampling rate deviates by more than 10% from the expected sampling rate. The imputation technique is the same as for the time gaps as detailed earlier in this section. If you are unhappy with the 10% threshold then you have the possibility of changing this percentage with the parameter `frequency_tol`. Biased sampling rates of this kind are expected to be extremely rare and are not expected to affect normal research conditions, but we nonetheless like to be able to account for them. +The sampling rate of an accelerometer refers to the number of data points recorded and stored per second. Axivity and Parmay Matrix devices are expected by design to have a slightly variable sampling rate over time, which is accounted for by interpolating the data after it is loaded into R. For example, the data may have been collected at 99.7 Hertz for one block, and the interpolation technique will then interpolate the data such that it is 100 Hertz. The interpolation happens inside the R package `GGIRread`. The exact technique used for the interpolation is set by parameter `interpolationType` and uses linear interpolation by default (`interpolationType = 1`), but you can also set it to nearest neighbour interpolation (`interpolationType = 2`). As a quality assurance, `GGIRread` keeps track of the variation in sampling rate per data block and automatically imputes blocks (smallest segment of data in a cwa file, typically a few seconds long) where the sampling rate deviates by more than 10% from the expected sampling rate. The imputation technique is the same as for the time gaps as detailed earlier in this section. If you are unhappy with the 10% threshold then you have the possibility of changing this percentage with the parameter `frequency_tol`. Biased sampling rates of this kind are expected to be extremely rare and are not expected to affect normal research conditions, but we nonetheless like to be able to account for them. Additionally, to monitor this process of handling faulty blocks and outliers in sampling rate, `GGIRread` logs a series of file health statistics which are stored by GGIR in the 'data_quality_report.csv' file located within the 'QC' folder of the output directory 'results' (see previous chapter for discussion on GGIR output). The data quality report, comes with variable names prefixed with 'filehealth', detailing the number and duration of time gaps detected during the recording(s), as well as number of epochs that have 5-10% or more than 10% bias in sampling rate. @@ -38,7 +58,7 @@ Some manufacturers incorporate functionalities in their devices to let them stop For example, ActiGraph has the option called 'idle sleep mode' in their devices, which pauses data collection when no movement is detected for a sustained period of time. The ActiGraph’s idle sleep mode is [explained](https://actigraphcorp.my.site.com/support/s/article/Idle-Sleep-Mode-Explained) on the manufacturer’s website. -The time gaps in the data are considered non-wear time in GGIR. GGIR imputes gaps shorter than 90 minutes at raw data level, using the last recorded value (meaning before the gap) normalised to 1 *g*. This approach assumes that accelerometer was kept in the same orientation as it was last observed. On the contrary, gaps longer than 90 minutes are imputed at epoch level to make the data processing more memory efficient and faster. The epoch level imputation is discussed in [chapter 6](https://wadpac.github.io/GGIR/articles/chapter6_DataImputation.html). The number and duration of the time gaps found are logged by GGIR in the 'data_quality_report.csv' file located within the 'QC' folder of the output directory 'results' (see previous chapter for discussion on GGIR output). +The time gaps in the data are considered non-wear time in GGIR. GGIR imputes gaps shorter than 90 minutes at raw data level, using the last recorded value (meaning before the gap) normalised to 1 *g*. This approach assumes that accelerometer was kept in the same orientation as it was last observed. On the contrary, gaps longer than 90 minutes are imputed at epoch level to make the data processing more memory efficient and faster. The epoch level imputation is discussed in [chapter 6](https://wadpac.github.io/GGIR/articles/chapter6_DataImputation.html). The number and duration of the time gaps found are logged by GGIR in the 'data_quality_report.csv' file located within the 'QC' folder of the output directory 'results' (see previous chapter for discussion on GGIR output). Studies often forget to clarify whether the accelerometers were configured to pause data collection during periods of no movement and, if so, how the resulting time gaps were accounted for in the data processing. Especially, if the device firmware or manufacturer software already imputes the time gaps that can cause significant bias to the GGIR estimates. More generally speaking, we advise to: @@ -51,7 +71,7 @@ Studies often forget to clarify whether the accelerometers were configured to pa ### Specific note on ActiGraph idle sleep mode -ActiGraph files might be exported in gt3x or csv formats. When idle sleep mode is used, data in these files are different. In gt3x files, time gaps can be found in the signal, with no imputation made by the ActiLife software. However, csv files exported in ActiLife will have imputed values in all three axes during periods of no movement. Note that this imputation by the ActiLife software has changed at some point in time. Initially the imputation was zeros but with more recent versions of ActiLife the imputation uses the last recorded value for each axis. Therefore, you need to be aware that GGIR will take care of the time gap imputation relative to the idle sleep mode when using gt3x files, but not when using ActiGraph csv files (because the latter come with the time gaps already imputed). +ActiGraph files might be exported in gt3x or csv formats. When idle sleep mode is used, data in these files are different. In gt3x files, time gaps can be found in the signal, with no imputation made by the ActiLife software. However, csv files exported in ActiLife will have imputed values in all three axes during periods of no movement. Note that this imputation by the ActiLife software has changed at some point in time. Initially the imputation was zeros but with more recent versions of ActiLife the imputation uses the last recorded value for each axis. Therefore, you need to be aware that GGIR will take care of the time gap imputation relative to the idle sleep mode when using gt3x files, but not when using ActiGraph csv files (because the latter come with the time gaps already imputed). ### Resampling for GENEActiv with 85.7 Hertz @@ -120,7 +140,7 @@ Finally, if the recording starts or ends with a period of less than three hours ## Clipping detection -GGIR part 1 also screens the acceleration signal for "clipping", i.e., sustained unusual high (raw) acceleration values non compatible with human movement. If more than 30% of the data points in a 15-minute window (same as used for non-wear) are close to the maximal values (technical term for this is dynamic range) of this sensor, the corresponding time period is considered as potentially unreliable, which may be explained by the sensor getting stuck at its extreme value or accelerometers being used inappropriately (attached to some heavily accelerating object). For example, for a dynamic range of 8*g*, accelerations over 7.5*g* would be marked as "clipping". The window is also classified as clipping if any value in the window is larger than 150% the dynamic range of the sensor. Given that clipping rarely happens it is reported by GGIR as part of non-wear time. Both clipping and non-wear are treated the same and by merging them we arrive at a single indicator for the amount of invalid data. However, to keep track of the occurrence of clipping time, GGIR does report the fraction of 15-minute windows in a recording during which clipping occurs, see section on output below. +GGIR part 1 also screens the acceleration signal for "clipping", i.e., sustained unusual high (raw) acceleration values non compatible with human movement. If more than 30% of the data points in a 15-minute window (same as used for non-wear) are close to the maximal values (technical term for this is dynamic range) of this sensor, the corresponding time period is considered as potentially unreliable, which may be explained by the sensor getting stuck at its extreme value or accelerometers being used inappropriately (attached to some heavily accelerating object). For example, for a dynamic range of 8*g*, accelerations over 7.5*g* would be marked as "clipping". The window is also classified as clipping if any value in the window is larger than 150% the dynamic range of the sensor. Given that clipping rarely happens it is reported by GGIR as part of non-wear time. Both clipping and non-wear are treated the same and by merging them we arrive at a single indicator for the amount of invalid data. However, to keep track of the occurrence of clipping time, GGIR does report the fraction of 15-minute windows in a recording during which clipping occurs, see section on output below. ## Key parameters @@ -193,3 +213,125 @@ GGIR part 1 also screens the acceleration signal for "clipping", i.e., sustained - van Hees VT, Fang Z, Langford J, Assah F, Mohammad A, da Silva IC, Trenell MI, White T, Wareham NJ, Brage S. Autocalibration of accelerometer data for free-living physical activity assessment using local gravity and temperature: an evaluation on four continents. J Appl Physiol (1985). 2014 Oct 1;117(7):738-44. PMID: 25103964 [link](https://doi.org/10.1152/japplphysiol.00421.2014) - van Hees VT, Gorzelniak L, Dean León EC, Eder M, Pias M, Taherian S, Ekelund U, Renström F, Franks PW, Horsch A, Brage S. Separating movement and gravity components in an acceleration signal and implications for the assessment of human daily physical activity. [PLoS One. 2013 Apr 23](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0061691) + +## Minimal example + +```r +library(GGIR) +GGIR( + datadir = "C:/mydata", + outputdir = "C:/myresults", + do.cal = TRUE, # run auto-calibration (default, recommended) + windowsizes = c(5, 900, 3600) # epoch=5s, non-wear step=15min, window=60min (defaults) +) +``` + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +GGIR performs four data quality steps automatically: time gap detection and imputation, auto-calibration using non-movement periods, non-wear detection using signal standard deviation and range, and clipping detection. All quality indicators are logged in `data_quality_report.csv`. + +### What to read next + +➡ [Chapter 4: From Raw Data to Acceleration Metrics](chapter4_AccMetrics.html) + +### Related materials + +- 📄 [van Hees et al. 2014: auto-calibration paper](https://doi.org/10.1152/japplphysiol.00421.2014) +- 📄 [GGIR Parameters reference](GGIRParameters.html) +Video tutorial by Prof. Stuart Fairclough
+ + +::: + + + diff --git a/vignettes/chapter4_AccMetrics.Rmd b/vignettes/chapter4_AccMetrics.Rmd index d43df0414..9980b7412 100644 --- a/vignettes/chapter4_AccMetrics.Rmd +++ b/vignettes/chapter4_AccMetrics.Rmd @@ -14,6 +14,27 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~20 min | **Chapter:** 4 of 14 + +**What you will learn** + +- Why summarising raw data into epoch-level metrics is necessary +- The full list of acceleration metrics available in GGIR and their characteristics +- Why GGIR uses ENMO as its default metric +- How to embed your own custom metrics into the GGIR pipeline + +**Prerequisites** + +- Read the previous chapter: [Chapter 3: Data Quality Assurance](chapter3_QualityAssessment.html) + + +**Key terms:** ENMO, LFENMO, epoch, zero-crossing count, MAD, sampling rate, windowsizes +– see the [full Glossary](Glossary.html) for all definitions. + +::: + ## Why do we need to extract metrics Wearable accelerometers are widely used in health research to study physical activity, sleep, and other behaviours. Most modern accelerometers can collect and store at least 30 values per second expressed in units of gravitational acceleration (*g*). Once the data is collected, it is important to extract kinematically meaningful information from it. In data processing, summary measures to describe a signal are referred to as metrics or signal features. @@ -29,7 +50,7 @@ Finding a metric able to separate these three components will provide informativ ## Metric aggregation per epoch -Most metrics are at first calculated at the same resolution as the raw data, which reflects a tiny fraction of a second. The exact number of data points per second also known as the sampling rate can vary between studies. With a different sampling rate values are not directly comparable. However, by aggregating metric values per larger time window, known as an epoch, we can make the values more comparable. So, GGIR aggregates these values per epoch (e.g. 5 seconds). Aside from harmonising the data across studies, aggregation per epoch also has other advantages: +Most metrics are at first calculated at the same resolution as the raw data, which reflects a tiny fraction of a second. The exact number of data points per second also known as the sampling rate can vary between studies. With a different sampling rate values are not directly comparable. However, by aggregating metric values per larger time window, known as an epoch, we can make the values more comparable. So, GGIR aggregates these values per epoch (e.g. 5 seconds). Aside from harmonising the data across studies, aggregation per epoch also has other advantages: - Evidence on the value of accelerometer data is based on epoch-level aggregates, because reference values like Oxygen consumption or sleep cannot reliably be derived at sub-second resolution. - Aggregating leads to less data points which makes it a lot more practical to work with. @@ -99,7 +120,7 @@ All metrics, listed above, that have the letters LF or BF in their name attempt ### Why GGIR uses ENMO as a default. -Only one metric can be the default. Acceleration metric ENMO (Euclidean Norm Minus One with negative values rounded to zero) has been the default metric since GGIR was created. In 2013, we investigated different ways of summarising the raw acceleration data ([van Hees et al. PLoS ONE 2013](https://doi.org/10.1371/journal.pone.0061691)). +Only one metric can be the default. Acceleration metric ENMO (Euclidean Norm Minus One with negative values rounded to zero) has been the default metric since GGIR was created. In 2013, we investigated different ways of summarising the raw acceleration data ([van Hees et al. PLoS ONE 2013](https://doi.org/10.1371/journal.pone.0061691)). In short, different metrics exist and there is very little literature to support the superiority of any metric at the time. As long as different studies use different metrics, their findings will not be comparable. Therefore, the choice for metric ENMO has been merely pragmatic. GGIR uses ENMO as default because: 1\. @@ -112,7 +133,7 @@ ENMO is easy to describe mathematically and, therefore, improves reproducibility ENMO attempts to quantify the acceleration in universal units and does not collapse the signal to an abstract scale. 4\. -The 2013 paper showed that when ENMO is used in combination with auto-calibration, it has similar validity to filter-based metrics like HFEN and BFEN, which are conceptually similar to metrics proposed later such as [MIMSunit](https://doi.org/10.1123/jmpb.2018-0068), [MAD](https://doi.org/10.1186/s13102-015-0010-0), [AI0](https://doi.org/10.1371/journal.pone.0160644). +The 2013 paper showed that when ENMO is used in combination with auto-calibration, it has similar validity to filter-based metrics like HFEN and BFEN, which are conceptually similar to metrics proposed later such as [MIMSunit](https://doi.org/10.1123/jmpb.2018-0068), [MAD](https://doi.org/10.1186/s13102-015-0010-0), [AI0](https://doi.org/10.1371/journal.pone.0160644). 5\. Studies who have criticised ENMO consistently failed to apply auto-calibration, or attempted to apply auto-calibration in a lab setting, ignoring the fact that auto-calibration is not designed for short lab settings. It needs free-living data to work properly. Further, studies are often not clear about how the problematic zero imputation during the idle sleep mode in ActiGraph devices is dealt with. @@ -120,7 +141,7 @@ Studies who have criticised ENMO consistently failed to apply auto-calibration, ### Notes on implementation of zero crossing counts -The implementation of the zero-crossing count in GGIR is an attempt to imitate the zero-crossed counts previously described by Sadeh, Cole, Kripke and colleagues in the late 1980s and 1990s. However, it cannot be guaranteed to be an exact copy of the original approach, which used the AMA-32 Motionlogger Actigraph by Ambulatory-monitoring Inc. ("AMI"). +The implementation of the zero-crossing count in GGIR is an attempt to imitate the zero-crossed counts previously described by Sadeh, Cole, Kripke and colleagues in the late 1980s and 1990s. However, it cannot be guaranteed to be an exact copy of the original approach, which used the AMA-32 Motionlogger Actigraph by Ambulatory-monitoring Inc. ("AMI"). No complete publicly accessible description of that approach exists. @@ -189,3 +210,122 @@ We have compiled a list of related articles you may find useful: - [Karas et al. 2022](https://mhealth.jmir.org/2022/7/e38077/) Comparison of accelerometry-based measures of physical activity: retrospective observational data analysis study. - [van Hees 2019](https://medium.com/@vincentvanhees/ten-misunderstandings-surrounding-information-extraction-from-wearable-accelerometer-data-a4f767a865b6) Ten Misunderstandings surrounding Information Extraction from Wearable Accelerometer data. + +## Minimal example + +```r +library(GGIR) +GGIR( + datadir = "C:/mydata", + outputdir = "C:/myresults", + do.enmo = TRUE, # ENMO (default, already TRUE by default) + do.mad = TRUE, # also compute MAD metric + do.anglez = TRUE # z-angle (used in sleep detection) +) +``` + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +GGIR aggregates raw acceleration into epoch-level metrics to enable comparison across studies and sampling rates. The default metric is ENMO. Multiple metrics can be computed in parallel by setting their `do.*` parameter to `TRUE`. + +### What to read next + +➡ [Chapter 5: Accounting for Study Protocol](chapter5_StudyProtocol.html) + +### Related materials + +- 📄 [van Hees et al. 2013: ENMO validation paper](https://doi.org/10.1371/journal.pone.0061691) +- 📄 [Published cut-points for ENMO](https://wadpac.github.io/GGIR/articles/CutPoints.html) + + +::: + + + diff --git a/vignettes/chapter5_StudyProtocol.Rmd b/vignettes/chapter5_StudyProtocol.Rmd index 6bfaf44b7..6e763e06e 100644 --- a/vignettes/chapter5_StudyProtocol.Rmd +++ b/vignettes/chapter5_StudyProtocol.Rmd @@ -17,6 +17,26 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~10 min | **Chapter:** 5 of 14 + +**What you will learn** + +- How to inform GGIR about the timing of your study protocol so it can mask irrelevant data +- The five data masking strategies and when to use each +- How to set maximum recording duration + +**Prerequisites** + +- Read the previous chapter: [Chapter 4: From Raw Data to Acceleration Metrics](chapter4_AccMetrics.html) + + +**Key terms:** data masking, recording +– see the [full Glossary](Glossary.html) for all definitions. + +::: + When you use an accelerometer in a study, you are likely to give your study participants specific instructions on when they should start wearing the accelerometer, for how many days, and whether or not they @@ -25,7 +45,7 @@ types or parts of the day. Further, it may be that you turned on the accelerometers hours or even days before you gave it to the participant or stopped it hours or days after you received it back. Your knowledge about all these aspects of your study protocol can be used by GGIR to -mask certain periods of time in the recording. This is important because +mask certain periods of time in the recording. This is important because this information is not necessarily obvious from the recorded data. For instance, when a recording is started and dispatched to the participant via mail, the time during which the devices are in transit and not worn @@ -90,3 +110,108 @@ Additionally, you can set the maximum duration the accelerometer is to be worn a | n hours ignored at start of meas | Number of hours ignored at the end of the measurement (if data_masking_strategy = 1) or at the end of the ndayswindow (if data_masking_strategy = 3 or 5). A log of decision made in part2.R | part2_summary.csv | | n hours ignored at end of meas | Number of hours ignored at the start of the measurement (if data_masking_strategy = 1) or at the start of the ndayswindow (if data_masking_strategy = 3 or 5) A log of decision made in part2.R | part2_summary.csv | | n days of measurement after which all data is ignored | Number of days of measurement after which all data is ignored (if data_masking_strategy = 1, 3 or 5) A log of decision made in part2.R | part2_summary.csv | + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +Use `data_masking_strategy` (values 1–5) to match GGIR’s analysis window to your actual data collection protocol. Always mask out data from before the device was given to the participant and after it was returned, to avoid contaminating results with transit movements. + +### What to read next + +➡ [Chapter 6: How GGIR Deals with Invalid Data](chapter6_DataImputation.html) + +### Related materials + +- 📄 [GGIR Parameters reference](GGIRParameters.html) + + +::: + + + diff --git a/vignettes/chapter6_DataImputation.Rmd b/vignettes/chapter6_DataImputation.Rmd index 5f425dbb1..0e492be1f 100644 --- a/vignettes/chapter6_DataImputation.Rmd +++ b/vignettes/chapter6_DataImputation.Rmd @@ -14,10 +14,30 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~5 min | **Chapter:** 6 of 14 + +**What you will learn** + +- How GGIR imputes invalid epoch data using the mean from the same time of day on other valid days +- Which analyses use imputed vs. raw (un-imputed) time series +- How to disable or customise the imputation strategy + +**Prerequisites** + +- Read the previous chapter: [Chapter 5: Accounting for Study Protocol](chapter5_StudyProtocol.html) + + +**Key terms:** imputation (epoch-level), non-wear, clipping, epoch +– see the [full Glossary](Glossary.html) for all definitions. + +::: + ## Imputation of invalid epoch data -All time segments classified as non-wear or clipping (see Chapter 3) and those masked by the study protocol (see Chapter 5) are treated as invalid data. -In GGIR part 2, the epoch level metric values are imputed, while a log is kept of which epochs were imputed. +All time segments classified as non-wear or clipping (see Chapter 3) and those masked by the study protocol (see Chapter 5) are treated as invalid data. +In GGIR part 2, the epoch level metric values are imputed, while a log is kept of which epochs were imputed. For most of the subsequent analysis done by GGIR, the imputed time series is used. The time series without invalid segments are used only for a few analyses: - Weighted average of full recording @@ -26,7 +46,7 @@ For most of the subsequent analysis done by GGIR, the imputed time series is use - A very specific non-default configuration of sleep analysis (see Chapter 8) -The imputation of epoch data is done based on the mean metric value corresponding to the valid values from the same time in the day on other days in the recording. +The imputation of epoch data is done based on the mean metric value corresponding to the valid values from the same time in the day on other days in the recording. However, if the same time interval is marked as invalid across all recorded days, the value is imputed by zero, except for metric EN which is imputed by 1. For example, imagine a 5-day recording with the following ENMO metric data for two specific epochs in the day across five days: @@ -60,3 +80,108 @@ To do this, you should use the parameter `TimeSegments2ZeroFile`. - In GGIR part 2, plots to check the data quality highlight the segments of the file that were considered invalid and imputed. These plots can be found in the folder “results/QC/”. - In GGIR part 5, time series are produced and optionally stored within the folder “meta/ms5out.raw/” in either csv or RData format. These time series contain an indicator of the epochs that were considered invalid and imputed. + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +Invalid epochs (non-wear, clipping, and masked data from the study protocol) are imputed by default using the mean metric value from the same time of day on other valid days. Imputation can be disabled with `do.imp = FALSE`. The imputed time series is used by most GGIR analyses; a few analyses (cosinor, weighted averages) use the non-imputed series. + +### What to read next + +➡ [Chapter 7: Describing the Data Without Knowing Sleep](chapter7_DescribingDataWithoutKnowingSleep.html) + +### Related materials + +- 📄 [GGIR Parameters reference](GGIRParameters.html) + + +::: + + + diff --git a/vignettes/chapter7_DescribingDataWithoutKnowingSleep.Rmd b/vignettes/chapter7_DescribingDataWithoutKnowingSleep.Rmd index 161df210a..99fffd523 100644 --- a/vignettes/chapter7_DescribingDataWithoutKnowingSleep.Rmd +++ b/vignettes/chapter7_DescribingDataWithoutKnowingSleep.Rmd @@ -14,6 +14,26 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~15 min | **Chapter:** 7 of 14 + +**What you will learn** + +- How GGIR summarises average acceleration and its distribution per valid day +- What the MX metrics and intensity gradient are and how to compute them +- How GGIR structures its part 2 output CSV reports + +**Prerequisites** + +- Read the previous chapter: [Chapter 6: How GGIR Deals with Invalid Data](chapter6_DataImputation.html) + + +**Key terms:** ENMO, valid day, MX metrics, intensity gradient, epoch +– see the [full Glossary](Glossary.html) for all definitions. + +::: + With the metric values imputed in the previous chapter, GGIR part 2 offers a first descriptive analysis of the data. Although we will have to wait till later GGIR parts (chapters) to see the segmentation of days in waking and sleep hours, there is already enough that can be quantified at this point. In this chapter we focus on descriptive analysis of the data that are informative even without the knowledge on when the participant was sleeping or awake. @@ -25,7 +45,7 @@ In this way, GGIR part 2 is an ideal place to start for data quality assurance. ## Basic descriptives -Descriptive variables are calculated and reported for valid days only, where the criteria for valid day is defined by parameter `includedaycrit`. +Descriptive variables are calculated and reported for valid days only, where the criteria for valid day is defined by parameter `includedaycrit`. ### Average acceleration @@ -35,7 +55,7 @@ GGIR part 2 provide two types of average acceleration: - Average per day, only stored when the day was considered valid. Note that this descriptive and most other descriptives are also stored by GGIR as averages across all days, weekend days, or weekdays, which we will discuss in more detail later on. -- Weighted average of all valid data points in the recording, weighted by timing in the day of all valid epochs, regardless of whether they come from days that as a whole are classified as valid or not. +- Weighted average of all valid data points in the recording, weighted by timing in the day of all valid epochs, regardless of whether they come from days that as a whole are classified as valid or not. ### Acceleration distribution @@ -52,7 +72,7 @@ The distribution of acceleration values is often referred to as intensity distri ### Sets of quantiles (MX metrics by [Rowlands et al.](https://pubmed.ncbi.nlm.nih.gov/29360664/)) The quantiles, as discussed above, can be used to describe the accelerations that participants exceed in their most active “X” accumulated minutes in a day. -In the specific approach, as proposed by [Rowlands et al.](https://pubmed.ncbi.nlm.nih.gov/31808014/), these quantiles are referred to as the **MX metrics**. +In the specific approach, as proposed by [Rowlands et al.](https://pubmed.ncbi.nlm.nih.gov/31808014/), these quantiles are referred to as the **MX metrics**. The MX metrics should not be confused with the most active continuous X hours, e.g. M10, as used in circadian rhythm research that also can be derived with GGIR (see parameter `winhr`). @@ -69,14 +89,14 @@ Note: If time segments shorter than 24 hours are specified in parameter `qwindow At the moment, this only works for one segment length and GGIR does not facilitate the generation of MX metrics for multiple unequal time segments within the same GGIR function call. The output in the part 2 summary report file will refer to this as a percentile of the day. -Thus, for a 24-h day, M30 will appear as “p97.91666_ENMO_mg_0.24hr”. +Thus, for a 24-h day, M30 will appear as “p97.91666_ENMO_mg_0.24hr”. To create the radar plots of these MX metrics as first described by [Rowlands et al.](https://pubmed.ncbi.nlm.nih.gov/31808014/), this [GitHub repository](https://github.com/Maylor8/RadarPlotGenerator) provides the R code and detailed instructions on how to make the radar plots using your own data. ### Intensity gradient If we plot the time spent in equally spaced acceleration ranges, we would end up with an asymptotic-shaped curve, indicating little time spent at high intensities (acceleration levels) and much time spent at low intensities. The shape of the distribution may be informative but is hard to quantify with a single number in its standard form. -Therefore, a new concept called the intensity gradient was proposed by [Rowlands and colleagues](https://pubmed.ncbi.nlm.nih.gov/29360664/). +Therefore, a new concept called the intensity gradient was proposed by [Rowlands and colleagues](https://pubmed.ncbi.nlm.nih.gov/29360664/). The intensity gradient defines the slope of the log-transformed axes of this intensity distribution. More specifically, we calculate the time accumulated in incremental acceleration bins (bin size = 25 m*g*) but also keep track of the mid-point of each intensity bin, e.g. 62.5 m*g* for the bin ranging from 50 to 75 m*g*. @@ -131,3 +151,126 @@ In part2_daysummary_longformat.csv, each row represents one segment from one day | ig_rsquared_ENMO_0-24hr | R-squared for the intensity gradient | `b` | : To clarify that `b` refers to both part2_summary.csv and part2_daysummary.csv, `r` refers to part2_summary.csv only. + +## Minimal example + +```r +library(GGIR) +GGIR( + datadir = "C:/mydata", + outputdir = "C:/myresults", + includedaycrit = 16, # minimum valid hours to count a day as valid + qlevels = c(1380/1440, 1410/1440, 1430/1440), # M60, M30, M10 + iglevels = TRUE # compute intensity gradient +) +``` + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +GGIR part 2 provides average acceleration, acceleration distribution metrics (percentiles, ilevels), MX metrics, and the intensity gradient for each valid day and as recording-level summaries. Results are stored in `part2_daysummary.csv` and `part2_summary.csv`. + +### What to read next + +➡ [Chapter 8: Sleep Fundamentals: SIB Detection](chapter8_SleepFundamentalsSibs.html) + +### Related materials + +- 📄 [Rowlands et al. 2019: MX metrics paper](https://pubmed.ncbi.nlm.nih.gov/31808014/) +- 📄 [GGIR Output reference](GGIRoutput.html) +Video tutorial by Prof. Stuart Fairclough
+ + +::: + + + diff --git a/vignettes/chapter8_SleepFundamentalsSibs.Rmd b/vignettes/chapter8_SleepFundamentalsSibs.Rmd index 8baccce88..fdf4c7ec7 100644 --- a/vignettes/chapter8_SleepFundamentalsSibs.Rmd +++ b/vignettes/chapter8_SleepFundamentalsSibs.Rmd @@ -20,17 +20,17 @@ Sleep analysis in GGIR comes at three stages: 2. Identification of time windows that guide the eventual sleep detection, as discussed in the next chapter. -3. Assess overlap between the windows identified in step 1 and 2, which we use to define the Sleep Period Time window (SPT) or the time in bed window (TimeInBed) as discussed in chapter 10. +3. Assess overlap between the windows identified in step 1 and 2, which we use to define the Sleep Period Time window (SPT) or the time in bed window (TimeInBed) as discussed in chapter 10. -The term “sleep” is somewhat controversial in the context of accelerometry, because accelerometers can only capture lack of movement, while sleep is not formally defined by a lack of movement. To acknowledge this, GGIR refers to these classified ‘sleep’ periods as **sustained inactivity bouts abbreviated as SIB**. However, we use the term sleep in GGIR to denote the broader topic of describing the main resting period in the day. +The term “sleep” is somewhat controversial in the context of accelerometry, because accelerometers can only capture lack of movement, while sleep is not formally defined by a lack of movement. To acknowledge this, GGIR refers to these classified ‘sleep’ periods as **sustained inactivity bouts abbreviated as SIB**. However, we use the term sleep in GGIR to denote the broader topic of describing the main resting period in the day. -Most SIB detection algorithms are designed for wrist-worn data. No evidence exists that they are informative for other wear locations. However, if your main interest is in daytime behaviour and not in sleep, you can still use them. In that case set parameter `relyonguider = TRUE` in combination with any of the SIB algorithms described below. GGIR will then rely on the guider (discussed in next chapter) to define the Sleep Period Time window (this is, the main episode of sleep in the day) and by that the waking hours of the day. The sleep analysis based on the SIB detection may not be informative though and best ignored. +Most SIB detection algorithms are designed for wrist-worn data. No evidence exists that they are informative for other wear locations. However, if your main interest is in daytime behaviour and not in sleep, you can still use them. In that case set parameter `relyonguider = TRUE` in combination with any of the SIB algorithms described below. GGIR will then rely on the guider (discussed in next chapter) to define the Sleep Period Time window (this is, the main episode of sleep in the day) and by that the waking hours of the day. The sleep analysis based on the SIB detection may not be informative though and best ignored. GGIR offers the user the choice to identify SIB period with the following algorithms: ## SIB: vanHees2015 -This algorithm looks for the periods of time where the z-angle does not change by more than 5 degrees for at least 5 minutes. This algorithm was proposed in a [2015 article](https://doi.org/10.1371/journal.pone.0142533). The idea behind the algorithm is that it is a more interpretable heuristic compared with the conventional approaches that use the magnitude of acceleration to distinguish sustained inactivity bouts. There is no reason to assume that `vanHees2015` is a better or worse reflection of sleep, the advancement is purely intended to be in terms of interpretability. The `vanHees2015` algorithm is the default. The values 5 and 5 in the algorithm can be modified with parameters `anglethreshold` and `timethreshold`, but we currently see no basis to recommend doing this and advise sticking to default values. +This algorithm looks for the periods of time where the z-angle does not change by more than 5 degrees for at least 5 minutes. This algorithm was proposed in a [2015 article](https://doi.org/10.1371/journal.pone.0142533). The idea behind the algorithm is that it is a more interpretable heuristic compared with the conventional approaches that use the magnitude of acceleration to distinguish sustained inactivity bouts. There is no reason to assume that `vanHees2015` is a better or worse reflection of sleep, the advancement is purely intended to be in terms of interpretability. The `vanHees2015` algorithm is the default. The values 5 and 5 in the algorithm can be modified with parameters `anglethreshold` and `timethreshold`, but we currently see no basis to recommend doing this and advise sticking to default values. ## SIB: NotWorn (EXPERIMENTAL) @@ -48,7 +48,7 @@ If you are using a count accelereration metric then set `HASIB.algo = "NotWorn"` ### Combined with gravitational unit acceleration metrics -If you are using an acceleration metrics the expresses acceleration in gravitational units then set `HASIB.algo` as you would do if the accelerometer was expected to be worn and specify a second guider for parameter `HASPT.algo` as discussed int he next chapter, e.g. `HASPT.algo = c("NotWorn", "HDCZA)"`. In this way GGIR will first search for long non-wear periods as indicator of sleep and use those to define the sleep window but if those are not found it will fall back on the sib-algortihm as specified with `HASIB.algo`, e.g. `"vanHees2015"`. +If you are using an acceleration metrics the expresses acceleration in gravitational units then set `HASIB.algo` as you would do if the accelerometer was expected to be worn and specify a second guider for parameter `HASPT.algo` as discussed int he next chapter, e.g. `HASPT.algo = c("NotWorn", "HDCZA)"`. In this way GGIR will first search for long non-wear periods as indicator of sleep and use those to define the sleep window but if those are not found it will fall back on the sib-algortihm as specified with `HASIB.algo`, e.g. `"vanHees2015"`. ## SIB: Count based algorithms (EXPERIMENTAL) @@ -128,3 +128,121 @@ However, if `HASIB.algo` is specified to one of the before mentioned algorithms, ## Dealing with expected or detected nonwear time segments Depending on study protocol we may want to interpret invalid data (typically non-wear) differently. When you set parameter `ignorenonwear=TRUE` (default) it will ignore any non-wear period for the SIB detection. This is useful to prevent nonwear episodes before going to bed or after waking up from contributing to sleep. +## Minimal example + +```r +library(GGIR) +GGIR( + datadir = "C:/mydata", + outputdir = "C:/myresults", + HASIB.algo = "vanHees2015", # default SIB detection algorithm + do.anglez = TRUE # z-angle required for vanHees2015 +) +``` + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +GGIR identifies sleep as Sustained Inactivity Bouts (SIBs) – periods of limited postural change – rather than physiologically defined sleep. The default algorithm (`vanHees2015`) detects periods where the z-angle does not change by more than 5 degrees for at least 5 minutes. SIBs are then combined with a guider window (chapter 9) to form the SPT. + +### What to read next + +➡ [Chapter 9: Sleep Fundamentals: Guiders](chapter9_SleepFundamentalsGuiders.html) + +### Related materials + +- 📄 [van Hees et al. 2015: vanHees2015 algorithm paper](https://doi.org/10.1371/journal.pone.0142533) +- 📄 [GGIR Parameters reference](GGIRParameters.html) + +- 📹 [GGIR tutorial playlist by Prof. Stuart Fairclough](https://www.youtube.com/watch?v=AbHgJYTyuiA) + +::: + + + diff --git a/vignettes/chapter9_SleepFundamentalsGuiders.Rmd b/vignettes/chapter9_SleepFundamentalsGuiders.Rmd index 96f44d004..1e8b0d203 100644 --- a/vignettes/chapter9_SleepFundamentalsGuiders.Rmd +++ b/vignettes/chapter9_SleepFundamentalsGuiders.Rmd @@ -17,21 +17,42 @@ knitr::opts_chunk$set( ) ``` +::: {style="background:#f0f4ff;border-left:4px solid #0054AD;padding:1rem 1.2rem;margin-bottom:1.5rem;border-radius:4px"} + +**⏱ Reading time:** ~20 min | **Chapter:** 9 of 14 + +**What you will learn** + +- How GGIR defines the candidate sleep window (the “guider”) +- The available guider algorithms and when to use each +- How to configure guiders with GGIR parameters, including sleep log integration + +**Prerequisites** + +- Read the previous chapter: [Chapter 8: Sleep Fundamentals: SIB Detection](chapter8_SleepFundamentalsSibs.html) +- 📄 [van Hees et al. 2018: HDCZA algorithm](https://dx.doi.org/10.1038/s41598-018-31266-z) + + +**Key terms:** guider, HDCZA, SPT (Sleep Period Time window), TimeInBed, sleep log, HASPT.algo, daysleeper, HorAngle, HLRB, SIB (Sustained Inactivity Bout) +– see the [full Glossary](Glossary.html) for all definitions. + +::: + Sleep analysis in GGIR comes at three stages: 1. The discrimination of sleep and wakefulness periods, discussed in the previous chapter. 2. Identification of time windows that guide the eventual sleep detection, discussed in this chapter. -3. Assess overlap between the windows identified in step 1 and 2, which we use to define the Sleep Period Time window (SPT) or the time in bed window (TimeInBed) as discussed in chapter 10. +3. Assess overlap between the windows identified in step 1 and 2, which we use to define the Sleep Period Time window (SPT) or the time in bed window (TimeInBed) as discussed in chapter 10. A key challenge with sleep detection is to ignore day time rest periods and short periods of not wearing the accelerometer that were missed by the non-wear detection. To ease this process GGIR starts by identifying the main time window where sleep is likely. -We will refer to the methods for defining the window as **guiders**. +We will refer to the methods for defining the window as **guiders**. The following guiders are available: -If a sleep log is provided, GGIR uses by default guider sleep log, if the sleep log is not available it falls back on the algorithm as specified by parameter `HASPT.algo`, which allows tps ecify any of the algorithms are discussed below (default HDCZA). +If a sleep log is provided, GGIR uses by default guider sleep log, if the sleep log is not available it falls back on the algorithm as specified by parameter `HASPT.algo`, which allows tps ecify any of the algorithms are discussed below (default HDCZA). If that algorithm is not successful GGIR will falls back on a 12 hour window centered around the least active consecutive 5 hours in the day. So, when we refer to guider we refer to any of these methods. @@ -43,7 +64,7 @@ To address this, GGIR changes the window of analysis if this seems to be the cas If the sleep log indicates that the person woke up after noon, the sleep analysis in part 4 is done on the window from 6pm-6pm. Similarly, if any other guider indicates that the person woke up after 11 am, the sleep analysis in part 3 and 4 is done on the window 6pm-6pm. -In this way our method is sensitive to individuals who have their main sleep period starting before noon and ending after noon, referred as **daysleepers** in the output. +In this way our method is sensitive to individuals who have their main sleep period starting before noon and ending after noon, referred as **daysleepers** in the output. This is for example the case with shift workers. Note that guider L5+/-12 (discussed below) is not able to do this, it will only consider the noon-noon time window. @@ -114,7 +135,7 @@ Relative to the basic sleeplog format the advanced sleep log format comes with t ### Guider: HDCZA -The HDCZA algorithm is designed for studies with wrist-worn accelerometer (raw) data where no sleep log is available. The algorithm was first described in a [2018 article](https://dx.doi.org/10.1038/s41598-018-31266-z), and has been modified slightly: Step 6 in Figure 1 has been replaced by a single threshold (0.2 by default).\ +The HDCZA algorithm is designed for studies with wrist-worn accelerometer (raw) data where no sleep log is available. The algorithm was first described in a [2018 article](https://dx.doi.org/10.1038/s41598-018-31266-z), and has been modified slightly: Step 6 in Figure 1 has been replaced by a single threshold (0.2 by default).\ In short, step 1-6 attempt to classify time periods with limited change in posture. Next, step 7 extracts time blocks longer than 30 minutes, step 8 includes intermittent time periods that shorter than 60 minutes, step 9 looks for the longest resulting block in the day, which then in step 10 represents the guider window. @@ -163,7 +184,7 @@ I have attempted to implement it to see whether it can provide value. For the mo ### Guider: HLRB (EXPERIMENTAL) -HLRB is a heuristic algorithm to detect the Longest Rest Bout. It was designed to offer a guider option for accelerometer device that only store count data and by that cannot work with the HDCZA or HorAngle guiders. +HLRB is a heuristic algorithm to detect the Longest Rest Bout. It was designed to offer a guider option for accelerometer device that only store count data and by that cannot work with the HDCZA or HorAngle guiders. It has currently not been described in a publication. The algorithm is composed of the following steps: @@ -182,13 +203,13 @@ As already referenced in the previous chapter the `NotWorn` guider is designed f First the `NotWorn` algorithm calculates the 5 minute rolling average of the acceleration metric values (i.e., acceleration metric defined with parameter `acc.metric`) and applies a threshold that is 5% of the standard deviation in the resulting signal. However, if this threshold is less than the minimum value in the signal the threshold is set equal to the 10th percentile in the distribution. -Next, this is used to identify the largest non-movement period, by only considering segments of at least 30 minutes, and then looking for longest segment in the day where gaps of less than 60 minutes are ignored. Therefore, the last 4 steps in the algorithm are identical to the last four steps in the HDCZA and HorAngle algorithms. +Next, this is used to identify the largest non-movement period, by only considering segments of at least 30 minutes, and then looking for longest segment in the day where gaps of less than 60 minutes are ignored. Therefore, the last 4 steps in the algorithm are identical to the last four steps in the HDCZA and HorAngle algorithms. The algorithm is expected to work with any acceleration metric, so both count-type metrics and metrics in gravitational units. To use this guider set parameter `HASPT.algo = "NotWorn"`. Further, we recommend combining the using of \"NotWorn\" with: `do.imp = FALSE` and `ignorenonwear = FALSE`. Internally `HASPT.ignore.invalid` is always set to `NA` when \"NotWorn\" is used. -If this is used it will also define the resulting window as SIB period and ignore all other identified SIB window to ensure the entire window is treated as sleep. So, all SIB periods detected are ignored. +If this is used it will also define the resulting window as SIB period and ignore all other identified SIB window to ensure the entire window is treated as sleep. So, all SIB periods detected are ignored. However, we know from experience that participants occasionally wear the accelerometer during the night even when they are told not to. GGIR offers a solution for this if you are not working with count data but with accelerometer metrics in gravitational units. In that case, it is possible to specify a second guider to use when the accelerometer has been worn for less than 25% of the time in the detection window (noon-noon or 6pm-6pm). If this happens then it will check whether parameter `HASPT.algo` has two guiders specified. If it does it will use the second one. For example, `HASPT.algo = c("NotWorn", "HDCZA"`) or `HASPT.algo = c("NotWorn", "HorAngle"`). @@ -279,3 +300,122 @@ In the part4_nightsummary output (csv file) you will find a column named guider_ | guider_cor_meme_frac_out | 0.9 | NA | Decrease value | | guider_cor_meme_frac_in | 0.4 | NA | Decrease value | | guider_cor_meme_min_hrs | 2 | NA | Decrease value | + +## Minimal example + +```r +library(GGIR) +GGIR( + datadir = "C:/mydata", + outputdir = "C:/myresults", + HASPT.algo = "HDCZA", # use HDCZA guider for wrist-worn data (default) + HASIB.algo = "vanHees2015" # SIB algorithm (default) +) +``` + +--- + +::: {style="background:#f8f9fa;border-top:2px solid #dee2e6;padding:1rem 1.2rem;margin-top:2rem;border-radius:4px"} + +### Summary + +GGIR uses a “guider” to identify the candidate main sleep window each night before overlapping it with SIBs to define the SPT. The default guider for wrist-worn data is HDCZA. When a sleep log is available, it takes priority. A daysleeper shift (noon–noon → 6pm–6pm) is applied automatically when needed. + +### What to read next + +➡ [Chapter 10: Sleep Analysis](chapter10_SleepAnalysis.html) + +### Related materials + +- 📄 [van Hees et al. 2018: HDCZA algorithm](https://dx.doi.org/10.1038/s41598-018-31266-z) +- 📄 [GGIR Parameters reference](GGIRParameters.html) + +- 📹 [GGIR tutorial playlist by Prof. Stuart Fairclough](https://www.youtube.com/watch?v=AbHgJYTyuiA) + +::: + + + diff --git a/vignettes/chapterInProgress.Rmd b/vignettes/chapterInProgress.Rmd index 8ac821636..de97a6298 100644 --- a/vignettes/chapterInProgress.Rmd +++ b/vignettes/chapterInProgress.Rmd @@ -22,3 +22,89 @@ knitr::include_graphics("GGIR-MASTERLOGO-RGB.png") ``` + + +