Interactive Shiny App for Exploring Sleep Cycles
run_sleepcycles_app.Rd
This function launches a Shiny app that allows users to interactively explore and modify sleep cycle detection parameters using the Dude algorithm. The app visualizes Non-REM Periods (NREMP) REM Periods (REMP) while allowing users to adjust key parameters that control how sleep cycles are detected.
Arguments
- sleepcycles_obj
A
SleepCycle
object created usingsleepcycles_from_hypnogram()
withmethod = "dude"
.
Details
The Dude algorithm identifies sleep cycles based on density thresholds and temporal continuity rules. This app allows users to adjust the following NREMP and REMP parameters:
Density variable: The EEG feature or sleep stage combination used to measure Non-REM density.
Density threshold: A cutoff value (0.1 - 1.0) that defines what constitutes a Non-REM Period. Increasing this value increase specificity but may lower sensitivity.
Minimum gap: The minimum duration (in epochs) between two separate NREMP/REMPs. If two NREMPs are closer than this, they are merged into one.
Minimum size: The shortest duration allowed (in epochs) to count as an NREMP/REMP.
Examples
if (interactive()) {
data("hypnogram_grouped")
run_sleepcycles_app(
sleepcycles_from_hypnogram(
hypnogram_grouped,
epoch_col = "epoch",
stage_col = "stage",
id_col = "id",
verbose = FALSE
)
)
}