# Analysis plan: do depressive symptoms go with day-to-day drift in the phase of the daily activity rhythm?

## Question

One temporal account of depression distinguishes slowed time within the moment from desynchronisation over days: a clock running at a slightly different rate drifts in phase against a shared reference. Applied to daily behaviour, desynchronisation means the timing (phase) of a person's daily activity rhythm varies or drifts from day to day relative to the shared 24-hour clock, which is distinct from a flatter (lower-amplitude) rhythm. An earlier registered analysis of the same data (prereg:7cd2d2540cf55331ae597ce29c2f04ebecce4b117540653117567b5661c9e69c) found lower interdaily stability and relative amplitude and higher residual autocorrelation with more depressive symptoms. This analysis asks whether depressive symptoms also go with phase variability and drift beyond amplitude and activity.

## Data

NHANES 2011-2014 hourly wrist activity (PAXHR), headers, demographics and PHQ-9, with the valid-day rules and participant set of the earlier analysis (`code/rhythm.py`, reused).

## What was seen before registering

That 56,971 valid days from 10,091 participants of all ages yield daily cosinor fits, that all day-of-week codes occur, and that the weekday-only measure is missing for 476 participants. No phase measure was related to PHQ-9 scores. The earlier analysis's results on the same participants were known.

## Measures (`code/phase.py`)

Per valid day: single-component 24-hour cosinor fit to log(1 + hourly activity), giving the acrophase (clock hour of peak). Per person:
- **phase_sd:** circular standard deviation of daily acrophases, in hours;
- **drift_abs:** absolute slope of acrophase across days, in hours per day, with phases unwrapped around the circular mean;
- **acrophase:** circular mean (secondary);
- **weekday_phase_sd:** phase_sd over weekdays only (secondary).

## Tests

Rank regressions (outcome and PHQ-9 ranked; covariates on their own scale; HC3 errors). Covariates: age, age², sex, survey cycle and exam period, plus relative amplitude and mean activity, so that the tests concern phase beyond a flatter or lower rhythm.

**Primary (one-sided, higher with PHQ-9; Holm across two):** H1 phase_sd; H2 drift_abs.

**Secondary:**
- both outcomes without the amplitude and activity adjustment;
- weekday-only phase_sd, which removes weekend shifts;
- later mean acrophase;
- phase_sd adjusted additionally for interdaily stability.

## Limits stated in advance

Four to seven days give imprecise per-person phase estimates. Daily cosinor phase is less reliable on low-amplitude days, hence the adjustment. Weekend and work schedules shift phase for reasons unrelated to depression. The data are cross-sectional. Survey weights are not used.
