Abstract
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.