source("R/setup.R")
options(sass.cache = file.path(tempdir(), "melidos-gt-sass"))
source("R/report_tables.R")
for (module in c("data", "models", "inference", "diagnostics",
"validation", "attribution", "plots", "sensitivity")) {
source(paste0("R/", module, ".R"))
}
table_data <- function(name, directory = "results/tables") {
read.csv(file.path(directory, paste0(name, ".csv")), check.names = FALSE)
}
show_figure <- function(name) {
knitr::include_graphics(file.path("results/figures", paste0(name, ".png")))
}MeLiDos: chronotype and daily light exposure
Local clock time, circadian phase, and work versus free days
1 Abstract
Goulet et al. (2007) found that morning types received more light around dim-light melatonin onset (DLMO), whereas evening types received more light 10–12 hours later, in a subset of four morning and five evening participants with extreme DLMO timing. We examined whether similar phase-dependent differences occur in a larger sample during everyday work and free days.
We analysed near-eye melanopic light exposure from 140 MeLiDos participants, 778 participant-days and 35,949 half-hour observations. Cyclic generalized additive mixed models compared four MSFsc quartiles across work and free days, using local clock time and circadian phase operationalized through midsleep on free days corrected for sleep debt (MSFsc). The models accounted for site, individual daily patterns, participant-day variation and photoperiod. DLMO was represented by a published group-average DLMO reference interval relative to MSFsc.
After phase alignment, extreme morning types had higher fitted exposure 9.6–11.3 hours before MSFsc, roughly 3–5 hours before the DLMO reference, while extreme evening types had higher exposure 0.9–4.4 hours after MSFsc. The clock-time and circadian-phase models performed similarly well in sample (ordinary R² 0.795 and 0.794, respectively), including participant and day effects. Chronotype direction and chronotype strength together received small Shapley allocations of 0.007 and 0.012 R² above the common daily curve. Their 95% bootstrap intervals excluded zero. Individual patterns received the largest allocation.
Similar curve shapes under MEQ and MSFsc classification in 68 participants and 379 participant-days support robustness to the chronotype measure and its cutoffs. This sensitivity pools definite and moderate morning types and definite and moderate evening types, excluding the 72 intermediate chronotypes.
An exploratory, post hoc analysis tested whether daylight timing contributes to the phase-dependent differences, making them larger on longer days. Comparing daylengths one hour below and above each site’s average, the evening-to-morning ratio of exposure changed by −16.6% before the DLMO reference (95% CI −66.6% to +108.5%) and +159.1% after MSFsc (95% CI +5.9% to +534.2%). Conceptual phase-response-curve weighting gave higher advance-weighted exposure indices in extreme evening than extreme morning types, but the group differences were not statistically significant. These indices summarize exposure timing and do not predict phase shifts.
2 Background and aims
MeLiDos is a multicentre study of personal light exposure during everyday life. Participants wore light loggers near the eyes and on the chest and recorded sleep, device removal, and daily activities. A common protocol was used at nine sites in seven countries, with measurements collected between August 2023 and October 2025. Participants were recruited through the participating research groups rather than through population sampling (Zauner, Didikoglu, Aerts, et al. 2026).
This analysis uses prepared measurements and diary data from the MeLiDos analysis repository (MeLiDos analysis project 2026b). The accompanying preprint is The health-relevant architecture of the everyday light exposome (Zauner, Didikoglu, Aerts, et al. 2026). The imported files are included in this project, with a fixed source snapshot and checksums, so the analysis can run without a second repository checkout.
The primary question is whether chronotype differences in daily exposure persist after aligning observations to circadian phase, operationalized through midsleep on free days corrected for sleep debt (MSFsc). We also compare work and free days to test whether daily schedules change the exposure patterns and chronotype differences. The outcome is melanopic equivalent daylight illuminance, abbreviated melanopic EDI: light weighted for melanopsin sensitivity and expressed as an equivalent daylight illuminance in lux. Near-eye measurements are primary. Chest measurements provide a sensitivity check, informed by the sensor-placement study by Zauner, de Vries, et al. (2026), which found close agreement for some exposure metrics and placement-dependent differences for others. During recorded sleep, the loggers were placed near the bed, so those readings describe the sleeping environment (Zauner, Didikoglu, Aerts, et al. 2026).
Chronotype groups are defined by MSFsc quartiles: extreme morning, moderate morning, moderate evening and extreme evening. Chronotype direction distinguishes morning from evening, and chronotype strength distinguishes extreme from moderate groups. The median of 04:16 falls within a published MCTQ intermediate range of 04:00–04:59 (Juda et al. 2013). The Morningness–Eveningness Questionnaire, or MEQ, measures preferred timing of sleep and activity (Horne and Östberg 1976) and provides an alternative group definition in a sensitivity analysis.
We compare local clock time with time relative to each participant’s MSFsc as a sleep-based measure of individual circadian phase. Dim-light melatonin onset, or DLMO, was not measured in MeLiDos. The diagonally striped bands show a published DLMO reference interval, 6.95–5.95 hours before MSFsc, derived from the early- and late-group means in 38 healthy adults (mean age 22.7 years, SD 4.2) studied by Facer-Childs et al. (2019). This interval does not estimate individual DLMO (Kantermann et al. 2015).
After examining the main results, we added an exploratory, post hoc daylength analysis. The hypothesis is that daylight timing contributes to the phase-dependent differences between extreme morning and evening types. Morning types reach their evening circadian phase earlier in clock time, when daylight may still be available; evening types encounter sunrise earlier relative to their own phase. If daylight contributes to these differences, the morning–evening contrast before the DLMO reference and after MSFsc should be larger on longer days and smaller on shorter days. We examine this pattern by adding daylength moderation to the phase model and by plotting civil dawn and dusk relative to MSFsc.
A second exploratory analysis asks whether the timing of light exposure is consistent with an advancing pattern in extreme evening types and a delaying pattern in extreme morning types. We weight the estimated exposure curves of these two groups by a published light phase-response curve (PRC) (St Hilaire et al. 2012) and integrate over 24 hours, using the DLMO reference interval to align the time coordinates. The resulting signed indices summarize exposure across phases associated with advances and delays. Comparing the published raw PRC with its drift-corrected form tests how the baseline affects this interpretation; the indices describe exposure patterns rather than measured shifts of the circadian clock.
3 Data and sample
The analysis uses R 4.6.1 and the existing tested package versions, recorded in this project’s renv.lock. The input guide describes the copied data and source attribution; the snapshot manifest records their original paths, source commit and checksums. Reusable helper files handle repeated fits, contrasts, validation and attribution. Their inputs, choices and results appear below in analysis order, and the complete files are linked at the end. The small table_data(), show_table() and show_figure() helpers are reused throughout: they read exported tables, apply common gt formatting, and display figures. The table-formatting code changes presentation only.
3.1 Prepared measurements and additional exclusions
The daily-pattern data, prepared in the source repository, supply 30-minute arithmetic-mean melanopic EDI. A bin needs at least 15 valid minutes. Zeros remain in the analysis; the response is log10(melanopic EDI + 0.1). Work/free-day labels come from the diary’s waking date. We require MSFsc and a day-type label for both time representations. The source repository calls its daily-pattern analysis H02, originating from preregistered hypothesis 02 on within-participant versus between-site variation in hourly melanopic EDI (Zauner, Didikoglu, and Spitschan 2026; MeLiDos analysis project 2026a). That identifier is retained in imported filenames for traceability.
1prepared <- prepare_data()
show_table(prepared$flow)- 1
- Join the prepared light measurements, participant information and waking-date diary labels. The shared registry records each exclusion and supplies sample counts throughout the report.
| Placement | Participants | Participant-days | Valid half-hours | Stage |
|---|---|---|---|---|
| glasses | 141 | 816 | 37,756 | Prepared sensor sample |
| glasses | 140 | 810 | 37,479 | MSFsc available |
| glasses | 140 | 778 | 35,949 | MSFsc and day type available |
| Chest | 154 | 902 | 41,842 | Prepared sensor sample |
| Chest | 153 | 896 | 41,565 | MSFsc available |
| Chest | 153 | 864 | 40,039 | MSFsc and day type available |
The sample flow in Table 1 starts with 141 participants and 816 participant-days with near-eye measurements. One participant has no MSFsc, removing 6 days. A further 32 days across 24 retained participants have no diary record for that waking date. The joint analysis therefore contains 140 participants, 778 participant-days and 35,949 half-hours. The removed days still have light measurements; they cannot contribute to a model that requires a work/free label. The complete day-inclusion registry records these decisions.
Both models use exactly the same records (Table 2) and preserve their sequence order. Clock time is the local bin midpoint. Phase is clock time minus MSFsc, wrapped over 24 hours. Negative values on the phase plots precede MSFsc.
near_eye <- prepared$frames$glasses
stopifnot(all(near_eye$clock == (near_eye$clock_bin + 15) / 60))
stopifnot(all.equal(near_eye$phase_display,
((near_eye$clock - near_eye$msf_hours + 12) %% 24) - 12))
show_table(count_sample(near_eye))| Participants | Participant-days | Valid half-hours |
|---|---|---|
| 140 | 778 | 35,949 |
The primary sample comprises 78 female and 62 male participants, with a median age of 27 years (range 18–68). The demographic verification script joins the frozen demographic input to the primary participant registry and exports the summary below; its runtime record documents inputs and R/package versions.
show_table(table_data("primary_demographics"), digits = 0)| Participants | Female | Male | Median age | Minimum age | Maximum age |
|---|---|---|---|---|---|
| 140 | 78 | 62 | 27 | 18 | 68 |
3.2 Chronotype groups
Quartiles use one MSFsc value per participant, so each person contributes equally. We use R’s default quantile calculation (type = 7): after sorting the values, it locates the 25th, 50th and 75th percentiles and interpolates linearly between adjacent values when a percentile falls between them. Values equal to a boundary stay in the earlier quartile, so ties are never split. The cutoffs are fixed across work/free days and sensor placements.
cutoffs <- quantile(distinct(near_eye, participant_key, msf_hours)$msf_hours,
c(0.25, 0.50, 0.75), type = 7)
show_table(table_data("quartile_cutoffs") |>
select(percentile, msf_hours, clock_time),
labels = c(msf_hours = "MSFsc (hours)", clock_time = "Clock time"))| Percentile | MSFsc (hours) | Clock time |
|---|---|---|
| 25 | 3.167 | 03:10 |
| 50 | 4.264 | 04:16 |
| 75 | 5.250 | 05:15 |
The boundaries are 03:10, 04:16, and 05:15 (Table 4). A published Munich ChronoType Questionnaire (MCTQ) classification places MSFsc from 04:00 to 04:59 in an intermediate range (Juda et al. 2013). This supports moderate-morning and moderate-evening labels on either side of the sample median. Table 5 summarizes the resulting groups.
groups <- table_data("quartile_distribution")
groups[c("minimum", "median", "maximum")] <-
lapply(groups[c("minimum", "median", "maximum")], clock_label)
show_table(groups)| Quartile | Chronotype direction | Chronotype strength | Participants | Minimum | Median | Maximum | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| Q1 | Morning | Extreme | 36 | 01:20 | 02:41 | 03:10 | 200 | 9,241 |
| Q2 | Morning | Moderate | 34 | 03:11 | 03:48 | 04:14 | 188 | 8,656 |
| Q3 | Evening | Moderate | 36 | 04:18 | 04:47 | 05:15 | 200 | 9,227 |
| Q4 | Evening | Extreme | 34 | 05:16 | 05:52 | 08:08 | 190 | 8,825 |
The recorded MEQ categories provide a useful comparison (Table 6). The two measures are related but describe different aspects of chronotype. Here, 18 of 34 people in Q2 and 23 of 36 in Q3 are intermediate by MEQ. Group classifications from MSFsc, MEQ and DLMO can disagree (Reiter et al. 2021).
meq_order <- c("Definitely morning type", "Moderately morning type",
"Intermediate", "Moderately evening type",
"Definitely evening type")
meq_overlap <- table_data("quartile_meq_overlap") |>
mutate(sample = paste(participants, participant_days, sep = " / ")) |>
select(quartile, meq_type, sample) |>
pivot_wider(names_from = meq_type, values_from = sample, values_fill = "0 / 0") |>
select(quartile, all_of(meq_order))
show_table(meq_overlap)| Quartile | Definitely morning type | Moderately morning type | Intermediate | Moderately evening type | Definitely evening type |
|---|---|---|---|---|---|
| Q1 | 6 / 29 | 20 / 116 | 10 / 55 | 0 / 0 | 0 / 0 |
| Q2 | 0 / 0 | 13 / 69 | 18 / 101 | 3 / 18 | 0 / 0 |
| Q3 | 0 / 0 | 5 / 28 | 23 / 129 | 7 / 38 | 1 / 5 |
| Q4 | 0 / 0 | 0 / 0 | 21 / 114 | 11 / 64 | 2 / 12 |
Figure 1 shows the participant distributions of MSFsc and MEQ score. Both histograms include each of the 140 participants once. Participant-day counts describe the exposure records available for each group; they do not weight the histograms. Both panels use the same colors for MSFsc quartiles, with fixed cutoffs from the complete near-eye sample. The MEQ histogram includes the intermediate group, which is excluded only from the MEQ morning-versus-evening sensitivity.
distribution_source <- prepared$frames$glasses
distribution_people <- distribution_source |>
distinct(participant_key, site, msf_hours, quartile, meq, meq_type) |>
left_join(distribution_source |>
summarise(participant_days = n_distinct(participant_day_key),
half_hours = n(), .by = participant_key),
by = "participant_key", relationship = "one-to-one")
stopifnot(!anyDuplicated(distribution_people$participant_key))
msfsc_names <- c(Q1 = "Extreme morning", Q2 = "Moderate morning",
Q3 = "Moderate evening", Q4 = "Extreme evening")
distribution_people$quartile <- factor(distribution_people$quartile,
levels = names(msfsc_names))
distribution_meq_order <- c("Definitely evening type", "Moderately evening type",
"Intermediate", "Moderately morning type",
"Definitely morning type")
distribution_people$meq_type <- factor(distribution_people$meq_type,
levels = distribution_meq_order)
msfsc_distribution_counts <- distribution_people |>
summarise(participants = n(), participant_days = sum(participant_days),
half_hours = sum(half_hours), .by = quartile) |>
arrange(quartile) |>
mutate(group = unname(msfsc_names[as.character(quartile)]))
meq_distribution_counts <- distribution_people |>
summarise(participants = n(), participant_days = sum(participant_days),
half_hours = sum(half_hours), .by = meq_type) |>
arrange(meq_type)
save_table(distribution_people, "chronotype_distribution_registry")
save_table(msfsc_distribution_counts, "chronotype_distribution_msfsc_groups")
save_table(meq_distribution_counts, "chronotype_distribution_meq_groups")msfsc_colors <- c(Q1 = "#0072B2", Q2 = "#56B4E9",
Q3 = "#E69F00", Q4 = "#D55E00")
msfsc_legend <- setNames(
paste0(msfsc_distribution_counts$quartile, ": ",
msfsc_distribution_counts$group, "\n",
msfsc_distribution_counts$participants, " participants; ",
msfsc_distribution_counts$participant_days, " participant-days"),
msfsc_distribution_counts$quartile)
msfsc_histogram <- ggplot(distribution_people,
aes(msf_hours, fill = quartile)) +
geom_histogram(binwidth = 20 / 60, boundary = 0, closed = "left",
color = "white", linewidth = 0.2) +
geom_vline(xintercept = prepared$cutoffs, linetype = "dashed",
color = "grey35", linewidth = 0.4) +
scale_fill_manual(values = msfsc_colors, labels = msfsc_legend) +
scale_x_continuous(breaks = 0:12, labels = clock_label) +
scale_y_continuous(breaks = scales::breaks_width(5),
expand = expansion(mult = c(0, 0.08))) +
guides(fill = guide_legend(nrow = 2, byrow = TRUE)) +
labs(tag = "A", title = "MCTQ: corrected midsleep on free days",
x = "MSFsc (local clock time)", y = "Participants", fill = NULL,
subtitle = paste("Quartile cutoffs:",
paste(clock_label(prepared$cutoffs), collapse = ", ")))
meq_category_labels <- meq_distribution_counts |>
mutate(x = c(23.25, 36, 50, 64, 77.75),
label = paste0(sub(" type$", "", meq_type) |>
sub(" ", "\n", x = _), "\n",
participants, " people / ", participant_days, " days"))
meq_histogram_height <- max(table(distribution_people$meq))
meq_histogram <- ggplot(distribution_people,
aes(meq, fill = quartile)) +
geom_histogram(binwidth = 1, boundary = 0.5, closed = "left",
color = "white", linewidth = 0.2) +
geom_vline(xintercept = c(30.5, 41.5, 58.5, 69.5),
linetype = "dashed", color = "grey35", linewidth = 0.4) +
geom_text(data = meq_category_labels,
aes(x = x, y = meq_histogram_height * 1.30, label = label),
inherit.aes = FALSE, size = 3.2, vjust = 1, lineheight = 0.95) +
scale_fill_manual(values = msfsc_colors, labels = msfsc_legend) +
scale_x_continuous(breaks = c(16, 30, 41, 58, 69, 86)) +
coord_cartesian(xlim = c(16, 86)) +
scale_y_continuous(breaks = scales::breaks_width(2),
expand = expansion(mult = c(0, 0.04))) +
guides(fill = guide_legend(nrow = 2, byrow = TRUE)) +
labs(tag = "B", title = "Morningness-Eveningness Questionnaire",
x = "MEQ score (higher scores indicate morning preference)",
y = "Participants", fill = NULL,
subtitle = "Intermediate participants are shown here and excluded from the MEQ sensitivity.")
chronotype_distribution_plot <- patchwork::wrap_plots(
msfsc_histogram, meq_histogram, ncol = 1, guides = "collect") +
patchwork::plot_annotation(
title = "Chronotype distributions",
subtitle = sample_label(distribution_source),
caption = "Each participant contributes once to each histogram. Colors indicate MSFsc quartiles in both panels.\nThe MEQ category labels give people / participant-days; the shared legend gives MSFsc group counts.")
save_plot(chronotype_distribution_plot, "chronotype_distributions", 13, 11)
knitr::include_graphics("results/figures/chronotype_distributions.png")Table 7 gives the work/free-day counts available within each quartile.
show_table(table_data("group_day_counts") |>
filter(placement == "glasses") |>
select(-placement))| Quartile | Daytype | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|
| Q1 | Work | 35 | 116 | 5,354 |
| Q1 | Free | 35 | 84 | 3,887 |
| Q2 | Work | 34 | 119 | 5,473 |
| Q2 | Free | 29 | 69 | 3,183 |
| Q3 | Work | 36 | 116 | 5,352 |
| Q3 | Free | 36 | 84 | 3,875 |
| Q4 | Work | 33 | 111 | 5,165 |
| Q4 | Free | 33 | 79 | 3,660 |
4 Model specification
The models extend the source study’s daily-pattern analysis (Zauner, Didikoglu, Aerts, et al. 2026; MeLiDos analysis project 2026a) by making every daily curve cyclic: the end of one day joins smoothly to the start of the next. They use Gaussian errors on the transformed response and the R package mgcv’s discrete bam() fitting with fast restricted maximum likelihood (fREML) (Wood 2017; Wood et al. 2017). Each model has a common daily curve, quartile and day-type deviations and their interaction, site deviations, individual random curves, participant-day random intercepts, and photoperiod effects.
All daily curves are cyclic cubic splines. The sum-to-zero sz basis estimates curve effects for categorical groups, including quartile, day type and site; the deviations sum to zero across the relevant factor levels. The fs basis supplies smooth random participant effects around those shared curves. Population/group/site bases use k = 12, participant bases use k = 10, and photoperiod uses a cubic regression spline with k = 5. The time-by-photoperiod interaction uses ti() with marginal dimensions k = c(12, 5). Photoperiod is the duration from civil dawn to civil dusk, calculated using the suntools package through the LightLogR::photoperiod() wrapper. It is centered using the mean over distinct dates within each site.
formula_used <- model_formula()
formula_usedresponse ~ s(t, bs = "cc", k = 12) + s(t, quartile, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, daytype, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, quartile, daytype, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, site, bs = "sz", xt = list(bs = "cc"),
k = 12) + s(photo, bs = "cr", k = 5) + ti(t, photo, bs = c("cc",
"cr"), k = c(12, 5)) + s(t, participant, bs = "fs", xt = list(bs = "cc"),
k = 10) + s(participant_day, bs = "re")
<environment: 0x7beeedecb8>
The sz terms include level effects, so no duplicate quartile, day-type or site intercepts are added. The standard sz penalties are estimated separately. In the installed mgcv version, linking the cyclic sz penalties with id produced a numerical rank failure; removing id retained sz, its sum-to-zero constraints, and cyclic cubic margins.
A separate basis-sensitivity notebook compares these models with noncyclic cubic margins for every sz term. It retains the cyclic common curve and the original participant fs and time-by-photoperiod ti() structures, isolating the change to categorical-group curves. The primary models remain unchanged. Ordinary in-sample R² changes by less than 0.0001 on either time coordinate. The noncyclic group curves introduce small jumps at midnight or, for the phase model, at MSFsc; the overall endpoint intervals include continuity. The post-MSFsc extreme-group interval remains, from 0.92 to 4.25 hours, with an average evening/morning factor of 13.24. The earlier interval no longer excludes a factor of one under the simultaneous bands, so its inferential status is sensitive to the endpoint specification. The repeating daily pattern therefore retains cyclic group curves in the primary specification.
The quartile-by-day model estimates all eight group/day curves. Chronotype direction, chronotype strength and their interactions are contrasts of those curves. For attribution subsets, direction alone or strength alone receives its corresponding two-level smooth; when both are present, the four-level quartile smooth is used. A day-type interaction enters only with its contributing non-interaction factors, so it is interpreted together with their effects.
A preliminary fit checks the mean structure before estimating the residual correlation between adjacent observations. The first-order autoregressive correction, AR(1), follows elapsed time in UTC and resets at every participant-day, missing interval, gap and ambiguous daylight-saving link. Phase wrapping does not reorder observations.
preprocessing <- fit_preprocess(near_eye, prepared$cutoffs)
# Reuse only fits with matching data and formula signatures.
clock_model <- fit_pair(near_eye, preprocessing, "clock", "primary")
clock_summary <- model_summary(clock_model)
rm(clock_model); invisible(gc())
1phase_model <- fit_pair(near_eye, preprocessing, "phase", "primary")
phase_summary <- model_summary(phase_model)
rm(phase_model); invisible(gc())
show_table(bind_rows(clock_summary, phase_summary) |>
select(axis, rho, edf, convergence, participants,
participant_days, half_hours))- 1
- Fit the same model to the same observations using circadian phase in place of clock time. Only the time coordinate changes; chronological ordering and the rules for residual correlation stay the same. Matching saved fits can be reused.
| Axis | Rho | Edf | Convergence | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|
| clock | 0.594 | 1,095.208 | TRUE | 140 | 778 | 35,949 |
| phase | 0.596 | 1,127.071 | TRUE | 140 | 778 | 35,949 |
5 Model checks and sensitivity
The fitted-model summary is given in Table 8. Diagnostics precede interpretation; Table 9 gives the overview. The saved checks cover convergence, basis adequacy, residual distribution, spread, residual patterns, concurvity, sequence-specific autocorrelation, cyclic continuity, and participant/site influence. Gratia supplies the visual diagnostic bundle and coefficient simulation (Simpson 2024).
diagnostics <- table_data("diagnostic_verdicts") |> filter(model == "primary")
show_table(diagnostics |>
select(axis, convergence_ok, basis_flag, standardized_lag1,
spread_ratio, cyclic_ok, participants, participant_days, half_hours))| Axis | Convergence ok | Basis flag | Standardized lag1 | Spread ratio | Cyclic ok | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| clock | TRUE | FALSE | 0.079 | 5.636 | TRUE | 140 | 778 | 35,949 |
| phase | TRUE | FALSE | 0.080 | 5.912 | TRUE | 140 | 778 | 35,949 |
The large global spread ratios mainly reflect the response floor and the concentration of observations there. Zero exposure maps to log10(0 + 0.1) = −1, and 31.6% of half-hours are exactly zero. Raw residuals therefore have a lower boundary of −1 − fitted, producing an asymmetric pattern at low exposure. Across fitted-value deciles, the raw residual-SD ratios are 5.64 for clock and 5.91 for phase. Rebuilding deciles among positive observations reduces them to 1.19 and 1.17; restricting instead to fitted exposure of at least 1 lux gives 1.40 in both models (Table 10). These checks associate most of the global spread pattern with the floor, rather than large variance changes throughout positive exposure. They do not directly validate coverage of the full Gaussian model’s uncertainty bands, which remain approximate near the boundary.
floor_checks <- table_data("revision_floor_audit_spread_summaries", "results/provenance") |>
filter(fit_kind == "primary", stratum %in% c("all", "positive", "fitted_at_least_1_lx")) |>
select(axis, stratum, half_hours, raw_sd_ratio, innovation_sd_ratio) |>
mutate(stratum = recode(stratum, all = "All observations",
positive = "Observed EDI > 0 lux", fitted_at_least_1_lx = "Fitted EDI ≥ 1 lux"))
show_table(floor_checks, labels = c(stratum = "Diagnostic stratum",
raw_sd_ratio = "Raw residual SD ratio", innovation_sd_ratio = "AR innovation SD ratio"))| Axis | Diagnostic stratum | Valid half-hours | Raw residual SD ratio | AR innovation SD ratio |
|---|---|---|---|---|
| clock | All observations | 35,949 | 5.636 | 5.534 |
| clock | Observed EDI > 0 lux | 24,600 | 1.187 | 1.104 |
| clock | Fitted EDI ≥ 1 lux | 23,897 | 1.401 | 1.265 |
| phase | All observations | 35,949 | 5.912 | 6.406 |
| phase | Observed EDI > 0 lux | 24,600 | 1.166 | 1.104 |
| phase | Fitted EDI ≥ 1 lux | 23,851 | 1.399 | 1.244 |
The R floor audit, with checks for the additional models, also checks exposure thresholds and adjacent observations within the original AR sequences. The variance-weighted fits below remain sensitivity checks; the original Gaussian model is the common reference for the reported candidate intervals.
High concurvity between individual curves and population/group curves is expected because the individual curves can reproduce parts of the population pattern. Penalization separates these terms. Attribution therefore describes this fitted decomposition; it does not identify independent biological contributions.
Figure 2 shows residual distributions and fitted-value patterns; Figure 3 checks serial dependence, and Figure 4 shows how residual spread changes across exposure levels.
show_figure("primary_clock_appraise")show_figure("primary_clock_acf")The corresponding circadian-phase checks are in Figure 5, Figure 6 and Figure 7.
show_figure("primary_phase_appraise")show_figure("primary_phase_acf")Table 11 assesses whether the chosen basis dimensions can represent the fitted patterns. Figure 8 checks the remaining structure by time and group.
basis <- bind_rows(lapply(c("clock", "phase"), function(axis) {
table_data(paste0("primary_", axis, "_basis"), "results/diagnostics") |>
mutate(axis = axis, .before = 1)
}))
show_table(basis)| Axis | Term | K' | Edf | K-index | P-value | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| clock | s(t) | 10 | 9.854 | 0.978 | 0.055 | 140 | 778 | 35,949 |
| clock | s(t,quartile) | 33 | 24.333 | NA | NA | 140 | 778 | 35,949 |
| clock | s(t,daytype) | 11 | 10.486 | NA | NA | 140 | 778 | 35,949 |
| clock | s(t,quartile,daytype) | 33 | 17.523 | NA | NA | 140 | 778 | 35,949 |
| clock | s(t,site) | 88 | 57.401 | NA | NA | 140 | 778 | 35,949 |
| clock | s(photo) | 4 | 2.061 | 1.001 | 0.500 | 140 | 778 | 35,949 |
| clock | ti(photo,t) | 40 | 24.717 | 1.000 | 0.420 | 140 | 778 | 35,949 |
| clock | s(t,participant) | 1,260 | 620.581 | 0.978 | 0.075 | 140 | 778 | 35,949 |
| clock | s(participant_day) | 778 | 327.254 | NA | NA | 140 | 778 | 35,949 |
| phase | s(t) | 10 | 9.786 | 1.000 | 0.490 | 140 | 778 | 35,949 |
| phase | s(t,quartile) | 33 | 25.820 | NA | NA | 140 | 778 | 35,949 |
| phase | s(t,daytype) | 11 | 10.323 | NA | NA | 140 | 778 | 35,949 |
| phase | s(t,quartile,daytype) | 33 | 13.441 | NA | NA | 140 | 778 | 35,949 |
| phase | s(t,site) | 88 | 48.704 | NA | NA | 140 | 778 | 35,949 |
| phase | s(photo) | 4 | 2.109 | 0.999 | 0.470 | 140 | 778 | 35,949 |
| phase | ti(photo,t) | 40 | 19.419 | 0.988 | 0.150 | 140 | 778 | 35,949 |
| phase | s(t,participant) | 1,260 | 674.762 | 1.000 | 0.475 | 140 | 778 | 35,949 |
| phase | s(participant_day) | 778 | 321.707 | NA | NA | 140 | 778 | 35,949 |
show_figure("primary_clock_residual_patterns")
show_figure("primary_phase_residual_patterns")Table 12 describes overlap among model components, and Table 13 checks that values and slopes meet at the daily boundary.
concurvity <- bind_rows(lapply(c("clock", "phase"), function(axis) {
table_data(paste0("primary_", axis, "_concurvity"), "results/diagnostics") |>
mutate(axis = axis, .before = 1)
}))
show_table(concurvity |> filter(.type == "estimate"))| Axis | Type | Term | Concurvity | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|
| clock | estimate | para | 1.000 | 140 | 778 | 35,949 |
| clock | estimate | s(t) | 0.926 | 140 | 778 | 35,949 |
| clock | estimate | s(t,quartile) | 0.944 | 140 | 778 | 35,949 |
| clock | estimate | s(t,daytype) | 0.398 | 140 | 778 | 35,949 |
| clock | estimate | s(t,quartile,daytype) | 0.392 | 140 | 778 | 35,949 |
| clock | estimate | s(t,site) | 0.930 | 140 | 778 | 35,949 |
| clock | estimate | s(photo) | 1.000 | 140 | 778 | 35,949 |
| clock | estimate | ti(photo,t) | 0.922 | 140 | 778 | 35,949 |
| clock | estimate | s(t,participant) | 0.221 | 140 | 778 | 35,949 |
| clock | estimate | s(participant_day) | 0.194 | 140 | 778 | 35,949 |
| phase | estimate | para | 1.000 | 140 | 778 | 35,949 |
| phase | estimate | s(t) | 0.917 | 140 | 778 | 35,949 |
| phase | estimate | s(t,quartile) | 0.933 | 140 | 778 | 35,949 |
| phase | estimate | s(t,daytype) | 0.327 | 140 | 778 | 35,949 |
| phase | estimate | s(t,quartile,daytype) | 0.323 | 140 | 778 | 35,949 |
| phase | estimate | s(t,site) | 0.919 | 140 | 778 | 35,949 |
| phase | estimate | s(photo) | 1.000 | 140 | 778 | 35,949 |
| phase | estimate | ti(photo,t) | 0.922 | 140 | 778 | 35,949 |
| phase | estimate | s(t,participant) | 0.221 | 140 | 778 | 35,949 |
| phase | estimate | s(participant_day) | 0.194 | 140 | 778 | 35,949 |
show_table(bind_rows(lapply(c("clock", "phase"), function(axis) {
table_data(paste0("primary_", axis, "_cyclic_continuity"), "results/diagnostics") |>
mutate(axis = axis, .before = 1)
})), digits = 7)| Axis | Maximum endpoint difference | Maximum derivative difference | Evaluated rows | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|
| clock | 0.0000000 | 0.0000766 | 271 | 140 | 778 | 35,949 |
| phase | 0.0000000 | 0.0000663 | 271 | 140 | 778 | 35,949 |
The sensitivity fits increase the daily basis to 18 and the participant basis to 14, move rho by ±0.10, remove the site with the most concentrated quartile distribution, remove the participant with the largest residual RMSE, and apply variance weights. Cutoffs stay fixed. Predictions use the original common photoperiod distribution and day-type weights, so changes compare the same estimand.
Table 14 quantifies how the registered contrasts change under each sensitivity scenario.
sensitivity <- table_data("sensitivity_summary")
show_table(sensitivity |>
select(axis, sensitivity, maximum_contrast_change, rms_contrast_change,
deleted, convergence, participants, participant_days, half_hours))| Axis | Sensitivity | Maximum contrast change | Rms contrast change | Deleted | Convergence | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| clock | larger_basis | 0.200 | 0.034 | TRUE | 140 | 778 | 35,949 | |
| clock | lower_rho | 0.041 | 0.013 | TRUE | 140 | 778 | 35,949 | |
| clock | higher_rho | 0.220 | 0.036 | TRUE | 140 | 778 | 35,949 | |
| clock | delete_site | 0.376 | 0.083 | KNUST | TRUE | 125 | 697 | 32,248 |
| clock | delete_participant | 0.063 | 0.014 | KNUST::KNUST_S008 | TRUE | 139 | 773 | 35,729 |
| clock | variance_weighted | 0.202 | 0.053 | TRUE | 140 | 778 | 35,949 | |
| phase | larger_basis | 0.259 | 0.043 | TRUE | 140 | 778 | 35,949 | |
| phase | lower_rho | 0.050 | 0.014 | TRUE | 140 | 778 | 35,949 | |
| phase | higher_rho | 0.084 | 0.019 | TRUE | 140 | 778 | 35,949 | |
| phase | delete_site | 0.337 | 0.074 | KNUST | TRUE | 125 | 697 | 32,248 |
| phase | delete_participant | 0.113 | 0.028 | KNUST::KNUST_S008 | TRUE | 139 | 773 | 35,729 |
| phase | variance_weighted | 0.283 | 0.060 | TRUE | 140 | 778 | 35,949 |
The variance-weighted fits have AR-innovation SD ratios of 5.01 for clock and 3.66 for phase across all observations, falling to 1.57 and 1.51 among positive observations. Weighting does not remove the response boundary, and these global ratios should not be read as evidence of a general variance failure. The two-step weights are estimated from the data, with uncertainty that the usual coefficient covariance does not include; they remain a sensitivity analysis rather than a demonstrated correction to the reference model.
Site deletion does show a material sensitivity: removing Kumasi (KNUST) leaves 125 participants and 697 participant-days and changes registered contrast estimates by up to 0.38 log10 units for clock and 0.34 for phase. Separately, only 43 of 140 clock-model peaks and 41 of 140 phase-model peaks meet the declared timing-localization rule (Table 22). For the others, the fitted curve is more informative than a precise peak time. A comparison restricted to sites with both chronotype groups would address site composition more directly, but has not been fitted here.
6 Daily exposure patterns
The main curves set site, participant and participant-day effects to zero, representing the average of these effects on the fitted log scale. They average over one common distribution of within-site-centered photoperiod, giving each participant equal weight and each of that participant’s observed days equal weight. Overall curves also use the same pooled participant-weighted work/free mixture in every chronotype group.
For the primary exposure curves, 10,000 joint coefficient draws form 95% simultaneous bands across all 12 quartile-by-day-context curves and the 10-minute grid within each time coordinate. Clock time and MSFsc-relative time are treated separately.
Intensity curves and their bands are back-transformed with 10^estimate - 0.1 and shown in lux. The symlog axis is linear up to 1 lux and logarithmic above 1 lux, following the approach to visualizing zero-containing light-exposure data described by Zauner et al. (2025). These are back-transformed standardized log-scale means. Small negative bounds from the Gaussian model remain visible. The fitted response remains log10(melanopic EDI + 0.1).
The panel arrangement follows the clock-versus-phase comparison in Goulet et al. (2007). That paper used MEQ groups and measured DLMO to distinguish phase extremes. Here both the groups and the phase coordinate use MSFsc. The implications of these differences are discussed in Section 16.
Figure 9, Figure 10 and Figure 11 show overall, work-day and free-day comparisons with a common layout and explicit participant and participant-day counts for each curve. A identifies clock time and B identifies circadian phase, expressed as hours relative to MSFsc. Columns distinguish moderate from extreme chronotype strength.
6.1 The published DLMO reference interval
Facer-Childs et al. report group means for MSFsc and DLMO in Table 1 (Facer-Childs et al. 2019). Their offsets place DLMO approximately 6 to 7 hours before MSFsc (Table 15). The diagonally striped vertical band spans those two group-average offsets.
reference_times <- tibble(
group = c("Early", "Late"),
MSFsc = c(2 + 24/60, 6 + 52/60),
DLMO = c(20 + 27/60, 23 + 55/60)
) |> mutate(hours_relative_to_MSFsc = ((DLMO - MSFsc + 12) %% 24) - 12)
show_table(reference_times)| Group | MSFsc | DLMO | Hours relative to MSFsc |
|---|---|---|---|
| Early | 2.400 | 20.450 | −5.950 |
| Late | 6.867 | 23.917 | −6.950 |
MSFsc and DLMO can be strongly related across people, but the offset varies between individuals. Kantermann et al. found an MSFsc-DLMO correlation of 0.68 and a substantial DLMO range at a given MSFsc (Kantermann et al. 2015). Reiter et al. found a weaker relationship and limited agreement between chronotype categories (Reiter et al. 2021). The reference interval is labelled DLMO reference. It represents literature-based group means; the circadian-phase axis remains anchored to MSFsc.
show_figure("primary_patterns_overall")7 Difference curves and candidate intervals
The comparisons were defined before fitting: evening minus morning within each chronotype-strength group; extreme minus moderate within each chronotype direction; free minus work within each quartile; three two-way interaction contrasts; and the three-way interaction. The first two sets include overall, work and free-day comparisons, giving 20 registered contrast curves per time representation.
Each curve is evaluated every 10 minutes. Ten thousand joint coefficient draws form 95% simultaneous bands over all 20 registered contrasts and times within each time coordinate. Clock time and MSFsc-relative phase address separate, literature-based questions: differences in daily schedules and differences after phase alignment. We therefore define each coordinate as a separate inferential family, without an additional adjustment across the two models. The bands account for inspecting the full contrast family and phase or clock-time grid within that coordinate; nearby times remain correlated. Smoothing-parameter covariance corrections are included when available (Wood et al. 2016). These intervals condition on the estimated AR parameter and quartile boundaries. Table 16 records the covariance treatment.
inference_settings <- bind_rows(lapply(c("clock", "phase"), function(axis) {
table_data(paste0("primary_", axis, "_inference_metadata"))
}))
show_table(inference_settings |>
select(axis, axis_family_coverage, covariance, draws, critical, free_day_weight,
participants, participant_days, half_hours))| Axis | Axis family coverage | Covariance | Draws | Critical | Free day weight | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| clock | 0.950 | Bayesian coefficient covariance with smoothing-parameter correction (Vc) | 10,000 | 3.659 | 0.405 | 140 | 778 | 35,949 |
| phase | 0.950 | Bayesian coefficient covariance with smoothing-parameter correction (Vc) | 10,000 | 3.653 | 0.405 | 140 | 778 | 35,949 |
Support is assessed in local half-hour bins. We require at least four participants in every contributing quartile/day cell; this is an analyst-chosen support rule, not a published threshold. A time point enters an interval claim only if it passes that rule. Interval tables count unique participants and days with observed bin midpoints inside that interval. Intervals crossing midnight or the phase boundary are merged.
The difference plots show factors for melanopic EDI + 0.1, calculated as 10^contrast, with the same transformation applied to the uncertainty bounds. The logarithmic factor axis places 1 at no difference, 2 at twice, and 0.5 at half the reference value. The reference is morning for evening/morning comparisons, moderate for extreme/moderate comparisons, and work days for free/work comparisons. Interaction contrasts become ratios of ratios; 1 means no interaction. This display preserves the registered contrasts, support rules and simultaneous-band inference.
Prepare the interval tables
windows <- bind_rows(lapply(c("clock", "phase"), function(axis) {
table_data(paste0("primary_", axis, "_significant_windows"))
}))
windows_display <- windows |>
mutate(start_label = if_else(axis == "clock", clock_label(start), sprintf("%.2f", start)),
end_label = if_else(axis == "clock", clock_label(end), sprintf("%.2f", end)),
positive_sample = paste(positive_participants, positive_days, positive_half_hours, sep = " / "),
negative_sample = paste(negative_participants, negative_days, negative_half_hours, sep = " / ")) |>
select(axis, contrast, description, context, direction, start_label, end_label,
wraps_boundary, duration_hours, mean_log10_difference = mean_difference,
factor_at_mean_difference = mean_ratio,
positive_sample, negative_sample)
show_interval_table <- function(pattern) {
selected <- windows_display |> filter(grepl(pattern, contrast)) |> select(-contrast)
if (!nrow(selected)) {
return(show_table(tibble(Result = "No supported candidate intervals for these comparisons.")))
}
show_table(selected, labels = c(direction = "Contrast sign"))
}Figure 12 shows the comparisons; Table 17 lists their supported candidate intervals.
show_figure(paste0("primary_evening_minus_morning_", c("overall", "work", "free")))show_interval_table("evening_morning_")| Axis | Description | Context | Contrast sign | Start label | End label | Wraps boundary | Duration hours | Mean log10 difference | Factor at mean difference | Positive sample | Negative sample |
|---|---|---|---|---|---|---|---|---|---|---|---|
| clock | Evening minus morning: Extreme | Overall | Positive | 22:55 | 00:45 | TRUE | 1.833 | 0.834 | 6.823 | 34 / 190 / 526 | 36 / 200 / 595 |
| clock | Evening minus morning: Extreme | Overall | Negative | 07:05 | 09:35 | FALSE | 2.500 | −0.823 | 0.150 | 34 / 190 / 943 | 36 / 199 / 951 |
| clock | Evening minus morning: Extreme | Work | Positive | 22:55 | 00:35 | TRUE | 1.667 | 0.837 | 6.877 | 33 / 111 / 306 | 35 / 116 / 345 |
| clock | Evening minus morning: Extreme | Work | Negative | 06:35 | 09:25 | FALSE | 2.833 | −0.914 | 0.122 | 33 / 111 / 659 | 35 / 116 / 672 |
| clock | Evening minus morning: Extreme | Free | Positive | 23:05 | 00:55 | TRUE | 1.833 | 0.841 | 6.941 | 33 / 79 / 297 | 35 / 84 / 334 |
| phase | Evening minus morning: Extreme | Overall | Negative | -11.25 | -9.58 | FALSE | 1.667 | −0.802 | 0.158 | 34 / 188 / 629 | 36 / 192 / 585 |
| phase | Evening minus morning: Extreme | Overall | Positive | 0.92 | 4.42 | FALSE | 3.500 | 1.146 | 13.999 | 34 / 190 / 1322 | 36 / 200 / 1387 |
| phase | Evening minus morning: Extreme | Work | Negative | -11.58 | -8.92 | FALSE | 2.667 | −0.859 | 0.138 | 33 / 109 / 560 | 35 / 116 / 560 |
| phase | Evening minus morning: Extreme | Work | Positive | 0.75 | 4.25 | FALSE | 3.500 | 1.192 | 15.564 | 33 / 111 / 770 | 35 / 116 / 804 |
| phase | Evening minus morning: Extreme | Free | Positive | 1.08 | 4.25 | FALSE | 3.167 | 1.111 | 12.926 | 33 / 79 / 494 | 35 / 84 / 531 |
Figure 13 shows the comparisons; Table 18 lists their supported candidate intervals.
show_figure(paste0("primary_extreme_minus_moderate_", c("overall", "work", "free")))show_interval_table("extreme_moderate_")| Axis | Description | Context | Contrast sign | Start label | End label | Wraps boundary | Duration hours | Mean log10 difference | Factor at mean difference | Positive sample | Negative sample |
|---|---|---|---|---|---|---|---|---|---|---|---|
| phase | Extreme minus moderate: Evening | Overall | Positive | 1.58 | 2.58 | FALSE | 1.000 | 0.683 | 4.815 | 34 / 190 / 378 | 36 / 200 / 399 |
| phase | Extreme minus moderate: Evening | Free | Positive | 1.58 | 2.92 | FALSE | 1.333 | 0.730 | 5.376 | 33 / 79 / 213 | 36 / 84 / 223 |
Figure 14 shows the comparisons; Table 19 lists their supported candidate intervals.
show_figure("primary_free_minus_work")show_interval_table("free_work_")| Axis | Description | Context | Contrast sign | Start label | End label | Wraps boundary | Duration hours | Mean log10 difference | Factor at mean difference | Positive sample | Negative sample |
|---|---|---|---|---|---|---|---|---|---|---|---|
| clock | Free minus work: Q1 | Free versus work | Negative | 06:35 | 10:15 | FALSE | 3.667 | −0.632 | 0.233 | 35 / 84 / 555 | 35 / 116 / 786 |
| clock | Free minus work: Q1 | Free versus work | Negative | 15:25 | 18:15 | FALSE | 2.833 | −0.325 | 0.474 | 35 / 84 / 396 | 35 / 114 / 510 |
| clock | Free minus work: Q2 | Free versus work | Negative | 06:25 | 10:25 | FALSE | 4.000 | −0.775 | 0.168 | 29 / 69 / 543 | 34 / 119 / 915 |
| clock | Free minus work: Q2 | Free versus work | Negative | 15:25 | 16:35 | FALSE | 1.167 | −0.312 | 0.487 | 29 / 68 / 135 | 34 / 116 / 228 |
| clock | Free minus work: Q3 | Free versus work | Negative | 06:25 | 11:25 | FALSE | 5.000 | −0.589 | 0.258 | 36 / 84 / 827 | 36 / 116 / 1146 |
| clock | Free minus work: Q3 | Free versus work | Negative | 13:05 | 18:45 | FALSE | 5.667 | −0.310 | 0.490 | 36 / 84 / 869 | 36 / 116 / 1191 |
| clock | Free minus work: Q4 | Free versus work | Negative | 07:35 | 11:25 | FALSE | 3.833 | −0.492 | 0.322 | 33 / 79 / 628 | 33 / 111 / 877 |
| phase | Free minus work: Q1 | Free versus work | Negative | 11.42 | -9.25 | TRUE | 3.333 | −0.298 | 0.504 | 35 / 84 / 534 | 35 / 116 / 734 |
| phase | Free minus work: Q1 | Free versus work | Negative | 2.92 | 7.25 | FALSE | 4.333 | −0.558 | 0.276 | 35 / 84 / 703 | 35 / 116 / 993 |
| phase | Free minus work: Q2 | Free versus work | Negative | 9.58 | -9.42 | TRUE | 5.000 | −0.271 | 0.536 | 29 / 69 / 653 | 34 / 119 / 1144 |
| phase | Free minus work: Q2 | Free versus work | Negative | 1.92 | 7.25 | FALSE | 5.333 | −0.542 | 0.287 | 29 / 69 / 737 | 34 / 119 / 1249 |
| phase | Free minus work: Q3 | Free versus work | Negative | 9.25 | -11.08 | TRUE | 3.667 | −0.351 | 0.446 | 36 / 84 / 575 | 36 / 116 / 780 |
| phase | Free minus work: Q3 | Free versus work | Negative | 2.08 | 6.42 | FALSE | 4.333 | −0.686 | 0.206 | 36 / 84 / 716 | 36 / 116 / 987 |
| phase | Free minus work: Q4 | Free versus work | Negative | 2.42 | 5.92 | FALSE | 3.500 | −0.544 | 0.286 | 33 / 79 / 547 | 33 / 111 / 765 |
Figure 15 shows the comparisons; Table 20 lists their supported candidate intervals.
show_figure("primary_interactions")show_interval_table("^direction_|^extremity_")| Result |
|---|
| No supported candidate intervals for these comparisons. |
The tables in the four comparison tabs (Table 17, Table 18, Table 19 and Table 20) use the same interval definitions. Each interval factor is 10 raised to the mean log-scale difference across that interval. The complete exports also include minimum and maximum differences and factors, plus every grid point’s uncertainty and support. Their filenames retain significant_windows; the displayed tables identify them as candidate intervals under the Gaussian reference model, with the floor-related uncertainty limitation described above.
The larger timing separation is between the extreme groups. In the phase model, the reference-model bands identify extreme evening-minus-morning differences around 1 to 4 hours after MSFsc, while no supported interval overlaps the striped DLMO reference interval itself (Table 17). The reference interval represents published average timing rather than each participant’s DLMO.
To summarize the magnitude within the two primary phase intervals, we average their contrast design vectors before applying the full coefficient covariance. This retains covariance between phase points. The 95% intervals in Table 21 treat the selected windows as fixed and are not adjusted for interval selection or multiplicity; the simultaneous bands above determine where intervals are identified.
primary_interval_averages <- local({
bundle <- readRDS("results/models/primary_phase.rds")
inference <- readRDS("results/data/primary_phase_inference.rds")
interval_average_contrasts(inference, bundle)
})
save_table(primary_interval_averages, "primary_phase_interval_averages")
show_table(primary_interval_averages |>
mutate(interval = if_else(start < 0, "Pre-MSFsc", "Post-MSFsc")) |>
select(interval, start, end, ratio, ratio_lower, ratio_upper), digits = 2)| Interval | Start | End | Ratio | Ratio lower | Ratio upper |
|---|---|---|---|---|---|
| Pre-MSFsc | −11.25 | −9.58 | 0.16 | 0.06 | 0.40 |
| Post-MSFsc | 0.92 | 4.42 | 14.00 | 5.63 | 34.82 |
The extreme-group pattern is similar on work and free days (Figure 12). Across the early interval, 11.25 to 9.58 hours before MSFsc, the mean evening/morning factor is 0.13 on work days and 0.21 on free days: exposure remains lower in extreme evening types, but the difference is attenuated on free days. Across 0.92 to 4.42 hours after MSFsc, evening-type exposure remains higher, with factors of 15.5 and 12.0, respectively. This is a descriptive attenuation; the simultaneous bands include the no-interaction value throughout the phase cycle for both the registered chronotype-direction-by-day-type comparison and its interaction with chronotype strength (Figure 15). The work/free interval summaries retain the estimates and exploratory interval-average uncertainty.
8 Individual patterns and timing
Table 22 summarizes peak localization, and Figure 16 shows individual timing uncertainty. Individual curves add each participant’s fitted random curve to the same standardized group curve. Site and participant-day effects remain excluded. They use the same back-transformation and symlog lux axis as the group patterns. Peak shifts are circular differences from the corresponding group peak, using 1,000 joint coefficient draws for uncertainty. A peak is labelled localized only when its 95% circular interval is no wider than four hours and its circular concentration is at least 0.8. These are descriptive timing summaries, not fitted horizontal-shift parameters. The display transformation preserves peak locations.
timing <- bind_rows(lapply(c("clock", "phase"), function(axis) {
table_data(paste0("primary_", axis, "_individual_timing")) |>
mutate(axis = axis, .before = 1)
}))
timing_summary <- timing |>
summarise(participants = n_distinct(participant_key),
localized_days = sum(participant_days[localized]),
participant_days = sum(participant_days), half_hours = sum(half_hours),
localized_participants = sum(localized),
median_localized_shift = if (any(localized)) median(shift_hours[localized]) else NA_real_,
.by = c(axis, quartile))
show_table(timing_summary)| Axis | Quartile | Participants | Localized days | Participant-days | Valid half-hours | Localized participants | Median localized shift |
|---|---|---|---|---|---|---|---|
| clock | Q1 | 36 | 39 | 200 | 9,241 | 7 | 0.333 |
| clock | Q2 | 34 | 45 | 188 | 8,656 | 8 | 0.333 |
| clock | Q3 | 36 | 68 | 200 | 9,227 | 12 | −0.250 |
| clock | Q4 | 34 | 88 | 190 | 8,825 | 16 | 0.167 |
| phase | Q1 | 36 | 29 | 200 | 9,241 | 5 | 2.167 |
| phase | Q2 | 34 | 30 | 188 | 8,656 | 5 | −0.500 |
| phase | Q3 | 36 | 62 | 200 | 9,227 | 11 | −1.167 |
| phase | Q4 | 34 | 113 | 190 | 8,825 | 20 | 0.333 |
Every participant’s curve and contributing-day count appears in the clock PDF and phase PDF. Full timing estimates and intervals are in the corresponding clock CSV and phase CSV.
show_figure("primary_clock_timing")
show_figure("primary_phase_timing")9 Photoperiod
Figure 17 compares photoperiod at the weighted 10th and 90th percentiles with the weighted median, at the same clock time or phase. Each factor includes the photoperiod main smooth and its interaction with time. The other model terms cancel in the comparison. A factor above 1 indicates higher fitted melanopic EDI + 0.1 than at the median photoperiod. The median reference stays at 1; pointwise bands use the covariance of each contrast with that reference.
show_figure("primary_clock_photoperiod")
show_figure("primary_phase_photoperiod")10 Fit, prediction and attribution
10.1 In-sample fit
Table 23 reports the in-sample fit statistics. Adjusted R² is mgcv’s adjusted fit statistic. Deviance explained and ordinary R² describe in-sample fit; for these Gaussian models, ordinary R² is 1 minus residual sum of squares divided by the total sum of squares. They include fitted participant and day terms and do not measure prediction for new people.
show_table(table_data("model_fit") |>
select(model, axis, adjusted_R2, deviance_explained, ordinary_R2,
participants, participant_days, half_hours))| Model | Axis | Adjusted R² | Deviance explained | Ordinary R² | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|
| Near-eye | clock | 0.789 | 0.795 | 0.795 | 140 | 778 | 35,949 |
| Near-eye | phase | 0.787 | 0.794 | 0.794 | 140 | 778 | 35,949 |
| Chest | clock | 0.750 | 0.757 | 0.757 | 153 | 864 | 40,039 |
| Chest | phase | 0.749 | 0.756 | 0.756 | 153 | 864 | 40,039 |
10.2 Held-out prediction
Five participant-held-out folds assess new-person prediction. Assignment is balanced within site. The final observed day is separately held out for each participant with at least three eligible days, assessing prediction for known participants. The clock and phase models use identical splits. Cutoffs, photoperiod centers, smoothing and AR correlation are estimated in training data only.
New-participant predictions exclude participant and day effects. Predictions for known participants retain the participant curve but exclude the held-out day effect. Baselines use the participant-weighted training response mean. Scores give participants equal weight; paired bootstrap intervals resample participants within site and condition on the fitted folds.
show_table(table_data("validation_samples") |>
select(target, axis, split, training_participants, training_days,
training_half_hours, assessment_participants, assessment_days,
assessment_half_hours))| Target | Axis | Split | Training participants | Training days | Training valid half-hours | Assessment participants | Assessment days | Assessment valid half-hours |
|---|---|---|---|---|---|---|---|---|
| New participants | clock | new_participant_fold_1 | 108 | 603 | 27,888 | 32 | 175 | 8,061 |
| New participants | phase | new_participant_fold_1 | 108 | 603 | 27,888 | 32 | 175 | 8,061 |
| New participants | clock | new_participant_fold_2 | 110 | 616 | 28,430 | 30 | 162 | 7,519 |
| New participants | phase | new_participant_fold_2 | 110 | 616 | 28,430 | 30 | 162 | 7,519 |
| New participants | clock | new_participant_fold_3 | 112 | 617 | 28,508 | 28 | 161 | 7,441 |
| New participants | phase | new_participant_fold_3 | 112 | 617 | 28,508 | 28 | 161 | 7,441 |
| New participants | clock | new_participant_fold_4 | 115 | 633 | 29,219 | 25 | 145 | 6,730 |
| New participants | phase | new_participant_fold_4 | 115 | 633 | 29,219 | 25 | 145 | 6,730 |
| New participants | clock | new_participant_fold_5 | 115 | 643 | 29,751 | 25 | 135 | 6,198 |
| New participants | phase | new_participant_fold_5 | 115 | 643 | 29,751 | 25 | 135 | 6,198 |
| Known participants: final day | clock | known_participant_final_day | 140 | 639 | 29,531 | 139 | 139 | 6,418 |
| Known participants: final day | phase | known_participant_final_day | 140 | 639 | 29,531 | 139 | 139 | 6,418 |
Days in Table 24 are participant-days. The complete split table also records training cutoffs, rho, and photoperiod support. Wide tables can be scrolled horizontally.
validation_scores <- table_data("validation_scores")
show_table(validation_scores)| Target | Axis | RMSE | MAE | Bias | Predictive R² | Calibration intercept | Calibration slope | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|---|---|
| Known participants: final day | clock | 0.852 | 0.608 | 0.044 | 0.674 | 0.003 | 0.941 | 139 | 139 | 6,418 |
| Known participants: final day | phase | 0.855 | 0.612 | 0.042 | 0.672 | 0.006 | 0.939 | 139 | 139 | 6,418 |
| New participants | clock | 0.887 | 0.633 | 0.002 | 0.668 | 0.006 | 0.990 | 140 | 778 | 35,949 |
| New participants | phase | 0.908 | 0.653 | 0.001 | 0.652 | 0.005 | 0.992 | 140 | 778 | 35,949 |
paired_scores <- table_data("validation_paired_differences")
show_table(paired_scores)| Target | Metric | Phase minus clock | Lower | Upper | Bootstrap replicates | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| New participants | RMSE | 0.020 | 0.011 | 0.031 | 2,000 | 140 | 778 | 35,949 |
| New participants | MAE | 0.020 | 0.013 | 0.028 | 2,000 | 140 | 778 | 35,949 |
| New participants | bias | −0.001 | −0.002 | 0.000 | 2,000 | 140 | 778 | 35,949 |
| New participants | predictive_R2 | −0.016 | −0.024 | −0.008 | 2,000 | 140 | 778 | 35,949 |
| Known participants: final day | RMSE | 0.003 | −0.001 | 0.007 | 2,000 | 139 | 139 | 6,418 |
| Known participants: final day | MAE | 0.004 | 0.000 | 0.008 | 2,000 | 139 | 139 | 6,418 |
| Known participants: final day | bias | −0.002 | −0.003 | −0.001 | 2,000 | 139 | 139 | 6,418 |
| Known participants: final day | predictive_R2 | −0.002 | −0.006 | 0.001 | 2,000 | 139 | 139 | 6,418 |
Table 25 reports the held-out scores. Calibration intercept and slope describe agreement between held-out observations and predictions. An ideal intercept is zero and slope is one. The paired score intervals quantify assessment-sample uncertainty; they do not repeat the full training process in each bootstrap.
Clock time predicts new participants slightly better. Its RMSE is 0.887 versus 0.908 for phase, with predictive R² of 0.668 versus 0.652. The paired phase-minus-clock RMSE difference is 0.0205, with a 95% interval from 0.0108 to 0.0310 (Table 26). For the final day of known participants, the models perform similarly: RMSE is 0.852 for clock and 0.855 for phase; the paired difference interval includes zero.
10.3 Shapley allocation of ordinary in-sample R²
The common time or phase curve is the mandatory baseline. Seven groups enter the allocation: chronotype direction, chronotype strength, day type, site, photoperiod, participant pattern and participant-day variation. All 128 subsets per axis are fitted, with interactions only when their contributing variables are present and with the full model’s rho held fixed. The allocation averages each group’s improvement over subset orders (Azen and Budescu 2003). Negative allocations, if present, are retained.
The intervals use 2,000 hierarchical site-participant-day bootstrap samples of fixed fitted predictions, following the source study’s attribution procedure (MeLiDos analysis project 2026a). They are conditional on the fitted models. This is a descriptive allocation of in-sample R², distinct from a variance component or a causal contribution.
1shapley <- bind_rows(table_data("shapley_clock"), table_data("shapley_phase"))
show_table(shapley |>
select(axis, component, allocation, lower, upper, baseline_R2, full_R2))
stopifnot(all(abs(shapley |>
summarise(error = sum(allocation) - (first(full_R2) - first(baseline_R2)),
.by = axis) |> pull(error)) < 1e-9))- 1
- Combine the saved allocations from all 128 model subsets per time representation. Each component receives its average increase in ordinary in-sample R² across the allowed subset orders; the check below confirms that the allocations sum to the full-model improvement over the common curve.
| Axis | Component | Allocation | Lower | Upper | Baseline R² | Full R² |
|---|---|---|---|---|---|---|
| clock | Chronotype direction | 0.006 | 0.002 | 0.010 | 0.623 | 0.795 |
| clock | Chronotype strength | 0.001 | 0.000 | 0.003 | 0.623 | 0.795 |
| clock | daytype | 0.009 | 0.002 | 0.016 | 0.623 | 0.795 |
| clock | site | 0.015 | 0.008 | 0.024 | 0.623 | 0.795 |
| clock | photoperiod | 0.007 | 0.001 | 0.013 | 0.623 | 0.795 |
| clock | participant | 0.091 | 0.072 | 0.116 | 0.623 | 0.795 |
| clock | participant_day | 0.043 | 0.031 | 0.058 | 0.623 | 0.795 |
| phase | Chronotype direction | 0.010 | 0.004 | 0.016 | 0.601 | 0.794 |
| phase | Chronotype strength | 0.002 | 0.000 | 0.005 | 0.601 | 0.794 |
| phase | daytype | 0.008 | 0.002 | 0.015 | 0.601 | 0.794 |
| phase | site | 0.012 | 0.005 | 0.023 | 0.601 | 0.794 |
| phase | photoperiod | 0.007 | 0.001 | 0.013 | 0.601 | 0.794 |
| phase | participant | 0.110 | 0.087 | 0.141 | 0.601 | 0.794 |
| phase | participant_day | 0.042 | 0.031 | 0.057 | 0.601 | 0.794 |
Table 27 and Figure 18 show the component allocations. Participant-specific patterns receive the largest allocation above the common curve: 0.091 for clock time and 0.110 for phase. Participant-day variation is next, at about 0.042 in both models. These values describe fitted variation in this sample.
p <- ggplot(shapley |> mutate(component = recode(component,
direction = "Chronotype direction", extremity = "Chronotype strength")),
aes(allocation, reorder(component, allocation))) +
geom_vline(xintercept = 0, color = "grey65") +
geom_errorbar(aes(xmin = lower, xmax = upper), orientation = "y", width = 0.2) +
geom_point(color = "#0072B2") +
facet_wrap(~axis, labeller = as_labeller(c(
clock = "A Clock time", phase = "B circadian phase"))) +
labs(x = "Allocation of ordinary in-sample R²", y = NULL,
subtitle = sample_label(near_eye))
save_plot(p, "shapley", 11, 5)
show_figure("shapley")11 Chest and placement checks
Chest models use the same near-eye quartile cutoffs and the same modeling and contrast definitions. Their own complete observations determine sample counts and their common photoperiod reference. The paired placement check then compares only exact matching participant/date/clock bins. Full attribution and predictive validation remain near-eye analyses.
Figure 19 shows the chest patterns with the same group and time-coordinate layout as the near-eye results.
show_figure(paste0("chest_patterns_", c("overall", "work", "free")))Figure 20 compares evening and morning chest exposure.
show_figure(paste0("chest_evening_minus_morning_", c("overall", "work", "free")))The full chest contrast set includes overall chronotype strength, work-day chronotype strength, free-day chronotype strength, work/free differences, and interactions. Candidate interval tables are available for clock and phase.
Table 28 and Figure 21 summarize the chest-model checks.
show_table(table_data("diagnostic_verdicts") |> filter(model == "chest") |>
select(axis, convergence_ok, basis_flag, standardized_lag1,
spread_ratio, cyclic_ok, participants, participant_days, half_hours))| Axis | Convergence ok | Basis flag | Standardized lag1 | Spread ratio | Cyclic ok | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| clock | TRUE | FALSE | 0.065 | 5.381 | TRUE | 153 | 864 | 40,039 |
| phase | TRUE | FALSE | 0.065 | 5.153 | TRUE | 153 | 864 | 40,039 |
show_figure("chest_clock_appraise")
show_figure("chest_phase_appraise")show_table(table_data("matched_placement_summary") |>
select(quartile, daytype, factor_at_mean_difference,
mean_log10_difference = mean_difference, RMSE_log10 = RMSE,
participants, participant_days, half_hours))| Quartile | Daytype | Factor at mean difference | Mean log10 difference | RMSE log10 | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|
| Q1 | Work | 0.949 | −0.023 | 0.529 | 29 | 93 | 4,278 |
| Q1 | Free | 1.072 | 0.030 | 0.707 | 29 | 69 | 3,190 |
| Q2 | Work | 1.015 | 0.007 | 0.642 | 28 | 97 | 4,477 |
| Q2 | Free | 0.965 | −0.016 | 0.687 | 24 | 56 | 2,591 |
| Q3 | Work | 0.857 | −0.067 | 0.636 | 27 | 87 | 4,020 |
| Q3 | Free | 0.661 | −0.180 | 0.628 | 26 | 61 | 2,815 |
| Q4 | Work | 0.940 | −0.027 | 0.361 | 25 | 87 | 4,054 |
| Q4 | Free | 0.848 | −0.071 | 0.381 | 25 | 58 | 2,698 |
Figure 22 shows how the matched chest/near-eye factor changes over the day.
show_figure("matched_placement")Table 29 averages log differences across matched bins. The time curves first average days within each participant, then give participants equal weight. Both convert the resulting log difference to a factor for melanopic EDI + 0.1.
12 Exploratory daylength analysis
Civil daylight occurs at different circadian phases across chronotypes, especially in the extreme morning and evening groups. We explore the hypothesis that this difference in daylight timing contributes to their phase-dependent light-exposure differences, producing larger contrasts on longer days. Pointwise comparisons and the interval-average contrast indicate a larger extreme-group ratio after MSFsc on longer days. This section is an additional exploration. The primary models, contrasts and attribution results remain unchanged.
12.1 Question, model and comparison
The question is whether the extreme evening/morning exposure ratio changes with daylength, particularly during the phase intervals identified in the primary analysis: before the DLMO reference and after MSFsc. Photoperiod here means the duration from civil dawn to civil dusk, when the sun elevation is above −6°. It describes astronomical daylight availability. The measured exposure also includes artificial light and reflects indoor attenuation and participants’ choices of location and activity.
We add a cyclic quartile-specific change per hour of photoperiod to the full phase model. Photoperiod remains centered within each site’s observed date distribution. The common phase curve, original quartile and day-type deviations, site curves, participant curves, day intercepts and common photoperiod terms remain in the model. The added quartile change is linear in centered photoperiod and shared across work and free days. Predictions use the same pooled work/free mix as the primary comparisons and exclude site, participant and day effects.
Site adjustment is retained because dropping it could attribute differences between sites to daylength. Centering photoperiod within site draws on variation relative to each site’s reference. The limited overlap of extreme chronotypes within sites still limits what this pooled comparison can establish.
The added term retains cyclic cubic sz smooths and their sum-to-zero constraint. In the installed mgcv version, a varying numeric by variable otherwise removes that constraint. The short wrapper below keeps the original constructor and prediction method, retains the constraint, and supplies native sz bookkeeping for discrete fitting. Its fitted design is checked for zero sums across quartiles, zero contribution at centered photoperiod zero, linear scaling and cyclic continuity.
source("R/daylight.R")
smooth.construct.szphoto.smooth.specfunction (object, data, knots)
{
out <- mgcv:::smooth.construct.sz.smooth.spec(object, data,
knots)
attr(out$C, "always.apply") <- TRUE
out
}
smooth.info.szphoto.smooth.specfunction (object)
{
object$tensor.possible <- TRUE
object
}
daylight_formula()response ~ s(t, bs = "cc", k = 12) + s(t, quartile, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, daytype, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, quartile, daytype, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, site, bs = "sz", xt = list(bs = "cc"),
k = 12) + s(photo, bs = "cr", k = 5) + ti(t, photo, bs = c("cc",
"cr"), k = c(12, 5)) + s(t, participant, bs = "fs", xt = list(bs = "cc"),
k = 10) + s(participant_day, bs = "re") + s(t, quartile,
by = photo, bs = "szphoto", xt = list(bs = "cc"), k = 12)
<environment: 0x7bee92ea88>
# This reads verified caches when available. All new artifacts have a daylight prefix.
daylight_result <- run_daylight(prepared)The main figures use centered-photoperiod targets of −1, 0 and +1 hours. These are shorter or longer days relative to each site’s mean over observed dates. We also show the participant-weighted quartiles and 10th/90th-percentile targets as sensitivities below. An observation supports a target when its centered photoperiod is within one hour. Every phase comparison requires at least four participants in each extreme-quartile by work/free-day cell in the corresponding half-hour phase bin. All 144 phase points pass this rule for the main targets and both sensitivities.
Table 30 records local support around the three targets; Table 31 reports the expanded model fit.
show_table(table_data("daylight_scenario_samples") |>
select(scenario, photo_target, quartile, daytype,
participants, participant_days, half_hours))| Scenario | Photo target | Quartile | Daytype | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|
| Shorter | −1 | Q4 | Free | 14 | 35 | 1,603 |
| Shorter | −1 | Q4 | Work | 13 | 31 | 1,455 |
| Shorter | −1 | Q1 | Work | 14 | 40 | 1,855 |
| Shorter | −1 | Q1 | Free | 12 | 31 | 1,444 |
| Typical | 0 | Q4 | Work | 15 | 44 | 2,028 |
| Typical | 0 | Q4 | Free | 14 | 38 | 1,760 |
| Typical | 0 | Q1 | Work | 16 | 48 | 2,217 |
| Typical | 0 | Q1 | Free | 16 | 41 | 1,884 |
| Longer | 1 | Q1 | Work | 13 | 36 | 1,651 |
| Longer | 1 | Q1 | Free | 13 | 32 | 1,473 |
| Longer | 1 | Q4 | Work | 14 | 47 | 2,155 |
| Longer | 1 | Q4 | Free | 13 | 33 | 1,533 |
show_table(table_data("daylight_model_summary") |>
select(rho, adjusted_R2, deviance_explained, ordinary_R2,
participants, participant_days, half_hours))| Rho | Adjusted R² | Deviance explained | Ordinary R² | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|
| 0.596 | 0.787 | 0.794 | 0.794 | 140 | 778 | 35,949 |
12.2 Model checks
The model converges, its cyclic curves join correctly, and the basis check does not call for larger dimensions. AR-standardized lag-one residual correlation is approximately 0.080. The diagnostic plots retain the full response range, including the zero-exposure boundary discussed above.
Table 32 summarizes these checks. Figure 23, Figure 24 and Figure 25 show the residual distribution, spread and serial dependence.
show_table(table_data("daylight_phase_verdict", "results/diagnostics") |>
select(convergence_ok, basis_flag, standardized_lag1, spread_ratio,
cyclic_ok, spread_flag, participants, participant_days, half_hours))| Convergence ok | Basis flag | Standardized lag1 | Spread ratio | Cyclic ok | Spread flag | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| TRUE | FALSE | 0.080 | 6.062 | TRUE | TRUE | 140 | 778 | 35,949 |
show_figure("daylight_phase_appraise")show_figure("daylight_phase_spread")12.3 Exposure patterns and changes in the group ratio
The higher phase-aligned exposure in the extreme evening group after MSFsc becomes more pronounced on longer days. For this exploratory assessment, we use 95% pointwise intervals on the 10-minute phase grid, based on the coefficient covariance with smoothing-parameter correction. Each interval addresses one phase-specific comparison; it does not provide simultaneous coverage over the complete curve. Interval-average comparisons use the covariance of the average log contrast and treat the two intervals identified by the primary 95% simultaneous bands within the phase coordinate as fixed. These comparisons are not adjusted for multiplicity or interval selection.
Figure 26 shows the scenario curves, Figure 27 compares the two extreme groups, and Figure 28 isolates the longer-versus-shorter-day change.
show_figure("daylight_phase_patterns")show_figure("daylight_phase_contrasts")show_figure("daylight_phase_moderation")Over the primary candidate interval from 0.92 to 4.42 hours after MSFsc, the geometric mean evening/morning ratio is 7.99 at the −1-hour target and 20.69 at the +1-hour target. Their ratio is 2.59 (95% CI 1.06–6.34), equivalent to an increase of 159.1% (95% CI 5.9%–534.2%). Over the earlier interval, 11.25 to 9.58 hours before MSFsc, the corresponding change is −16.6% (95% CI −66.6% to +108.5%). The later increase is supported by this exploratory interval-average comparison, while the earlier point estimate is in the proposed direction. The bold pointwise phase comparisons exclude no change from approximately 1.17 to 3.17 hours after MSFsc. These intervals were selected in the primary analysis and are reused here with no selection or multiplicity adjustment.
Before the DLMO reference interval, the largest estimated decrease in the group ratio occurs around 8.33 hours before MSFsc: the longer-day evening/morning ratio is 0.41 times the shorter-day ratio (pointwise 95% CI 0.16–1.04). This indication of a photoperiod effect lies closer to DLMO than the primary exposure difference at 9.6–11.3 hours before MSFsc. Its interval still includes no change; the pointwise exclusions of one occur after MSFsc.
Table 33 summarizes the scenario ratios within the two primary candidate intervals.
daylight_interval_counts <- table_data("daylight_primary_interval_samples") |>
filter(contrast != "Longer_minus_shorter") |>
mutate(sample = paste(participants, participant_days, half_hours, sep = " / ")) |>
select(interval, contrast, quartile, sample) |>
pivot_wider(names_from = quartile, values_from = sample)
show_table(table_data("daylight_primary_interval_summaries") |>
filter(contrast != "Longer_minus_shorter") |>
select(interval, start_phase, end_phase, contrast, ratio, ratio_lower, ratio_upper) |>
left_join(daylight_interval_counts, by = c("interval", "contrast")))| Interval | Start phase | End phase | Contrast | Ratio | Ratio lower | Ratio upper | Q4 | Q1 |
|---|---|---|---|---|---|---|---|---|
| 1 | −11.250 | −9.583 | Shorter | 0.175 | 0.059 | 0.516 | 14 / 66 / 221 | 14 / 69 / 216 |
| 1 | −11.250 | −9.583 | Typical | 0.160 | 0.063 | 0.409 | 16 / 81 / 270 | 17 / 87 / 270 |
| 1 | −11.250 | −9.583 | Longer | 0.146 | 0.053 | 0.400 | 15 / 79 / 258 | 14 / 67 / 210 |
| 2 | 0.917 | 4.417 | Shorter | 7.987 | 2.774 | 22.997 | 14 / 66 / 458 | 14 / 71 / 492 |
| 2 | 0.917 | 4.417 | Typical | 12.856 | 5.146 | 32.118 | 16 / 82 / 568 | 17 / 89 / 611 |
| 2 | 0.917 | 4.417 | Longer | 20.694 | 7.773 | 55.095 | 15 / 80 / 557 | 14 / 68 / 469 |
The complete scenario contrast table, pointwise candidate windows, interval-specific sample records, time-varying support counts and the original simultaneous windows are available as CSV files. These post hoc comparisons remain exploratory.
12.3.1 Sensitivity to the daylength targets
We repeat the figures using the participant-weighted quartiles (−0.77, 0.00 and +1.35 hours) and the 10th, 50th and 90th percentiles (−2.17, 0.00 and +2.36 hours). Table 34 lists all three specifications. These percentiles describe centered daylength, not new chronotype cutoffs. The four-person local-support rule retains all 144 phase points in each specification, including the four morning participants near the 10th-percentile target.
show_table(table_data("daylight_sensitivity_targets") |>
mutate(specification = recode(specification, fixed = "Main: −1 / 0 / +1 h",
quartiles = "P25 / P50 / P75", p10_p90 = "P10 / P50 / P90")) |>
select(specification, scenario, photo) |>
pivot_wider(names_from = scenario, values_from = photo), digits = 2)| Specification | Shorter | Typical | Longer |
|---|---|---|---|
| Main: −1 / 0 / +1 h | −1.00 | 0.00 | 1.00 |
| P25 / P50 / P75 | −0.77 | 0.00 | 1.35 |
| P10 / P50 / P90 | −2.17 | 0.00 | 2.36 |
The longer-versus-shorter ratio over the primary interval after MSFsc is 2.59 (95% CI 1.06–6.34) for the main targets, 2.74 (1.06–7.09) for the quartiles and 8.64 (1.14–65.66) for P10/P90. The earlier interval remains uncertain under all three choices (Table 35). The model’s photoperiod moderation is linear, so a wider target separation rescales the log contrast and its standard error together. The same phase segments therefore exclude one; the larger P10/P90 estimate comes with a much wider interval.
show_table(table_data("daylight_sensitivity_intervals") |>
mutate(specification = recode(specification, fixed = "Main: −1 / 0 / +1 h",
quartiles = "P25 / P50 / P75", p10_p90 = "P10 / P50 / P90"),
phase_interval = if_else(interval == 1L, "Before DLMO reference", "After MSFsc"),
interval_95 = sprintf("%.2f to %.2f", ratio_lower, ratio_upper)) |>
select(specification, phase_interval, ratio, interval_95), digits = 2,
labels = c(ratio = "Ratio of ratios", interval_95 = "95% CI"))| Specification | Phase interval | Ratio of ratios | 95% CI |
|---|---|---|---|
| Main: −1 / 0 / +1 h | Before DLMO reference | 0.83 | 0.33 to 2.09 |
| Main: −1 / 0 / +1 h | After MSFsc | 2.59 | 1.06 to 6.34 |
| P25 / P50 / P75 | Before DLMO reference | 0.83 | 0.31 to 2.18 |
| P25 / P50 / P75 | After MSFsc | 2.74 | 1.06 to 7.09 |
| P10 / P50 / P90 | Before DLMO reference | 0.66 | 0.08 to 5.28 |
| P10 / P50 / P90 | After MSFsc | 8.64 | 1.14 to 65.66 |
Figure 29 and Figure 30 repeat the exposure curves, group ratios and longer-versus-shorter comparisons. Bold segments identify supported pointwise intervals excluding one, using the same rule as the main figures.
show_figure("daylight_quartiles_phase_patterns")
show_figure("daylight_quartiles_phase_contrasts")
show_figure("daylight_quartiles_phase_moderation")show_figure("daylight_p10_p90_phase_patterns")
show_figure("daylight_p10_p90_phase_contrasts")
show_figure("daylight_p10_p90_phase_moderation")12.4 Solar timing relative to MSFsc
We separately project each retained participant-day’s civil dawn and dusk onto its participant’s MSFsc coordinate. Here the shorter/longer split is absolute civil daylength, divided at the full sample’s participant-weighted median of 13.25 hours. This differs from the site-centered targets used in the exposure model. Within each group and absolute-daylength category, participants receive equal weight and their days receive equal weight.
Figure 31 shows civil daylight availability across circadian phase; Table 36 summarizes availability within the two primary candidate intervals.
show_figure("daylight_civil_availability")In the primary interval before the DLMO reference, civil daylight availability averages 100.0% for morning types on both shorter and longer days, compared with 18.3% and 81.9% for evening types. In the primary interval after MSFsc, the corresponding values are 19.7% and 69.0% for morning types, and 81.4% and 100.0% for evening types. Thus daylight availability separates the groups in both intervals, with smaller availability gaps on longer absolute days. These absolute-daylength summaries describe a different comparison from the within-site-centered photoperiod targets used in the exposure model.
show_table(table_data("daylight_civil_primary_intervals") |>
arrange(interval, factor(daylength, levels = c("Shorter", "Longer")), quartile) |>
select(interval_label, daylength, quartile, mean_percent,
participants, participant_days), digits = 1,
labels = c(interval_label = "Primary interval", mean_percent = "Daylight availability (%)"))| Primary interval | Daylength | Quartile | Daylight availability (%) | Participants | Participant-days |
|---|---|---|---|---|---|
| Before DLMO reference | Shorter | Q1 | 100.0 | 17 | 93 |
| Before DLMO reference | Shorter | Q4 | 18.3 | 18 | 97 |
| Before DLMO reference | Longer | Q1 | 100.0 | 19 | 107 |
| Before DLMO reference | Longer | Q4 | 81.9 | 17 | 93 |
| After MSFsc | Shorter | Q1 | 19.7 | 17 | 93 |
| After MSFsc | Shorter | Q4 | 81.4 | 18 | 97 |
| After MSFsc | Longer | Q1 | 69.0 | 19 | 107 |
| After MSFsc | Longer | Q4 | 100.0 | 17 | 93 |
12.5 Prediction and scope
The expanded model is evaluated in the same five participant-held-out folds as the primary phase model. Quartile cutoffs, site photoperiod centers, smoothing and AR correlation are estimated from training data. Neither participant nor day effects enter predictions for the held-out participants. Model comparisons use paired predictions on identical observations and 2,000 participant bootstrap samples stratified by site.
Table 37 records the matched validation splits. The resulting scores and paired differences appear in Table 38 and Table 39.
show_table(table_data("daylight_validation_samples") |>
filter(model == "Photoperiod moderation") |>
select(split, training_participants, training_days, training_half_hours,
assessment_participants, assessment_days, assessment_half_hours))| Split | Training participants | Training days | Training valid half-hours | Assessment participants | Assessment days | Assessment valid half-hours |
|---|---|---|---|---|---|---|
| new_participant_fold_1 | 108 | 603 | 27,888 | 32 | 175 | 8,061 |
| new_participant_fold_2 | 110 | 616 | 28,430 | 30 | 162 | 7,519 |
| new_participant_fold_3 | 112 | 617 | 28,508 | 28 | 161 | 7,441 |
| new_participant_fold_4 | 115 | 633 | 29,219 | 25 | 145 | 6,730 |
| new_participant_fold_5 | 115 | 643 | 29,751 | 25 | 135 | 6,198 |
show_table(table_data("daylight_validation_scores"))| Model | RMSE | MAE | Bias | Predictive R² | Calibration intercept | Calibration slope | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|---|
| Photoperiod moderation | 0.912 | 0.656 | 0.003 | 0.649 | 0.008 | 0.987 | 140 | 778 | 35,949 |
| Primary phase | 0.908 | 0.653 | 0.001 | 0.652 | 0.005 | 0.992 | 140 | 778 | 35,949 |
The expanded model’s predictive R² is 0.649, compared with 0.652 for the primary phase model. Its RMSE is 0.0044 higher, with a paired 95% interval from −0.0008 to 0.0100. Adding photoperiod moderation does not improve new-participant prediction in these data.
show_table(table_data("daylight_validation_paired_differences"), digits = 4)| Metric | Expanded minus primary | Lower | Upper | Bootstrap replicates | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|
| RMSE | 0.0044 | −0.0008 | 0.0100 | 2,000 | 140 | 778 | 35,949 |
| MAE | 0.0029 | −0.0016 | 0.0077 | 2,000 | 140 | 778 | 35,949 |
| bias | 0.0016 | −0.0042 | 0.0073 | 2,000 | 140 | 778 | 35,949 |
| predictive_R2 | −0.0034 | −0.0078 | 0.0006 | 2,000 | 140 | 778 | 35,949 |
Finally, the extreme chronotypes have little overlap within individual sites: no site has at least five participants in both Q1 and Q4. Site curves adjust for shared site patterns, but cannot replace that missing overlap. The daylength result is a pooled exploratory association with site adjustment. It cannot establish daylight as the singular driver of the chronotype difference. A stronger test needs both extreme groups observed at the same sites across a wider seasonal range, together with information separating outdoor daylight from artificial or indoor light.
Table 40 shows the limited within-site overlap of the extreme groups.
show_table(table_data("daylight_site_composition"))| Site | Quartile | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|
| BAUA | Q1 | 6 | 33 | 1,521 |
| BAUA | Q4 | 1 | 4 | 190 |
| FUSPCEU | Q1 | 2 | 12 | 568 |
| FUSPCEU | Q4 | 6 | 29 | 1,350 |
| IZTECH | Q1 | 0 | 0 | 0 |
| IZTECH | Q4 | 12 | 70 | 3,258 |
| KNUST | Q1 | 12 | 63 | 2,887 |
| KNUST | Q4 | 0 | 0 | 0 |
| MPI | Q1 | 4 | 24 | 1,110 |
| MPI | Q4 | 7 | 41 | 1,899 |
| RISE | Q1 | 8 | 46 | 2,127 |
| RISE | Q4 | 1 | 6 | 279 |
| THUAS | Q1 | 1 | 6 | 284 |
| THUAS | Q4 | 2 | 11 | 523 |
| TUM | Q1 | 0 | 0 | 0 |
| TUM | Q4 | 4 | 24 | 1,099 |
| UCR | Q1 | 3 | 16 | 744 |
| UCR | Q4 | 1 | 5 | 227 |
The basis checks, independent design audit, acceptance checks and primary-cache checksums document the constrained smooth, unchanged primary results and separate daylight outputs. The complete additional analysis is in R/daylight.R.
13 Sensitivity to questionnaire-based chronotype
The Morningness–Eveningness Questionnaire (MEQ) measures reported preference for earlier or later activity and sleep. It offers a second way to define the comparison groups (Horne and Östberg 1976). This sensitivity analysis changes group membership. The phase coordinate still uses MSFsc, so it does not provide a separate measurement of circadian phase.
All 140 participants in the complete near-eye sample have MEQ scores. The recorded categories agree with the conventional score ranges: 70–86 definitely morning, 59–69 moderately morning, 42–58 intermediate, 31–41 moderately evening, and 16–30 definitely evening. Table 41 includes the full sample before restricting the sensitivity analysis.
show_table(table_data("meq_category_sample"))| Meq type | Participants | Participant-days | Valid half-hours | Minimum score | Maximum score |
|---|---|---|---|---|---|
| Definitely morning type | 6 | 29 | 1,326 | 70 | 73 |
| Moderately morning type | 38 | 213 | 9,844 | 59 | 69 |
| Intermediate | 72 | 399 | 18,391 | 42 | 58 |
| Moderately evening type | 21 | 120 | 5,607 | 32 | 41 |
| Definitely evening type | 3 | 17 | 781 | 28 | 30 |
There are only three definitely evening participants, contributing 17 participant-days. A separate extreme-evening curve would be poorly supported. We therefore pool definite and moderate types within each direction and exclude the 72 intermediate participants. The fitted sensitivity sample contains 68 participants, 379 participant-days, and 17,558 valid half-hours: 44 morning and 24 evening participants.
13.1 Matched models and comparison sample
The pooled MEQ models use the same response, bin rules, work/free labels, cyclic spline structure, photoperiod adjustment, and true-elapsed AR(1) sequence boundaries as the primary analysis. The quartile term is replaced by a two-level MEQ chronotype-direction factor. The cyclic sz group and day-type deviations, their interaction, and the participant fs curves remain in the model. Population bases use k = 12, participant bases use k = 10, and the photoperiod basis uses k = 5. No extreme-versus-moderate effect is fitted in this reduced sample.
To separate the change in questionnaire from the change in sample, we also fit MSFsc models to exactly the same observations, dividing these participants at the original full-sample MSFsc median. These labels mean earlier and later MSFsc. Of the 68 participants, 60 retain the same direction and eight switch direction. The classification overlap table gives the participant, participant-day, and half-hour counts for each pairing.
source("R/meq.R")
meq_raw <- meq_prepare(prepared)
meq_preprocessing <- fit_preprocess(meq_raw, prepared$cutoffs)
model_formula(k = 12L, kp = 10L)response ~ s(t, bs = "cc", k = 12) + s(t, quartile, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, daytype, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, quartile, daytype, bs = "sz",
xt = list(bs = "cc"), k = 12) + s(t, site, bs = "sz", xt = list(bs = "cc"),
k = 12) + s(photo, bs = "cr", k = 5) + ti(t, photo, bs = c("cc",
"cr"), k = c(12, 5)) + s(t, participant, bs = "fs", xt = list(bs = "cc"),
k = 10) + s(participant_day, bs = "re")
<environment: 0x7becc1c0e8>
# Each call checks the data and formula signature before reusing its fit.
meq_fit_checks <- list()
for (classification in c("MEQ", "MSFsc")) {
for (axis in c("clock", "phase")) {
fitted_meq <- meq_fit(meq_raw, meq_preprocessing, axis,
classification, k = 12L, kp = 10L)
meq_fit_checks[[paste(classification, axis)]] <-
model_summary(fitted_meq) |>
mutate(classification = classification)
rm(fitted_meq)
}
}
show_table(bind_rows(meq_fit_checks) |>
select(classification, axis, convergence, participants,
participant_days, half_hours))| Classification | Axis | Convergence | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|
| MEQ | clock | TRUE | 68 | 379 | 17,558 |
| MEQ | phase | TRUE | 68 | 379 | 17,558 |
| MSFsc | clock | TRUE | 68 | 379 | 17,558 |
| MSFsc | phase | TRUE | 68 | 379 | 17,558 |
Table 42 records convergence and sample counts. In the printed formula, quartile is the binary morning/evening grouping for this sensitivity. The preprocessing centers photoperiod within site on the restricted sample and retains the original MSFsc cutoffs. Rendering executes these steps and checks the four cached fits. The diagnostics, standardized predictions, and contrasts below read the exports produced by run_meq(prepared); rendering does not repeat the 10,000 coefficient draws. The full analytical entry point also writes the acceptance checks.
Population predictions use the restricted sample’s common photoperiod distribution, with equal participant weights and equal weights for each person’s observed days. Overall curves use the same work/free proportions in both groups. Site, participant, and participant-day effects are omitted from the displayed predictions.
13.2 Model checks
All four fits converged. The basis checks did not flag an undersized basis, and the fitted curves join continuously at the daily boundary. The AR correction reduces lag-one residual correlation from about 0.62 to about 0.085. The largest raw residual standard deviation across fitted-value deciles is 7.5–8.0 times the smallest when zeros are included, but 1.22–1.28 times among positive observations. Restricting instead to fitted exposure of at least 1 lux gives ratios of 1.43–1.45, consistent with a pattern concentrated near the zero boundary. High overlap among the hierarchical population, site, and participant curves also limits interpretation of isolated model terms; the full concurvity results are exported.
The response has the same zero-exposure boundary as the primary analysis, so the global spread ratio should be read in that context. These fits assess the direction and shape of the sensitivity results. Their candidate intervals retain the Gaussian uncertainty approximation near the boundary.
Table 43 summarizes the checks, with residual plots in Figure 32.
show_table(table_data("meq_diagnostic_verdicts") |>
select(classification, axis, convergence_ok, basis_flag,
standardized_lag1, spread_ratio, cyclic_ok,
participants, participant_days, half_hours))| Classification | Axis | Convergence ok | Basis flag | Standardized lag1 | Spread ratio | Cyclic ok | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|---|
| MEQ | clock | TRUE | FALSE | 0.085 | 7.546 | TRUE | 68 | 379 | 17,558 |
| MEQ | phase | TRUE | FALSE | 0.085 | 7.689 | TRUE | 68 | 379 | 17,558 |
| MSFsc | clock | TRUE | FALSE | 0.086 | 7.995 | TRUE | 68 | 379 | 17,558 |
| MSFsc | phase | TRUE | FALSE | 0.086 | 7.505 | TRUE | 68 | 379 | 17,558 |
show_figure("meq_defined_clock_appraise")
show_figure("meq_defined_phase_appraise")The in-sample fits are very similar under both classifications and both time coordinates (Table 44). These values include participant and day effects. They do not establish which questionnaire or time coordinate predicts new observations better. Predictive validation and Shapley attribution remain focused on the primary near-eye sample.
show_table(table_data("meq_model_fit") |>
select(classification, axis, rho, adjusted_R2, ordinary_R2,
deviance_explained, participants, participant_days, half_hours), digits = 4)mgcv estimate; ordinary R² compares residual variation with the observed response variation.
| Classification | Axis | Rho | Adjusted R² | Ordinary R² | Deviance explained | Participants | Participant-days | Valid half-hours |
|---|---|---|---|---|---|---|---|---|
| MEQ | clock | 0.5826 | 0.7928 | 0.7988 | 0.7988 | 68 | 379 | 17,558 |
| MEQ | phase | 0.5851 | 0.7913 | 0.7974 | 0.7974 | 68 | 379 | 17,558 |
| MSFsc | clock | 0.5834 | 0.7919 | 0.7978 | 0.7978 | 68 | 379 | 17,558 |
| MSFsc | phase | 0.5857 | 0.7907 | 0.7967 | 0.7967 | 68 | 379 | 17,558 |
13.3 Daily patterns and differences
The MEQ curves retain the main later-timing pattern: evening participants have higher exposure around late clock evening and during the rising portion of the curve after MSFsc. The same-subset MSFsc contrast has a similar shape (Figure 34). This agreement shows that these patterns are not confined to the full sample’s quartile classification. It does not establish agreement between the two instruments in the full cohort, because intermediate MEQ participants are excluded here.
Figure 33 shows the fitted daily curves under MEQ classification.
show_figure("meq_patterns_meq")show_figure("meq_factor_comparison")Large factors in the early rising portion of the phase curve occur at low absolute exposure. For example, at 2.5 hours after MSFsc, the overall MEQ curves estimate approximately 0.17 lx for morning participants and 2.94 lx for evening participants. The factor compares melanopic EDI + 0.1, so it is not an unshifted lux ratio. The factor plot should be read alongside the intensity plot.
The Gaussian reference bands identify a candidate overall MEQ interval from 1.25 to 3.58 hours after MSFsc. There is no supported interval in the published DLMO reference interval. The candidate-window table provides circular interval boundaries, directions, magnitudes, and the participants, participant-days, and half-hours observed inside each interval. Claims are withheld wherever either direction has fewer than five contributing participants; overall comparisons require that support in both work and free-day cells. Time-varying support is retained in the curve data and contrast data.
Site composition also limits this comparison. Only MPI has at least five participants in each MEQ direction, and four sites contribute only one direction. Adjusting for site cannot supply the missing within-site comparisons. The sensitivity is therefore evidence about this smaller pooled sample, not a separate confirmation of a general MEQ effect.
Table 45 shows the site composition of the retained MEQ groups.
show_table(table_data("meq_site_support") |>
mutate(sample = paste(participants, participant_days, half_hours, sep = " / ")) |>
select(site, meq_direction, sample) |>
pivot_wider(names_from = meq_direction, values_from = sample,
values_fill = "0 / 0 / 0"))| Site | Morning | Evening |
|---|---|---|
| BAUA | 7 / 40 / 1864 | 2 / 11 / 501 |
| FUSPCEU | 5 / 25 / 1174 | 0 / 0 / 0 |
| IZTECH | 2 / 11 / 513 | 5 / 29 / 1356 |
| KNUST | 11 / 59 / 2682 | 0 / 0 / 0 |
| MPI | 9 / 54 / 2499 | 8 / 44 / 2038 |
| RISE | 5 / 28 / 1289 | 4 / 24 / 1125 |
| THUAS | 3 / 13 / 594 | 3 / 17 / 800 |
| TUM | 0 / 0 / 0 | 2 / 12 / 568 |
| UCR | 2 / 12 / 555 | 0 / 0 / 0 |
The paired MSFsc pattern figure, sample registry, diagnostic tables, acceptance checks, and complete analytical code accompany this section. The entry point is Rscript --vanilla R/meq.R; cached fits are reused when their data and specification signatures agree.
14 Exploratory phase-response weighting
Daily exposure can occur at phases when light tends to advance or delay the circadian clock. We weight the primary model’s estimated near-eye phase curves for the extreme morning and extreme evening groups by a published light phase-response curve (PRC) and sum the contributions over 24 hours. This exploratory index is a conceptual comparison of exposure across the advance and delay regions of that PRC, not a prediction of phase shifts. An ambulatory precedent multiplied transformed personal light exposure by the Khalsa PRC and integrated the advance and delay regions (Arguelles-Prieto et al. 2022). That study used a nonlinear intensity–response transformation and a wrist-temperature phase anchor; here we use modelled log melanopic exposure and MSFsc-relative timing.
14.1 Published curve and phase alignment
We use the PRC from St Hilaire et al. (2012), who measured DLMO shifts after a one-hour pulse of approximately 8,000 photopic lux of white light in 18 participants. The numerical coordinates come from the CSV deposited with their analysis (Walch et al. 2025). These authors had digitized the published figure. We use their numerical file without extracting an image ourselves; it is not the original raw dataset. The local source record fixes the repository version and coordinate definitions.
The figure repeats observations across its circular boundary. We retain one 24-hour interval containing 18 responses, verify that the other ten coordinates are periodic copies, and add 0.5 hours to convert pulse onset to pulse midpoint. A two-harmonic, 24-hour curve is fitted in R. The reusable PRC helper defines the import, integration and sensitivity calculations; the calls below execute them at this point in the report.
source("R/phase_response.R")
prc_source <- phase_response_read_prc()
c(source_participants = nrow(prc_source$points),
minimum_shift_hours = prc_source$minimum_shift,
maximum_shift_hours = prc_source$maximum_shift)source_participants minimum_shift_hours maximum_shift_hours
18.0000000 -1.7483988 0.4509291
The fitted extrema round to −1.75 and +0.45 hours, matching the published extrema. Positive response values indicate advances and negative values delays. The study measured phase before and after the light pulse using dim-light constant routines. Its no-net-light-response reference of −0.54 hours allows for the assumed free-running delay across the three-day measurement interval, based on a mean intrinsic period of 24.18 hours. We compare the published raw PRC, \(K(u)=P(u)\), with the drift-corrected PRC, \(K(u)=P(u)+0.54\), where \(P(u)\) is the reconstructed curve at pulse midpoint \(u\) relative to DLMO.
We align DLMO at 6.45 hours before MSFsc, the midpoint of the published group-average reference interval, and repeat the calculation at its endpoints, 6.95 and 5.95 hours before MSFsc. Two wider offsets, 8.45 and 4.45 hours before MSFsc, are additional stress tests. Figure 35 shows both PRC baselines at the central alignment, with markers for DLMO and MSFsc, axes for both time coordinates, and the two primary phase intervals.
phase_response_kernel_figure(prc_source)
show_figure("phase_response_kernel")14.2 Weighted exposure indices
For each extreme group \(g\) and day-type context \(c\), let \(\hat\eta_{gc}(x_j)\) be the primary-model estimate of \(\log_{10}(\mathrm{melanopic\ EDI}+0.1)\) at MSFsc-relative phase \(x_j\). At ten-minute spacing, \(\Delta=1/6\) hour, we calculate
\[ \begin{aligned} w_j(d)&=\frac{K(x_j-d)\Delta}{\sum_j |K(x_j-d)|\Delta},\\ I_{gc}(d)&=\sum_j w_j(d)\{\hat\eta_{gc}(x_j)+1\}. \end{aligned} \]
Here \(d\) is DLMO relative to MSFsc. Zero-exposure centering subtracts \(\log_{10}(0+0.1)=-1\), so the integrated curve is \(\hat\eta_{gc}+1\). The positive denominator rescales the sum without changing its sign; the unnormalized signed integral is also exported. The curves retain the primary model’s common photoperiod distribution, with site, participant and day effects excluded. Overall curves use the same pooled work/free-day mixture as the main analysis.
The PRC weights have a nonzero signed sum, so the index depends on the PRC baseline as well as the timing of exposure. We compare the published raw and drift-corrected PRCs using the same zero-exposure reference.
We integrate the model design vectors before calculating uncertainty, retaining covariance across phase and between groups. The 95% coefficient intervals use the full covariance with smoothing-parameter correction. They are unadjusted and conditional on the fitted PRC and assumed alignment. They do not propagate uncertainty in the external PRC fit or individual DLMO.
prc_result <- phase_response_integrate(
prc_source,
readRDS("results/models/primary_phase.rds"),
readRDS("results/data/primary_phase_inference.rds")
)
prc_result$checks |> count(passed, name = "checks")# A tibble: 1 × 2
passed checks
<lgl> <int>
1 TRUE 76
Export PRC results and prepare figures
phase_response_export(prc_result)
phase_response_figures(prc_result)Figure 36 compares the two PRC baselines. At the central alignment, the published raw PRC gives zero-exposure-centered overall indices of −0.15 for extreme morning and +0.05 for extreme evening, with both intervals including zero. With drift correction, the corresponding estimates are 1.28 and 1.42. Both intervals exclude zero, indicating advance-weighted exposure (Table 46).
show_figure("phase_response_indices")prc_overall <- table_data("phase_response_overall_report") |>
arrange(factor(prc_baseline, c("Published raw", "Drift corrected")), quartile) |>
mutate(group = paste(extremity, direction),
interval = sprintf("%.3f to %.3f", lower, upper)) |>
select(prc_baseline, group, estimate, interval)
show_table(prc_overall, labels = c(prc_baseline = "PRC baseline",
group = "Group", estimate = "Index",
interval = "95% CI"))| PRC baseline | Group | Index | 95% CI |
|---|---|---|---|
| Published raw | Extreme Morning | −0.152 | -0.351 to 0.046 |
| Published raw | Extreme Evening | 0.046 | -0.148 to 0.240 |
| Drift corrected | Extreme Morning | 1.276 | 1.104 to 1.448 |
| Drift corrected | Extreme Evening | 1.422 | 1.255 to 1.589 |
At the central DLMO alignment, the estimates consistently place the extreme evening exposure pattern in a more phase-advancing direction than the extreme morning pattern across overall, work and free days and under both PRC baselines. The direct group differences are not statistically significant. The overall evening-minus-morning difference is 0.198 (95% CI −0.094 to 0.491) with published raw weights and 0.146 (−0.106 to 0.398) with drift-corrected weights. All group-contrast intervals include zero at the central alignment. Across the three alignments within the published reference interval (5.95, 6.45 and 6.95 hours before MSFsc), the only exception is the work-day contrast with published raw weights and zero-exposure centering at DLMO = −6.95 hours: 0.297 (95% CI 0.001–0.593). Overall contrasts remain uncertain under every combination. Table 47 shows the central-alignment results.
prc_contrasts <- table_data("phase_response_contrast_report") |>
mutate(interval = sprintf("%.3f to %.3f", lower, upper)) |>
select(prc_baseline, context, estimate, interval)
show_table(prc_contrasts, labels = c(prc_baseline = "PRC baseline",
estimate = "Difference", interval = "95% CI"))| PRC baseline | Context | Difference | 95% CI |
|---|---|---|---|
| Drift corrected | Overall | 0.146 | -0.106 to 0.398 |
| Drift corrected | Work | 0.132 | -0.122 to 0.387 |
| Drift corrected | Free | 0.166 | -0.091 to 0.423 |
| Published raw | Overall | 0.198 | -0.094 to 0.491 |
| Published raw | Work | 0.216 | -0.080 to 0.512 |
| Published raw | Free | 0.172 | -0.127 to 0.472 |
The absolute balance depends on the drift convention and alignment. Neither PRC baseline gives a clearly separated overall morning–evening index within the published reference interval. Thus these results provide no clear support for an advancing exposure pattern in extreme evening types paired with a delaying pattern in extreme morning types. The laboratory pulse response is not calibrated for summing naturally varying daily melanopic exposure, so these indices cannot be read as hours of phase advance or delay.
The complete index results, group contrasts, time-specific contributions, and PRC weights retain the alignment and PRC-baseline sensitivities, with zero-exposure centering throughout. The source guide, fitted coefficients, input checksums, and R session document reproduction. The standalone entry point is Rscript --vanilla R/run_phase_response.R.
14.3 Sensitivity: advance-to-delay exposure balance
As a sensitivity, we use the broad phase regions of Emens et al. (2009). Their advance-to-delay balance divides mean log-transformed exposure from 16 to 4 hours before DLMO by the mean from 4 hours before to 8 hours after DLMO. Both regions span 12 hours. We apply their transformation to the fitted near-eye curves, \(L_g(x)=\max\{10^{\hat\eta_g(x)}-0.1,0\}\), and calculate the ratio of the two regional means of \(\log_{10}\{L_g(x)+1\}\). This is a transformation of the existing fitted exposure curves, rather than a refit with a different response. The overall curves retain the common photoperiod distribution and work/free-day mixture. The calculation uses equal weights within each region and does not use the shape or drift correction of the published PRC.
We retain joint uncertainty across time and groups through 10,000 coefficient draws with smoothing-parameter correction. The 95% percentile intervals are conditional on the fitted model and assumed DLMO alignment, without multiplicity adjustment. We calculate the central alignment at 6.45 hours before MSFsc and repeat it at 5.95 and 6.95 hours, overall and separately for work and free days. The calculation helper also verifies that averaging the six four-hour bins used by Emens and colleagues gives the same balance as the ten-minute grid.
source("R/emens_balance.R")
emens_result <- emens_balance(
readRDS("results/models/primary_phase.rds"),
readRDS("results/data/primary_phase_inference.rds")
)
emens_result$checks |> count(passed, name = "checks")# A tibble: 1 × 2
passed checks
<lgl> <int>
1 TRUE 40
Export advance-to-delay sensitivity results
emens_balance_export(emens_result)At the central alignment, the advance-to-delay balance was 2.43 (95% CI 1.94–3.06) for extreme morning types and 4.28 (3.23–5.71) for extreme evening types. The evening/morning ratio of these balances was 1.76 (1.21–2.58), indicating a higher relative concentration of exposure in the advance region in evening types (Table 48). Its interval excluded one at all three alignments, overall and on work and free days. This broad-region summary supports the direction of the main PRC comparison, whose overall group-contrast intervals included zero. The two methods apply different temporal weights and transformations, and neither estimates a phase shift in hours.
emens_report <- bind_rows(
emens_result$summary |>
filter(context == "Overall", dlmo_offset == -6.45) |>
mutate(comparison = paste("Extreme", tolower(direction))) |>
select(comparison, estimate, lower, upper),
emens_result$contrasts |>
filter(context == "Overall", dlmo_offset == -6.45,
contrast == "Evening / morning") |>
mutate(comparison = "Evening / morning balance") |>
select(comparison, estimate, lower, upper)
) |>
mutate(interval = sprintf("%.2f to %.2f", lower, upper)) |>
select(comparison, estimate, interval)
show_table(emens_report, digits = 2,
labels = c(comparison = "Comparison", estimate = "Ratio", interval = "95% CI"))| Comparison | Ratio | 95% CI |
|---|---|---|
| Extreme morning | 2.43 | 1.94 to 3.06 |
| Extreme evening | 4.28 | 3.23 to 5.71 |
| Evening / morning balance | 1.76 | 1.21 to 2.58 |
The complete balances, direct group comparisons, and phase-region definitions include all three alignments and day-type contexts. The standalone R script, input checksums, and runtime record document reproduction.
15 Sleep-diary midsleep and MSFsc
This separate analysis compares questionnaire-derived MSFsc with the timing of recorded sleep episodes. The main comparison includes all available diary nights from the 140 participants in the primary near-eye exposure analysis, including nights whose waking day has no retained light observations. A second comparison uses every participant with valid diary and MSFsc data in the imported cohort. The exposure models are unchanged.
15.1 Sleep episodes and waking-day labels
Midsleep is the midpoint between diary-derived sleep onset and final awakening, using dated local-clock timestamps. Sleep onset incorporates the reported delay between trying to sleep and falling asleep; it is not bedtime. The midpoint describes the sleep period and does not redistribute time around intervening awakenings. The diary question “Today is…” supplies the work/free label for the waking date. Thus Saturday-to-Sunday sleep is labelled free when Sunday is free, while Sunday-to-Monday sleep is labelled work when Monday is a work day.
The code below reads the fixed input snapshot and the participant list from the primary analysis. The staged code is also available as a standalone R script.
Register the executable diary-analysis stages
knitr::read_chunk("R/sleep_diary_alignment.R")Read the diary, chronotype and primary-sample inputs
source(".Rprofile")
suppressPackageStartupMessages({
library(dplyr)
library(tidyr)
library(ggplot2)
})
sleep_diary_manifest <- read.csv("input-data/manifest.csv") |>
filter(role %in% c("sleepdiaries", "chronotype"))
stopifnot(identical(
unname(tools::md5sum(sleep_diary_manifest$path)),
sleep_diary_manifest$md5
))
sleep_diary_raw <- readRDS(
"input-data/model_data/normalized_inputs/sleepdiaries.rds"
)
sleep_diary_chronotype <- readRDS(
"input-data/model_data/normalized_inputs/chronotype.rds"
) |>
transmute(site, Id, msfsc_hours = as.numeric(msf_sc) / 3600)
sleep_diary_primary <- readRDS("results/data/prepared.rds")$frames$glasses |>
distinct(site, Id, local_date)
stopifnot(!anyDuplicated(sleep_diary_chronotype[c("site", "Id")]))We retain records with a valid sleep onset, awakening, MSFsc and waking-day label, respecting the upstream interval checks. Midnight is handled through the dated timestamps before extracting the midpoint’s clock time. For correlation and variability, both clock variables use a fixed noon-to-noon scale, so times immediately before and after midnight remain adjacent.
sleep_diary_records <- sleep_diary_raw |>
left_join(
sleep_diary_chronotype,
by = c("site", "Id"),
relationship = "many-to-one"
) |>
left_join(
sleep_diary_primary |>
distinct(site, Id) |>
mutate(in_primary_sample = TRUE),
by = c("site", "Id"),
relationship = "many-to-one"
) |>
mutate(
participant = paste(site, Id, sep = "::"),
in_primary_sample = coalesce(in_primary_sample, FALSE),
waking_date = as.Date(wake_wall, tz = "UTC"),
daytype = factor(
as.character(daytype2),
levels = c("a work day", "a free day"),
labels = c("Work", "Free")
),
sleep_period_hours = as.numeric(difftime(
wake_wall,
sleep_onset_wall,
units = "hours"
)),
midpoint_wall = sleep_onset_wall + sleep_period_hours * 3600 / 2,
midsleep_hours = (as.numeric(midpoint_wall) / 3600) %% 24,
# A fixed noon cut keeps times either side of midnight adjacent.
midsleep_unwrapped_hours = ((midsleep_hours + 12) %% 24) - 12,
msfsc_unwrapped_hours = ((msfsc_hours + 12) %% 24) - 12,
difference_minutes = (((midsleep_hours - msfsc_hours + 12) %% 24) - 12) *
60,
dst_crossing = sleep_onset_utc_offset_minutes != wake_utc_offset_minutes,
exclusion = case_when(
!is.finite(msfsc_hours) ~ "Missing MSFsc",
is.na(sleep_onset_wall) | is.na(wake_wall) ~
"Missing sleep onset or awakening",
!sleep_interval_analysis_eligible | sleep_interval_quarantined ~
"Upstream interval quarantine",
sleep_period_hours <= 0 | sleep_period_hours >= 24 ~
"Invalid sleep-period duration",
is.na(daytype) ~ "Missing waking-day type",
TRUE ~ "Included"
)
) |>
left_join(
sleep_diary_primary |>
rename(waking_date = local_date) |>
mutate(waking_date_in_light_analysis = TRUE),
by = c("site", "Id", "waking_date"),
relationship = "many-to-one"
) |>
mutate(
waking_date_in_light_analysis = coalesce(
waking_date_in_light_analysis,
FALSE
)
)
sleep_diary_valid <- sleep_diary_records |> filter(exclusion == "Included")
sleep_diary_nights <- sleep_diary_valid |> filter(in_primary_sample)
sleep_diary_flow <- bind_rows(
sleep_diary_records |>
summarise(
stage = "All imported diary entries",
participants = n_distinct(participant),
nights = n()
),
sleep_diary_records |>
filter(in_primary_sample) |>
summarise(
stage = "Entries from primary exposure participants",
participants = n_distinct(participant),
nights = n()
),
sleep_diary_nights |>
summarise(
stage = "Valid primary-sample diary nights",
participants = n_distinct(participant),
nights = n()
),
sleep_diary_nights |>
filter(waking_date_in_light_analysis) |>
summarise(
stage = "Also have waking-day light observations",
participants = n_distinct(participant),
nights = n()
),
sleep_diary_valid |>
summarise(
stage = "Valid nights in all available participants",
participants = n_distinct(participant),
nights = n()
)
)
sleep_diary_flowshow_table(sleep_diary_flow)| Stage | Participants | Nights |
|---|---|---|
| All imported diary entries | 184 | 1,276 |
| Entries from primary exposure participants | 140 | 972 |
| Valid primary-sample diary nights | 140 | 971 |
| Also have waking-day light observations | 140 | 778 |
| Valid nights in all available participants | 183 | 1,268 |
The 140 primary-analysis participants supplied 972 diary entries, of which 971 had the required timing and day-type information. One entry lacked the required sleep timing and day type. Of the retained nights, 778 correspond to waking dates in the exposure analysis and 193 provide additional diary information. There are 620 work-day nights from 139 participants and 351 free-day nights from 136 participants. In the full imported cohort, 1,268 valid nights from 183 participants are available for comparison.
15.2 Association with MSFsc
We calculate Pearson correlations between nightly midsleep and MSFsc overall and separately for work and free days. The nightly correlation weights each recorded night equally. Its 95% interval comes from 2,000 bootstrap samples of participants, carrying each selected participant’s nights together. We also correlate each participant’s mean diary midsleep with MSFsc, giving each participant one observation within the relevant day-type context. This second summary distinguishes habitual timing agreement from night-to-night variation; MSFsc itself does not vary across a participant’s nights.
Calculate correlations and resample whole participants
# Resample whole people, carrying all their nights together.
sleep_diary_correlations <- function(nights, context, scope, draws = 2000L) {
selected <- if (context == "Overall") nights else
filter(nights, daytype == context)
people <- selected |>
summarise(
msfsc = first(msfsc_unwrapped_hours),
midsleep = mean(midsleep_unwrapped_hours),
.by = participant
)
stopifnot(nrow(people) >= 3L, stats::sd(people$msfsc) > 0)
night_indices <- split(seq_len(nrow(selected)), selected$participant)
boot <- replicate(draws, {
chosen <- sample.int(nrow(people), nrow(people), replace = TRUE)
ids <- people$participant[chosen]
rows <- unlist(night_indices[ids], use.names = FALSE)
c(
night = stats::cor(
selected$msfsc_unwrapped_hours[rows],
selected$midsleep_unwrapped_hours[rows]
),
participant_mean = stats::cor(
people$msfsc[chosen],
people$midsleep[chosen]
)
)
})
stopifnot(all(is.finite(boot)))
tibble::tibble(
scope = scope,
context = context,
participants = nrow(people),
nights = nrow(selected),
night_r = stats::cor(
selected$msfsc_unwrapped_hours,
selected$midsleep_unwrapped_hours
),
night_lower = unname(stats::quantile(boot["night", ], 0.025)),
night_upper = unname(stats::quantile(boot["night", ], 0.975)),
participant_mean_r = stats::cor(people$msfsc, people$midsleep),
participant_mean_lower = unname(stats::quantile(
boot["participant_mean", ],
0.025
)),
participant_mean_upper = unname(stats::quantile(
boot["participant_mean", ],
0.975
)),
median_difference_minutes = stats::median(selected$difference_minutes),
median_absolute_difference_minutes = stats::median(abs(
selected$difference_minutes
)),
bootstrap_draws = draws
)
}sleep_diary_correlation_table <- withr::with_seed(20261106L, {
rows <- list()
for (scope in c(
"Primary exposure participants",
"All available participants"
)) {
nights <- if (scope == "Primary exposure participants")
sleep_diary_nights else sleep_diary_valid
for (context in c("Overall", "Work", "Free")) {
rows[[length(rows) + 1L]] <- sleep_diary_correlations(
nights,
context,
scope
)
}
}
bind_rows(rows)
})
sleep_diary_correlation_table |>
filter(scope == "Primary exposure participants") |>
select(
context,
participants,
nights,
night_r,
night_lower,
night_upper,
participant_mean_r
)sleep_diary_correlation_display <- sleep_diary_correlation_table |>
mutate(
nightly = sprintf("%.2f (%.2f to %.2f)", night_r, night_lower, night_upper),
participant_mean = sprintf("%.2f (%.2f to %.2f)", participant_mean_r,
participant_mean_lower, participant_mean_upper)
) |>
select(scope, context, participants, nights, nightly, participant_mean)
show_table(sleep_diary_correlation_display,
labels = c(nightly = "Nightly r (95% CI)", participant_mean = "Participant-mean r (95% CI)"))| Scope | Context | Participants | Nights | Nightly r (95% CI) | Participant-mean r (95% CI) |
|---|---|---|---|---|---|
| Primary exposure participants | Overall | 140 | 971 | 0.66 (0.59 to 0.73) | 0.81 (0.75 to 0.86) |
| Primary exposure participants | Work | 139 | 620 | 0.67 (0.59 to 0.74) | 0.75 (0.68 to 0.81) |
| Primary exposure participants | Free | 136 | 351 | 0.74 (0.67 to 0.81) | 0.82 (0.76 to 0.86) |
| All available participants | Overall | 183 | 1,268 | 0.65 (0.59 to 0.71) | 0.80 (0.75 to 0.84) |
| All available participants | Work | 182 | 817 | 0.67 (0.60 to 0.73) | 0.75 (0.68 to 0.81) |
| All available participants | Free | 178 | 451 | 0.70 (0.63 to 0.77) | 0.77 (0.72 to 0.82) |
Among the primary-analysis participants, nightly midsleep correlated with MSFsc at r = 0.66 overall (95% CI 0.59–0.73), 0.67 on work days (0.59–0.74) and 0.74 on free days (0.67–0.81). The corresponding participant-mean correlations were 0.81, 0.75 and 0.82. The full-cohort nightly correlations were similar: 0.65 overall, 0.67 on work days and 0.70 on free days.
Correlation describes ordering across participants rather than equality of the two timings. Diary midsleep was a median 34 minutes earlier than MSFsc on work days and 18 minutes later on free days. This comparison uses observed diary midsleep without a sleep-debt correction, whereas MSFsc includes that correction. The stronger association on free days is consistent with the construction of MSFsc from free-day midsleep, with work-day sleep duration contributing to the sleep-debt correction.
15.3 Within-participant variability
We calculate the sample standard deviation of midsleep separately within each participant overall and within each day type. An SD is reported only when that participant has at least three valid nights in that context. The table summarizes these participant-specific SDs with equal participant weight; the work-day and free-day summaries can involve different subsets of participants.
sleep_diary_contexts <- bind_rows(
sleep_diary_nights |> mutate(context = "Overall"),
sleep_diary_nights |> mutate(context = as.character(daytype))
)
sleep_diary_participant_sd <- sleep_diary_contexts |>
summarise(
nights = n(),
msfsc_hours = first(msfsc_hours),
mean_midsleep_hours = mean(midsleep_unwrapped_hours),
sd_minutes = if (n() > 2L) stats::sd(midsleep_unwrapped_hours) * 60 else
NA_real_,
.by = c(site, Id, participant, context)
) |>
mutate(eligible_for_sd = nights > 2L)
sleep_diary_sd_summary <- sleep_diary_participant_sd |>
filter(eligible_for_sd) |>
summarise(
participants = n(),
median_sd_minutes = stats::median(sd_minutes),
q1_sd_minutes = unname(stats::quantile(sd_minutes, 0.25)),
q3_sd_minutes = unname(stats::quantile(sd_minutes, 0.75)),
minimum_nights = min(nights),
maximum_nights = max(nights),
nights = sum(nights),
.by = context
) |>
arrange(match(context, c("Overall", "Work", "Free")))
sleep_diary_sd_summaryshow_table(sleep_diary_sd_summary |>
select(context, participants, nights, median_sd_minutes, q1_sd_minutes, q3_sd_minutes),
digits = 1,
labels = c(median_sd_minutes = "Median SD (min)", q1_sd_minutes = "25th percentile (min)",
q3_sd_minutes = "75th percentile (min)"))| Context | Participants | Nights | Median SD (min) | 25th percentile (min) | 75th percentile (min) |
|---|---|---|---|---|---|
| Overall | 139 | 969 | 47.0 | 34.0 | 61.5 |
| Work | 127 | 599 | 29.7 | 20.1 | 46.9 |
| Free | 59 | 207 | 34.6 | 19.5 | 50.3 |
Across 139 participants with at least three nights, the median within-participant SD was 47 minutes (interquartile range 34–62 minutes). Within day types, the median was 30 minutes on work days and 35 minutes on free days, based on 127 and 59 eligible participants, respectively. The stronger association after averaging nights and the remaining nightly variation show that MSFsc tracks habitual sleep timing but does not locate each night’s actual midpoint.
15.4 Diary-derived MSFsc equivalent (MSFsc(diary))
We also construct a diary-derived MSFsc equivalent (MSFsc(diary)) from the recorded sleep episodes. For each participant, we average midsleep and sleep-period duration separately before work days and free days. The correction follows the MCTQ sleep-debt formula, replacing the usual weekly work/free-day weights with the observed numbers of valid diary nights in each category. With mean durations \(SD_W\) and \(SD_F\) and counts \(n_W\) and \(n_F\),
\[ \overline{SD}_{\mathrm{diary}} = \frac{n_W SD_W+n_F SD_F}{n_W+n_F}, \qquad \mathrm{MSF}_{\mathrm{sc(diary)}} = MSF_{\mathrm{diary}} -\frac{\max(0,SD_F-\overline{SD}_{\mathrm{diary}})}{2}. \]
Thus work-day sleep duration and the recorded day counts determine the correction to mean free-day midsleep. Work-day and free-day midsleep are not themselves averaged to obtain the corrected value. If free-day sleep is no longer than work-day sleep, the correction is zero. Durations use the same local-clock interval from sleep onset to final awakening as the midsleep calculation. Each participant needs at least one valid night of both types. The diaries have no alarm-use field, so this is a diary-derived equivalent rather than a full MCTQ re-scoring.
sleep_diary_daytype_means <- sleep_diary_nights |>
summarise(
nights = n(),
midsleep = mean(midsleep_unwrapped_hours),
sleep_duration = mean(sleep_period_hours),
.by = c(site, Id, participant, msfsc_unwrapped_hours, daytype)
)
sleep_diary_msfsc_participants <- sleep_diary_daytype_means |>
pivot_wider(
names_from = daytype,
values_from = c(nights, midsleep, sleep_duration),
values_fill = list(nights = 0L)
) |>
rename(
work_nights = nights_Work,
free_nights = nights_Free,
msw_hours = midsleep_Work,
msf_hours = midsleep_Free,
sd_work_hours = sleep_duration_Work,
sd_free_hours = sleep_duration_Free
) |>
mutate(
eligible = work_nights > 0L & free_nights > 0L,
mean_sleep_duration_hours = if_else(
eligible,
(work_nights * sd_work_hours + free_nights * sd_free_hours) /
(work_nights + free_nights),
NA_real_
),
correction_hours = if_else(
eligible,
pmax(0, sd_free_hours - mean_sleep_duration_hours) / 2,
NA_real_
),
diary_msfsc_hours = msf_hours - correction_hours,
difference_minutes = (diary_msfsc_hours - msfsc_unwrapped_hours) * 60
)
sleep_diary_msfsc_eligible <- sleep_diary_msfsc_participants |>
filter(eligible)
sleep_diary_msfsc_flow <- sleep_diary_msfsc_participants |>
summarise(
primary_participants = n(),
eligible_participants = sum(eligible),
missing_work_nights = sum(work_nights == 0L),
missing_free_nights = sum(free_nights == 0L),
work_nights = sum(work_nights[eligible]),
free_nights = sum(free_nights[eligible]),
corrected_participants = sum(correction_hours > 0, na.rm = TRUE),
median_correction_minutes = stats::median(correction_hours, na.rm = TRUE) *
60
)
sleep_diary_msfsc_flow# A tibble: 1 × 8
primary_participants eligible_participants missing_work_nights
<int> <int> <int>
1 140 135 1
# ℹ 5 more variables: missing_free_nights <int>, work_nights <int>,
# free_nights <int>, corrected_participants <int>,
# median_correction_minutes <dbl>
The estimate is available for 135 participants, contributing 598 work-day nights and 347 free-day nights. Four participants had no valid free-day night and one had no valid work-day night. The correction is positive for 96 participants; its median across all eligible participants is 12 minutes.
For a direct comparison, the next table uses the same eligible participants for mean work-day midsleep, mean free-day midsleep and the corrected estimate. We give each participant equal weight and obtain 95% correlation intervals from 2,000 participant bootstrap samples. Timing differences are diary minus questionnaire MSFsc.
sleep_diary_msfsc_summary <- withr::with_seed(20261107L, {
people <- sleep_diary_msfsc_eligible
metrics <- c("msw_hours", "msf_hours", "diary_msfsc_hours")
draws <- 2000L
boot <- replicate(draws, {
rows <- sample.int(nrow(people), nrow(people), replace = TRUE)
vapply(
metrics,
function(metric) {
stats::cor(people$msfsc_unwrapped_hours[rows], people[[metric]][rows])
},
numeric(1)
)
})
stopifnot(all(is.finite(boot)))
bind_rows(lapply(metrics, function(metric) {
difference <- (people[[metric]] - people$msfsc_unwrapped_hours) * 60
tibble::tibble(
metric = metric,
participants = nrow(people),
r = stats::cor(people$msfsc_unwrapped_hours, people[[metric]]),
lower = unname(stats::quantile(boot[metric, ], 0.025)),
upper = unname(stats::quantile(boot[metric, ], 0.975)),
median_difference_minutes = stats::median(difference),
q1_difference_minutes = unname(stats::quantile(difference, 0.25)),
q3_difference_minutes = unname(stats::quantile(difference, 0.75)),
median_absolute_difference_minutes = stats::median(abs(difference)),
bootstrap_draws = draws
)
}))
})
sleep_diary_msfsc_summarysleep_diary_msfsc_display <- sleep_diary_msfsc_summary |>
mutate(
measure = c("Mean work-day midsleep", "Mean free-day midsleep", "Diary MSFsc equivalent"),
correlation = sprintf("%.2f (%.2f to %.2f)", r, lower, upper),
difference = sprintf("%+.0f (%+.0f to %+.0f)",
median_difference_minutes, q1_difference_minutes, q3_difference_minutes)
) |>
select(measure, participants, correlation, difference)
show_table(sleep_diary_msfsc_display,
labels = c(correlation = "r (95% CI)", difference = "Median difference (IQR), min"))
sleep_diary_msfsc_result <- sleep_diary_msfsc_summary |>
filter(metric == "diary_msfsc_hours")| Measure | Participants | r (95% CI) | Median difference (IQR), min |
|---|---|---|---|
| Mean work-day midsleep | 135 | 0.75 (0.68 to 0.82) | -33 (-64 to +0) |
| Mean free-day midsleep | 135 | 0.82 (0.76 to 0.86) | +23 (-11 to +61) |
| Diary MSFsc equivalent | 135 | 0.79 (0.72 to 0.85) | +6 (-28 to +36) |
The diary-derived MSFsc equivalent correlates with questionnaire MSFsc at r = 0.79 (95% CI 0.72–0.85). It is a median 6 minutes later (IQR -28 to +36 minutes), compared with 23 minutes later for uncorrected mean free-day midsleep in the same participants. The median absolute difference is 34 minutes. The correction therefore reduces the typical offset, while the correlation is slightly lower than for uncorrected free-day means.
15.5 Diary midsleep versus MSFsc
Panel A of Figure 37 shows individual sleep episodes. Panel B averages diary midsleep within each participant separately for work and free days, giving each participant one point per available day type. Its marginal histogram compares those day-type means in common 30-minute bins, with offset half-width bars for the two day types. These means include participants with at least one valid night in that day type; the three-night requirement applies only to the SD analysis. The overall correlation uses all nights in A and one all-night mean per participant in B. Panel C shows one diary-derived MSFsc equivalent per eligible participant. Colors and shapes in A and B identify the waking day’s work/free label, and dashed lines denote equal diary and questionnaire timings. Vertical spreads in panel A reflect recorded night-to-night variation, although participants with the same MSFsc can overlap.
sleep_diary_scatter_nights_data <- sleep_diary_nights |>
select(
site,
Id,
participant,
waking_date,
daytype,
msfsc_hours,
midsleep_hours,
msfsc_unwrapped_hours,
midsleep_unwrapped_hours,
sleep_period_hours,
difference_minutes,
dst_crossing,
waking_date_in_light_analysis
)
sleep_diary_scatter_means_data <- sleep_diary_scatter_nights_data |>
summarise(
nights = n(),
msfsc_unwrapped_hours = first(msfsc_unwrapped_hours),
midsleep_unwrapped_hours = mean(midsleep_unwrapped_hours),
.by = c(site, Id, participant, daytype)
)
sleep_diary_scatter_data <- bind_rows(
sleep_diary_scatter_nights_data |>
mutate(panel = "A Individual nights", nights = 1L),
sleep_diary_scatter_means_data |>
mutate(panel = "B Participant means"),
sleep_diary_msfsc_eligible |>
transmute(
site,
Id,
participant,
msfsc_unwrapped_hours,
midsleep_unwrapped_hours = diary_msfsc_hours,
nights = work_nights + free_nights,
panel = "C Diary-derived MSFsc"
)
)
sleep_diary_scatter_correlations_data <- bind_rows(
sleep_diary_correlation_table |>
mutate(panel = "A Individual nights", r = night_r, n = nights),
sleep_diary_correlation_table |>
mutate(panel = "B Participant means", r = participant_mean_r, n = participants)
) |>
filter(scope == "Primary exposure participants") |>
transmute(
panel,
daytype = factor(context, levels = c("Overall", "Work", "Free")),
r,
n,
label = sprintf("%s: r = %.2f; n = %d", context, r, n),
x = 0.2,
y = 13.6 - 0.7 * (as.integer(daytype) - 1)
)
sleep_diary_scatter_correlations_data <- bind_rows(
sleep_diary_scatter_correlations_data,
sleep_diary_msfsc_summary |>
filter(metric == "diary_msfsc_hours") |>
transmute(
panel = "C Diary-derived MSFsc",
r,
n = participants,
label = sprintf("r = %.2f; n = %d", r, n),
x = 0.2,
y = 13.6
)
)
# The marginal histogram counts participant means, with common 30-minute bins.
sleep_diary_scatter_histogram_data <- sleep_diary_scatter_means_data |>
mutate(bin_lower = floor(midsleep_unwrapped_hours * 2) / 2) |>
count(daytype, bin_lower, name = "participants") |>
complete(
daytype,
bin_lower = seq(0, 11.5, by = 0.5),
fill = list(participants = 0L)
) |>
mutate(
bin_upper = bin_lower + 0.5,
bar_lower = bin_lower + if_else(daytype == "Free", 0.25, 0),
bar_upper = bar_lower + 0.25
)Draw the diary-midsleep comparison
# Solarized accents from ggthemr's palette, used directly without a theme dependency.
# https://github.com/Mikata-Project/ggthemr/blob/master/R/palettes.R
sleep_diary_day_colors <- c(Work = "#268bd2", Free = "#dc322f")
sleep_diary_scatter_correlations_data <- sleep_diary_scatter_correlations_data |>
mutate(
label_color = coalesce(
sleep_diary_day_colors[as.character(daytype)],
"black"
)
)
sleep_diary_panels <- list()
for (panel in unique(sleep_diary_scatter_data$panel)) {
plot_data <- filter(sleep_diary_scatter_data, .data$panel == .env$panel)
corrected <- panel == "C Diary-derived MSFsc"
p <- ggplot(plot_data, aes(msfsc_unwrapped_hours, midsleep_unwrapped_hours)) +
geom_abline(
intercept = 0,
slope = 1,
linetype = "dashed",
color = "grey45",
linewidth = 0.55
)
if (corrected) {
p <- p +
geom_point(
shape = 21,
fill = "#2aa198B3",
color = "black",
size = 2.1,
stroke = 0.3
)
} else {
p <- p +
geom_point(
aes(fill = daytype, shape = daytype),
color = "black",
size = 2.1,
stroke = 0.3
) +
scale_fill_manual(values = scales::alpha(sleep_diary_day_colors, 0.7)) +
scale_shape_manual(values = c(Work = 21, Free = 24)) +
labs(fill = "Waking day", shape = "Waking day")
}
p <- p +
geom_text(
data = filter(
sleep_diary_scatter_correlations_data,
.data$panel == .env$panel
),
aes(x = x, y = y, label = label, color = label_color),
inherit.aes = FALSE,
hjust = 0,
size = 4.8
) +
scale_color_identity() +
scale_x_continuous(
breaks = seq(0, 12, 4),
labels = sprintf("%02d:00", seq(0, 12, 4))
) +
scale_y_continuous(
breaks = seq(0, 12, 4),
labels = sprintf("%02d:00", seq(0, 12, 4))
) +
coord_cartesian(xlim = c(0, 12), ylim = c(0, 14), expand = FALSE) +
labs(
title = if (corrected) "Diary-derived timing" else sub("^[A-C] +", "", panel),
tag = substr(panel, 1, 1),
x = expression("Questionnaire " * MSF[sc]),
y = if (corrected) expression(MSF["sc(diary)"]) else "Diary midsleep"
) +
theme_bw(base_size = 16) +
theme(
panel.grid.minor = element_blank(),
legend.position = "none",
plot.title = element_text(face = "bold", size = 16),
plot.tag = element_text(face = "bold", size = 18),
plot.tag.position = "topleft",
plot.margin = margin(
6,
if (panel == "B Participant means") 0 else 12,
6,
6
)
)
sleep_diary_panels[[panel]] <- p
}
sleep_diary_marginal <- ggplot(sleep_diary_scatter_histogram_data) +
geom_rect(
aes(
xmin = 0,
xmax = participants,
ymin = bar_lower,
ymax = bar_upper,
fill = daytype
),
color = "black",
linewidth = 0.2,
show.legend = FALSE
) +
scale_fill_manual(values = scales::alpha(sleep_diary_day_colors, 0.7)) +
scale_x_continuous(breaks = NULL) +
scale_y_continuous(breaks = seq(0, 12, 3)) +
coord_cartesian(ylim = c(0, 14), expand = FALSE) +
labs(x = NULL, y = NULL) +
theme_void(base_size = 12) +
theme(
plot.margin = margin(0, 0, 0, 0)
)
sleep_diary_scatter <- patchwork::wrap_plots(
sleep_diary_panels[[1]],
sleep_diary_panels[[2]],
sleep_diary_marginal,
sleep_diary_panels[[3]],
nrow = 1,
widths = c(1, 1, 0.25, 1),
guides = "collect"
) &
theme(legend.position = "none")
if (isTRUE(getOption("knitr.in.progress"))) {
ggsave(
"results/figures/sleep_diary_scatter.png", sleep_diary_scatter,
width = 11.8, height = 5.6, dpi = 220, bg = "white"
)
knitr::include_graphics("results/figures/sleep_diary_scatter.png")
}15.6 Timing checks and reproducibility
MSFsc and the primary midpoint comparison use local clock time. Three retained nights cross a daylight-saving transition. As a check, we also calculate their midpoints using true elapsed UTC time and then convert back to local time. The affected midpoint changes are 30 minutes; the overall correlation remains 0.66 under either convention. All observed midsleep values lie between 00:18 and 11:06, so the fixed noon cut does not split the recorded distribution.
Check waking-day labels, midnight handling, SD eligibility and daylight-saving transitions
sleep_diary_dst_audit <- sleep_diary_nights |>
mutate(
midpoint_utc = sleep_onset_utc +
as.numeric(difftime(wake_utc, sleep_onset_utc, units = "secs")) / 2
)
sleep_diary_dst_audit$elapsed_midpoint_local_label <- vapply(
seq_len(nrow(sleep_diary_dst_audit)),
function(i)
format(
sleep_diary_dst_audit$midpoint_utc[i],
tz = sleep_diary_dst_audit$site_timezone[i],
format = "%Y-%m-%d %H:%M:%S"
),
character(1)
)
sleep_diary_dst_audit <- sleep_diary_dst_audit |>
mutate(
elapsed_midpoint_wall = as.POSIXct(
elapsed_midpoint_local_label,
tz = "UTC"
),
elapsed_midpoint_hours = (as.numeric(elapsed_midpoint_wall) / 3600) %% 24,
elapsed_minus_wall_minutes = (((elapsed_midpoint_hours -
midsleep_hours +
12) %%
24) -
12) *
60
)
sleep_diary_dst_sensitivity <- sleep_diary_dst_audit |>
summarise(
night_r_wall = stats::cor(msfsc_unwrapped_hours, midsleep_unwrapped_hours),
night_r_elapsed = stats::cor(
msfsc_unwrapped_hours,
((elapsed_midpoint_hours + 12) %% 24) - 12
),
nights_with_different_midpoint = sum(abs(elapsed_minus_wall_minutes) > 1e-6)
)
sleep_diary_valid_day_keys <- sleep_diary_records |> filter(!is.na(waking_date))
sleep_diary_checks <- tibble::tibble(
check = c(
"One diary record per participant and waking date",
"Primary participants match the exposure cohort",
"Sleep onset equals attempted sleep plus latency",
"All valid durations are positive and shorter than 24 hours",
"Midpoints use dated timestamps across midnight",
"Midnight-adjacent clocks remain adjacent on the noon branch",
"No observed noon-branch discontinuity",
"Diary day types are retained on their waking-day records",
"SD requires at least three nights within its context",
"SD is unavailable at two or fewer nights",
"Elapsed and wall midpoint agree away from DST changes",
"All bootstrap confidence limits are finite",
"SD summaries retain per-participant night counts",
"Panel B has one mean per participant and day type",
"Panel B includes every plotted night in its day-type mean",
"Panel B correlations match the participant-mean results",
"Diary correction requires both work and free nights",
"Count-weighted duration equals the average of the retained nights",
"Correction is zero when free-day duration does not exceed work-day duration",
"Correction is nonnegative and advances or retains free-day midsleep",
"Corrected correlation confidence limits are finite",
"Panel C has one corrected value per eligible participant",
"Marginal histogram counts every participant-day-type mean",
"All plotted points fall inside the displayed clock range"
),
passed = c(
!anyDuplicated(sleep_diary_valid_day_keys[c("site", "Id", "waking_date")]),
setequal(
sleep_diary_nights$participant,
paste(sleep_diary_primary$site, sleep_diary_primary$Id, sep = "::")
),
all(
abs(
as.numeric(sleep_diary_nights$sleep_onset_wall) -
as.numeric(sleep_diary_nights$sleepprep_wall) -
sleep_diary_nights$sleepdelay * 60
) <
1e-6
),
all(
sleep_diary_nights$sleep_period_hours > 0 &
sleep_diary_nights$sleep_period_hours < 24
),
as.numeric(as.POSIXct("2026-11-07 23:00:00", tz = "UTC") + 8 * 3600 / 2) ==
as.numeric(as.POSIXct("2026-11-08 03:00:00", tz = "UTC")),
isTRUE(all.equal((((c(23.5, 0.5) + 12) %% 24) - 12), c(-0.5, 0.5))),
all(
sleep_diary_valid$midsleep_unwrapped_hours > -12 &
sleep_diary_valid$midsleep_unwrapped_hours < 12
) &&
diff(range(sleep_diary_valid$midsleep_unwrapped_hours)) < 12,
identical(
as.character(sleep_diary_nights$daytype),
ifelse(
as.character(sleep_diary_nights$daytype2) == "a work day",
"Work",
"Free"
)
),
all(
sleep_diary_participant_sd$nights[is.finite(
sleep_diary_participant_sd$sd_minutes
)] >
2
),
all(is.na(sleep_diary_participant_sd$sd_minutes[
sleep_diary_participant_sd$nights <= 2
])),
all(
abs(sleep_diary_dst_audit$elapsed_minus_wall_minutes[
!sleep_diary_dst_audit$dst_crossing
]) <
1e-6
),
all(is.finite(as.matrix(select(
sleep_diary_correlation_table,
ends_with("lower"),
ends_with("upper")
)))),
all(
sleep_diary_sd_summary$minimum_nights >= 3 &
sleep_diary_sd_summary$maximum_nights <=
max(sleep_diary_participant_sd$nights)
),
!anyDuplicated(sleep_diary_scatter_means_data[c("participant", "daytype")]),
sum(sleep_diary_scatter_means_data$nights) == nrow(sleep_diary_nights),
all(vapply(
c("Work", "Free"),
function(context) {
means <- filter(sleep_diary_scatter_means_data, daytype == context)
expected <- filter(
sleep_diary_correlation_table,
scope == "Primary exposure participants",
.data$context == .env$context
)
nrow(means) == expected$participants &&
isTRUE(all.equal(
stats::cor(
means$msfsc_unwrapped_hours,
means$midsleep_unwrapped_hours
),
expected$participant_mean_r
))
},
logical(1)
)),
all(
is.finite(sleep_diary_msfsc_participants$diary_msfsc_hours) ==
sleep_diary_msfsc_participants$eligible
),
all(vapply(
seq_len(nrow(sleep_diary_msfsc_eligible)),
function(i) {
person <- sleep_diary_msfsc_eligible$participant[i]
expected <- mean(sleep_diary_nights$sleep_period_hours[
sleep_diary_nights$participant == person
])
abs(
expected - sleep_diary_msfsc_eligible$mean_sleep_duration_hours[i]
) <
1e-10
},
logical(1)
)),
all(
sleep_diary_msfsc_eligible$correction_hours[
sleep_diary_msfsc_eligible$sd_free_hours <=
sleep_diary_msfsc_eligible$sd_work_hours
] <
1e-10
),
all(
sleep_diary_msfsc_eligible$correction_hours >= 0 &
sleep_diary_msfsc_eligible$diary_msfsc_hours <=
sleep_diary_msfsc_eligible$msf_hours
),
all(is.finite(as.matrix(select(
sleep_diary_msfsc_summary,
r,
lower,
upper
)))),
!anyDuplicated(sleep_diary_msfsc_eligible$participant) &&
sum(sleep_diary_scatter_data$panel == "C Diary-derived MSFsc") ==
nrow(sleep_diary_msfsc_eligible),
sum(sleep_diary_scatter_histogram_data$participants) ==
nrow(sleep_diary_scatter_means_data),
all(
sleep_diary_scatter_data$msfsc_unwrapped_hours >= 0 &
sleep_diary_scatter_data$msfsc_unwrapped_hours <= 12 &
sleep_diary_scatter_data$midsleep_unwrapped_hours >= 0 &
sleep_diary_scatter_data$midsleep_unwrapped_hours <= 12
)
)
)
stopifnot(all(sleep_diary_checks$passed))
sleep_diary_checks |> count(passed, name = "checks")# A tibble: 1 × 2
passed checks
<lgl> <int>
1 TRUE 24
Export figure data, tables and computational provenance
for (directory in c(
"results/tables",
"results/data",
"results/figures",
"results/provenance",
"data/intermediate"
)) {
dir.create(directory, recursive = TRUE, showWarnings = FALSE)
}
sleep_diary_outputs <- list(
sample_flow = sleep_diary_flow,
correlations = sleep_diary_correlation_table,
participant_sd = sleep_diary_participant_sd,
sd_summary = sleep_diary_sd_summary,
msfsc_participants = sleep_diary_msfsc_participants,
msfsc_flow = sleep_diary_msfsc_flow,
msfsc_summary = sleep_diary_msfsc_summary,
exclusions = sleep_diary_records |>
count(in_primary_sample, exclusion, name = "diary_entries"),
dst_sensitivity = sleep_diary_dst_sensitivity
)
for (name in names(sleep_diary_outputs)) {
write.csv(
sleep_diary_outputs[[name]],
paste0("results/tables/sleep_diary_", name, ".csv"),
row.names = FALSE,
na = ""
)
}
write.csv(
sleep_diary_records |>
select(
site,
Id,
source_row,
participant,
waking_date,
daytype,
msfsc_hours,
midsleep_hours,
midsleep_unwrapped_hours,
difference_minutes,
sleep_period_hours,
in_primary_sample,
waking_date_in_light_analysis,
dst_crossing,
exclusion
),
"results/data/sleep_diary_nights.csv",
row.names = FALSE,
na = ""
)
write.csv(
sleep_diary_scatter_data,
"data/intermediate/sleep_diary_scatter_data.csv",
row.names = FALSE,
na = ""
)
write.csv(
sleep_diary_scatter_correlations_data,
"data/intermediate/sleep_diary_scatter_correlations_data.csv",
row.names = FALSE
)
write.csv(
sleep_diary_scatter_histogram_data,
"data/intermediate/sleep_diary_scatter_histogram_data.csv",
row.names = FALSE
)
ggsave(
"results/figures/sleep_diary_scatter.png",
sleep_diary_scatter,
width = 11.8,
height = 5.6,
dpi = 220,
bg = "white"
)
ggsave(
"results/figures/sleep_diary_scatter.pdf",
sleep_diary_scatter,
width = 11.8,
height = 5.6,
bg = "white"
)
write.csv(
sleep_diary_checks,
"results/provenance/sleep_diary_checks.csv",
row.names = FALSE
)
write.csv(
sleep_diary_dst_audit |>
filter(dst_crossing) |>
select(
site,
Id,
waking_date,
daytype,
midsleep_hours,
elapsed_midpoint_hours,
elapsed_minus_wall_minutes
),
"results/provenance/sleep_diary_dst_audit.csv",
row.names = FALSE
)
sleep_diary_input_files <- c(
sleep_diary_manifest$path,
"results/data/prepared.rds",
"R/sleep_diary_alignment.R"
)
write.csv(
tibble::tibble(
path = sleep_diary_input_files,
md5 = unname(tools::md5sum(sleep_diary_input_files))
),
"results/provenance/sleep_diary_inputs.csv",
row.names = FALSE
)
writeLines(
c(
"Command: Rscript --vanilla R/sleep_diary_alignment.R",
"Also executed in analysis.qmd via knitr::read_chunk at the corresponding analytical stages.",
"Seed: 20261106; 2000 participant-cluster bootstrap replicates per scope/context.",
"Diary MSFsc-equivalent seed: 20261107; 2000 participant bootstrap replicates on the common eligible sample.",
"Diary correction uses mean sleep-period duration weighted by each participant's observed work/free night counts; correction is zero if free-day duration is not longer.",
"No diary alarm-use field is available. This is an MSFsc equivalent, not a full MCTQ rescore.",
"Upstream daytype2 field label: Today is...; wake label: final awakening today.",
"Sleep onset field verified as sleepprep_wall plus sleepdelay minutes.",
"Wall-clock timestamps encode local labels in UTC; UTC fields retain elapsed-time coordinates.",
"Lifecycle references checked 2026-11-06: dplyr.tidyverse.org/reference/summarise.html; dplyr.tidyverse.org/reference/mutate-joins.html; ggplot2.tidyverse.org/reference/geom_point.html.",
"Formula checked 2026-11-06: docs.ropensci.org/mctq/reference/msf_sc.html; docs.ropensci.org/mctq/reference/sd_week.html. Observed night counts replace the usual weekly weights.",
capture.output(sessionInfo())
),
"results/provenance/sleep_diary_runtime.txt"
)
stopifnot(
nrow(read.csv("data/intermediate/sleep_diary_scatter_data.csv")) ==
nrow(sleep_diary_scatter_data)
)The night-level registry retains inclusion decisions for all imported entries. The participant SD table, correlation table, participant-level correction inputs and results, corrected-timing summary, exact scatterplot data for all three panels, marginal histogram counts, plotted correlation labels, input checksums and runtime record support reproduction. Running Rscript --vanilla R/sleep_diary_alignment.R executes the same stages independently; the report executes them here in analysis order.
15.7 Exposure-analysis sensitivity using MSFsc(diary)
The separate MSFsc(diary) sensitivity analysis repeats the exposure models and downstream calculations using this diary-derived correlate. It compares the established questionnaire-based MSFsc measure with MSFsc(diary) on the same 135 participants, 755 participant-days and 34,884 half-hours. Both pre- and post-midsleep exposure contrasts retain their directions. However, within the original post-MSFsc window, the longer-day/shorter-day ratio is 2.66 (95% CI 1.10–6.43) with questionnaire MSFsc and 1.15 (0.52–2.54) with MSFsc(diary). Daylength moderation is significant in the primary questionnaire-based analysis and its matched repeat, but not in the diary-derived sensitivity. An additional comparison uses diary timing while retaining questionnaire quartiles: its post-MSFsc factor is 2.39 (0.95–6.02). Alignment alone therefore leaves the point estimate similar but its interval includes one; reclassification produces the larger reduction in the estimate. The separate document reports this fixed-group comparison and the full matched-sample analyses, including PRC and Emens summaries, prediction, attribution and model-structure checks.
16 Comparison with Goulet and colleagues
16.2 Design differences and what they contribute
Table 53 shows which differences strengthen the present analysis and which limit direct comparison.
The sensor-placement comparison uses the context-specific errors in momentary exposure reported from concurrent MeLiDos recordings by Zauner, de Vries, et al. (2026).
show_table(table_data("study_comparison"), stub = "feature",
labels = c(feature = "Feature", goulet = "Goulet and colleagues",
melidos = "This analysis",
interpretation = "Consequence for interpretation"))| Feature | Goulet and colleagues | This analysis | Consequence for interpretation |
|---|---|---|---|
| Analytical sample | 19 participants overall; the extreme-DLMO comparison used 4 morning and 5 evening participants. The protocol covered 7 recording days; the paper does not report a total of valid participant-days. | Primary near-eye sample: 140 participants, 778 participant-days, and 35,949 valid half-hours. | The larger sample supports estimation of individual variation and work/free differences. It does not remove imbalance between chronotype groups and sites. |
| Recruitment and daily schedules | Healthy adults aged 19–34, selected by MEQ, with few external constraints on sleep and instructed to keep their preferred sleep schedule. | Healthy adults who did not work shifts, recruited through several research sites and observed during everyday work and free days. | The earlier design reduced schedule variation. MeLiDos captures more everyday variation, but schedules and environments can contribute to group differences. |
| Chronotype and phase | MEQ determined morning/evening membership. Laboratory saliva samples measured DLMO, which also defined the intermediate and extreme subsets. | MSFsc defines the primary quartiles and phase coordinate. MEQ categories provide a sensitivity analysis; DLMO is a published reference guide only. | The earlier study measured the biological phase marker needed for its main interpretation. The MEQ sensitivity narrows the difference in group definition, but does not supply measured DLMO. |
| Exposure measurement | Wrist-worn photopic illuminance in lux. | Near-eye melanopic EDI, with chest measurements as a placement check; bedside measurements during sleep. | Near-eye measurement is a strength for comparing exposure levels. In concurrent MeLiDos recordings, wrist measurements underestimated near-eye melanopic EDI by 30.3%–54.7% across the contexts studied, with larger errors than chest placement (Zauner et al., 2026). |
| Geography and daylight | One location, Montréal, during May–September. | Multiple locations and dates, with site-specific photoperiod information. | MeLiDos can examine whether phase contrasts vary with day length. Uneven chronotype representation across sites limits separation of daylight from geography and related behaviours. |
| Analysis | Hourly averages of log illuminance, group-by-time repeated-measures ANOVA, and comparisons at individual time points. | Cyclic generalized additive mixed models of half-hour means, with repeated observations, individual curves, day effects, residual correlation, registered contrasts, and held-out prediction. | The current models describe smooth timing differences and explicitly represent several sources of dependence. |
Both studies concern observed personal exposure rather than a controlled change in light. Goulet and colleagues interpreted the extreme-DLMO result as compatible with differences in intrinsic circadian period, but did not measure intrinsic period. The association could also reflect differences in behaviour and available light. Likewise, an association between day length and the MeLiDos contrasts does not establish which exposure caused a chronotype or which behavioural response produced the exposure.
16.3 Similarities, differences and the strength of the conclusions
Both analyses show that clock-time and phase-aligned patterns answer different questions, and that the more extreme groups can show clearer separation. Goulet and colleagues reported two phase-specific findings in their extreme subset: higher morning-type exposure around DLMO and higher evening-type exposure 10–12 hours after DLMO. Our candidate evening-higher difference around 1 to 4 hours after MSFsc is qualitatively compatible with their later-phase finding. We have no supported interval overlapping the published DLMO reference interval (Table 17), although exposure is lower for extreme evening types before the reference interval, which is also qualitatively consistent with that study. The reference interval does not locate each participant’s DLMO, so these results cannot establish precise temporal agreement or resolve the earlier near-DLMO finding.
The main strengths here are the larger analytical sample, measurements of melanopic exposure near the eyes, explicit work/free-day comparisons, individual daily curves, and prediction assessed on held-out observations. The earlier study’s main strength is its direct measurement of DLMO after a week with relatively stable preferred sleep schedules. Its extreme-phase finding rests on a small selected subgroup, while the present analysis is limited by its sleep-based phase coordinate and uneven site composition.
17 Reproducibility and outputs
The prepared input snapshot, analysis code, Quarto sources and retained outputs are available in the chronotype analysis repository. Released snapshots are preserved in the Zenodo archive, doi:10.5281/zenodo.24140946.(Zauner and Spitschan 2026) The README describes environment restoration and reproduction from source.
All counts originate from the shared observation registry. Participants are counted uniquely across day types. Individual plots show their contributing days, model and diagnostic tables show the full analytical sample, and validation separates training from assessment counts.
Table 54 summarizes the primary acceptance checks.
acceptance <- table_data("acceptance_checks", "results/provenance")
show_table(acceptance |> count(passed, name = "checks"))
stopifnot(all(acceptance$passed))| Passed | Checks |
|---|---|
| TRUE | 200 |
The imported data also reproduce in a temporary project without access to the source repository. Eight portability checks confirm unchanged observations, cutoffs, participant metadata and counts. The additional analyses check their samples, classifications, time coordinates, support and displayed counts. An independent daylight verification also checks the constrained basis, direct predictions, interval counts and training-only preprocessing. The numerical verification checks 95% simultaneous coverage within each coordinate, reconstructs the primary interval-average contrasts with the full covariance, and verifies the interval definitions used by the photoperiod summaries and manuscript figures. It also confirms that the fitted models, prepared observations and validation inputs are unchanged. The inference refresh script regenerates these results from the saved fits.
Table 55 summarizes the checks for the additional analyses, and Table 56 records the computational environment.
extension_checks <- bind_rows(
table_data("standalone_checks", "results/provenance") |> mutate(analysis = "Standalone inputs"),
table_data("meq_acceptance", "results/provenance") |> mutate(analysis = "MEQ sensitivity"),
table_data("noncyclic_sz_clock_acceptance", "results/provenance") |> mutate(analysis = "Noncyclic group-curve sensitivity"),
table_data("noncyclic_sz_phase_acceptance", "results/provenance") |> mutate(analysis = "Noncyclic group-curve sensitivity"),
table_data("noncyclic_sz_comparison_acceptance", "results/provenance") |> mutate(analysis = "Noncyclic group-curve sensitivity"),
table_data("daylight_acceptance_checks", "results/provenance") |> mutate(analysis = "Daylight exploration"),
table_data("daylight_independent_checks", "results/provenance") |> mutate(analysis = "Original daylight fit verification"),
table_data("phase_response_checks", "results/provenance") |> mutate(analysis = "PRC weighting"),
table_data("phase_response_independent_source_checks", "results/provenance") |> mutate(analysis = "Published PRC source verification"),
table_data("revision5_analysis_checks", "results/provenance") |> mutate(analysis = "PRC and photoperiod model verification"),
table_data("revision7_verification", "results/provenance") |> mutate(analysis = "Within-coordinate inference and interval propagation"),
table_data("revision9_verification", "results/provenance") |> mutate(analysis = "Exposure bands and Emens sensitivity"),
table_data("emens_balance_checks", "results/provenance") |> mutate(analysis = "Advance-to-delay sensitivity")
)
stopifnot(all(extension_checks$passed))
show_table(extension_checks |> count(analysis, passed, name = "checks"))| Analysis | Passed | Checks |
|---|---|---|
| Advance-to-delay sensitivity | TRUE | 40 |
| Daylight exploration | TRUE | 15 |
| Exposure bands and Emens sensitivity | TRUE | 19 |
| MEQ sensitivity | TRUE | 60 |
| Noncyclic group-curve sensitivity | TRUE | 45 |
| Original daylight fit verification | TRUE | 74 |
| PRC and photoperiod model verification | TRUE | 184 |
| PRC weighting | TRUE | 76 |
| Published PRC source verification | TRUE | 7 |
| Standalone inputs | TRUE | 8 |
| Within-coordinate inference and interval propagation | TRUE | 23 |
show_table(table_data("versions", "results/provenance"))| Package | Version |
|---|---|
| R | 4.6.1 |
| mgcv | 1.9.4 |
| gratia | 0.11.2 |
| dplyr | 1.2.1 |
| tidyr | 1.3.2 |
| ggplot2 | 4.0.3 |
| gt | 1.3.0 |
| knitr | 1.51 |
| renv | 1.2.3 |
| LightLogR | 0.10.3 |
| scales | 1.4.0 |
The imported-data manifest, analysis input manifest, source manifest, session information, and complete acceptance results record provenance. The prepared inputs are byte-for-byte copies of source commit a5ca7e6e9968e3ca904528a2638f215dfbbd0212, copied on 22 October 2026. The input guide explains their roles and retained licensing and citation records.
The OpenMP preload enables gratia’s mvnfast dependency on this machine. The installed mgcv build reports that its own OpenMP support is unavailable, so bam() computation runs on one thread. This runtime warning does not indicate a failed model fit.
The full pipeline is invoked with Rscript --vanilla run.R all, followed by a fresh Quarto render. The README describes resumable stages and the local OpenMP preload used by gratia. The helpers are data preparation, models, inference, diagnostics and individual curves, validation, attribution, sensitivity checks, and figures. The histogram section is included directly in this document; its standalone verification executes the same code and checks its plotted bin counts. The gt helper supplies repeated table formatting. All tables, figure data, fitted models, and diagnostics remain inside this secondary-analysis project.
For display changes alone, Rscript --vanilla run.R figures regenerates these figures from saved fits and inference. Model-scale CSV columns remain available alongside the lux and factor columns. Residual diagnostics and predictive scores retain the fitted model’s log scale.
18 Artificial-intelligence assistance
OpenAI Codex Desktop version 26.623.141536 (build 4753), using GPT-6 Astra (model identifier gpt-6-astra) on the Max reasoning setting, assisted with R and Quarto code development, reference checks, numerical checks, figure and table preparation, and text editing. The authors claim responsibility for all calculations, interpretations and text.