Bionoia Where life meets thought
Back to Journal
Journal Sleep biology
Discovery

dlmoR: An open-source R package for the dim-light melatonin onset (DLMO) hockey-stick method

S. ; https://orcid.org/0009-0002-7320-9289 Thalji, M. ; https://orcid.org/0000-0002-8572-9268 Spitschan
Hypothesis
Read original paper
Editor's note
Researchers studying circadian rhythms can now reliably measure when the brain begins releasing melatonin—a key marker for diagnosing sleep disorders and timing interventions—using freely available, transparent software rather than proprietary black-box tools. This incremental but essential advance standardizes methodology across sleep and chronobiology labs, reducing measurement variability that has long plagued small studies. Chronobiologists, sleep medicine specialists, and researchers investigating shift work tolerance and circadian misalignment should adopt this to strengthen their data infrastructure.

Source: openalex · S. ; https://orcid.org/0009-0002-7320-9289 Thalji, M. ; https://orcid.org/0000-0002-8572-9268 Spitschan · MPG.PuRe (Max Planck Society) · 2026-06-01

URL: https://openalex.org/W7130251511

AI rationale (4/5, tier: emerging): DLMO measurement tool directly enables circadian biology research; melatonin physiology is explicitly prioritized in brief.


The dim-light melatonin onset (DLMO) is a commonly used circadian marker indicating the start time of evening melatonin synthesis in humans. Several quantitative techniques have been developed to determine DLMO from melatonin time series, including fixed- or variable-threshold techniques and the hockey-stick method developed by Danilenko et al (2014). Here, we introduce dlmoR, an open-source (MIT License) implementation of the hockey-stick method written in R. Our clean-room implementation follows the original algorithm description, supported by iterative validation against the existing binary executable. We benchmarked dlmoR on 112 melatonin time series data sets from two independent studies and found high agreement with the reference implementation: mean discrepancies were −1.482±21.7 min for the Heinrichs and Spitschan (2025) data set and 1.165±28.5 min for the Blume et al. (2024) data set, with circular correlation coefficients of 0.964 and 0.986, respectively. Paired t-tests (p>0.05) indicated no systematic difference or bias between methods. Beyond reproducing the hockey-stick algorithm, dlmoR adds capabilities absent from the original executable, including interactive visual diagnostics and bootstrapped confidence intervals, offering qualitative and quantitative views of estimation uncertainty. It supports programmatic, reproducible analysis of melatonin profiles, including batch processing and parameter manipulation. Leveraging this flexibility, we evaluated the sensitivity of the hockey-stick algorithm to controlled changes in sampling schedules, threshold levels, data completeness, and noise. Moderate changes, such as small timing jitter, limited data loss, or modest threshold shifts, kept estimates stable within ±10 min, whereas pronounced alterations to sampling schedules, large multi-point deletions, or substantial threshold changes delayed estimates by over 40 min or prevented estimation. This analysis reveals fundamental limitations in the algorithm's internal mechanics, particularly in how it identifies the onset window and models the melatonin rise, and underscores the need for new uncertainty-aware approaches to DLMO estimation.

🔬 Deep dive

Plain-language summary

The dim-light melatonin onset (DLMO) is the gold-standard marker researchers use to time a person's internal circadian clock — essentially pinpointing when the brain begins releasing melatonin at night. One widely-used way to calculate DLMO from a series of melatonin measurements is the 'hockey-stick' method, originally published by Danilenko and colleagues in 2014 and distributed only as a closed-source binary program. This paper introduces dlmoR, a free, open-source R package that re-implements the hockey-stick algorithm transparently, so any researcher can inspect, modify, and reuse the code. The authors validated dlmoR against 112 melatonin time-series datasets from two independent studies, finding excellent agreement with the original program — mean timing differences of roughly 1–1.5 minutes and circular correlations above 0.96. Beyond replication, dlmoR adds new features the original lacked: interactive visual diagnostics and bootstrapped confidence intervals that quantify estimation uncertainty. The authors also used the package's flexibility to stress-test the algorithm, deliberately perturbing sampling schedules, noise levels, and data completeness, revealing that moderate disturbances keep DLMO estimates within ±10 minutes but severe disturbances can shift estimates by more than 40 minutes or make estimation impossible. The work ultimately argues that current DLMO methods lack formal uncertainty quantification and calls for a new generation of uncertainty-aware estimation approaches.

Key findings

  • dlmoR showed mean timing discrepancies of −1.482 ± 21.7 min versus the reference executable on the Heinrichs & Spitschan (2025) dataset and 1.165 ± 28.5 min on the Blume et al. (2024) dataset, with paired t-tests (p > 0.05) confirming no systematic bias.
  • Circular correlation coefficients between dlmoR and the original binary were 0.964 and 0.986 across the two validation datasets (n = 112 total time series), indicating high agreement.
  • Sensitivity analyses showed that small timing jitter, limited data loss, or modest threshold shifts kept DLMO estimates stable within ±10 min, whereas large multi-point data deletions, pronounced sampling-schedule changes, or substantial threshold alterations delayed estimates by over 40 min or prevented estimation entirely.
  • dlmoR introduces bootstrapped confidence intervals and interactive visual diagnostics — capabilities absent from the original closed-source executable — enabling quantitative uncertainty assessment for each individual DLMO estimate.
  • The stress-testing analysis exposed a fundamental structural limitation in the hockey-stick algorithm: its onset-window identification and melatonin-rise modelling are highly sensitive to data quality, underscoring the need for new uncertainty-aware DLMO estimation methods.

Methods + cohort

This is a software development and validation study. The authors wrote a clean-room R implementation of the Danilenko et al. (2014) hockey-stick DLMO algorithm, verified iteratively against the original binary executable. The package was benchmarked on 112 melatonin time-series datasets drawn from two pre-existing independent studies (Heinrichs & Spitschan 2025; Blume et al. 2024). Sensitivity analyses were conducted by systematically manipulating sampling schedules, threshold levels, data completeness, and noise levels in silico to characterise algorithmic robustness.

Limitations + open questions

Because this is a software validation study rather than a clinical or physiological trial, it cannot speak to the biological accuracy of DLMO estimates — only their internal consistency with one reference algorithm. The large standard deviations around the mean discrepancies (±21–28 min) highlight that individual-level agreement can vary considerably even when group-level bias is absent. The study does not compare dlmoR against other DLMO methods (e.g., fixed-threshold or variable-threshold approaches), so relative performance across algorithms remains unknown. Future work should validate dlmoR estimates against gold-standard physiological endpoints (e.g., core body temperature minimum, cortisol awakening response) and develop the uncertainty-aware estimation framework the authors identify as necessary.

How this fits the corpus

dlmoR sits at the methodological infrastructure layer of circadian biology: it directly enables the rigorous measurement of melatonin-based circadian phase that underpins research throughout this corpus. It extends [§97], a population-based lighting study in older adults, by providing a validated, reproducible tool for deriving the very circadian phase markers such studies depend upon. It parallels [§44], which examines the CLOCK-BMAL1 molecular circadian machinery, in that both works interrogate the precision and reliability of circadian timing — one at the molecular level, one at the measurement level. It also directly supports work like [§33] (the TREAD time-restricted eating intervention for Alzheimer's disease), where accurate, reproducible DLMO estimation is prerequisite for evaluating whether behavioural chronotherapy has shifted circadian timing. More broadly, the uncertainty quantification gaps the authors identify are relevant to any study in this corpus that uses melatonin as a circadian endpoint, including [§108] (chronic jet-lag and renal injury in mice), where misclassification of circadian phase due to algorithmic imprecision could confound outcome attribution.

Compare with

AI-generated summary using claude-sonnet-4-6 on 2026-06-27. Information, not medical advice.
Published 2026-05-26 · Last kit-update 2026-05-26