Define the event
Construct a participant-and-trip baseline, an eligibility rule, a recovery indicator, and follow-up time. Records without an observed recovery are censored at the documented boundary.
CASE STUDY 01 / MODELING
How do you define and model a return to baseline when some recoveries are never observed?
How quickly does cognitive performance return to a pre-trip baseline after long-haul flight, and how should incomplete follow-up be handled?
Post-flight Psychomotor Vigilance Task measurements were linked to sleep and trip context across four California–Australia routes. The challenge was to turn repeated observations into a defensible time-to-event outcome.
THE STORY IN PLAIN LANGUAGE
The work connects endpoint design, longitudinal feature engineering, and survival analysis. The deliverable is a traceable analytical workflow: a defined cohort, an event/censoring record, model outputs, and checks that explain when the interpretation is credible.
The stack follows the analytical task: prepare the data, fit or apply the method, check the result, and communicate the output.
See how the libraries connect to the wider portfolio →THE PROJECT, STEP BY STEP
Construct a participant-and-trip baseline, an eligibility rule, a recovery indicator, and follow-up time. Records without an observed recovery are censored at the documented boundary.
Align actigraphy, sleep logs, and flight events, then derive sleep features for 24-, 48-, and 72-hour windows. Review missingness and time alignment before modeling.
Fit Cox proportional hazards models and examine proportional-hazards checks, covariate collinearity, and alternative repeated-measures diagnostics.
THE TECHNICAL CASE
The central statistical decision is the definition of recovery. A time-to-event model is only meaningful when the baseline, event threshold, eligibility criteria, and follow-up boundary describe the same scientific question.
The notebooks link observations to participant and trip, construct pre-trip baseline features, then identify the first eligible post-trip observation meeting the recovery definition. Versions differ in the baseline rule; the TST notebook uses mean-minus-standard-deviation baseline features and a four-day censoring boundary. These choices must be reconciled before comparing model results.
A record with no observed recovery is retained as censored rather than discarded or assigned a recovery time. The event time is bounded by the observation schedule, so daily assessments do not establish the exact biological moment of recovery. Independent censoring remains a modeling assumption.
Sleep predictors are aligned to flight-relative 24-, 48-, and 72-hour windows. These are alternative summaries of correlated information. Their interpretation depends on timestamp consistency, missingness, units, and whether the feature precedes the modeled event.
The implemented workflow uses Surv, coxph, cox.zph, and survfit. Earlier notebooks also explore mixed-effects and Poisson formulations. Each formulation answers a different question; repeated PVT measurements and a time-to-recovery endpoint should not be treated as interchangeable outcomes.
h(t | X) = h₀(t) exp(β₁X₁ + … + βₚXₚ)
The Cox model relates covariates to the instantaneous rate of the defined recovery event among observations still at risk. A hazard ratio is not a probability of recovery or a causal effect.
EXPLORE THE METHOD
Eight synthetic trips demonstrate why incomplete follow-up must remain in the risk set until censoring. These are teaching data, not research results.
QUALITY OF THE EVIDENCE
Inspect cox.zph results and time-dependent residual patterns before treating a single hazard ratio as stable over follow-up.
Review variance inflation factors and overlap between nested sleep windows; avoid interpreting unstable coefficients as distinct biological effects.
Track exclusions and available events by subgroup. A category with few observations cannot support the same precision as the full cohort.
Derive medians from the estimated survival distribution. A median of the survfit time grid is not the median recovery time.
FOR THE TECHNICAL CONVERSATION
An interviewer can ask how the estimand changes when the baseline threshold changes, how repeated trips affect independence, and what sensitivity analyses would make the recovery definition more defensible.
WHAT IT DEMONSTRATES
The work demonstrates a complete statistical workflow: outcome definition, temporal feature engineering, model fitting, and diagnostic review. It does not establish a validated prediction product.