CASE STUDY 01 / MODELING

Cognitive recovery after long-haul flight

How do you define and model a return to baseline when some recoveries are never observed?

Rdplyrtidyrlubridatesurvivallme4lmerTestcarDHARMaggplot2openxlsxR Markdown
FOUR ROUTE ANALYSIS SCOPEIllustrative visual; no research data shown
THE QUESTION

How quickly does cognitive performance return to a pre-trip baseline after long-haul flight, and how should incomplete follow-up be handled?

THE SETTING

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

A return to baseline is a statistical definition before it is a model.

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.

Technology behind this workflow 12 tools & formats

The stack follows the analytical task: prepare the data, fit or apply the method, check the result, and communicate the output.

Rdplyrtidyrlubridatesurvivallme4lmerTestcarDHARMaggplot2openxlsxR Markdown
See how the libraries connect to the wider portfolio →

THE PROJECT, STEP BY STEP

See how the question became a reviewable result.

01 / MODELINGVISUAL WALKTHROUGH
STEP 01 / 03Define the event
Baseline + eventSleep contextCox + checks
Four route analysis scope
STEP 02 / 03Engineer sleep context
Baseline + eventSleep contextCox + checks
Four route analysis scope
STEP 03 / 03Check the model
Baseline + eventSleep contextCox + checks
Four route analysis scope
Illustrative process diagram
01

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.

02

Engineer sleep context

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.

03

Check the model

Fit Cox proportional hazards models and examine proportional-hazards checks, covariate collinearity, and alternative repeated-measures diagnostics.

THE TECHNICAL CASE

Decisions behind the analysis.

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.

Unit of analysis
Participant × trip, with repeated PVT observations converted into an event time and censoring indicator.
Inputs
Pre-trip and post-trip Psychomotor Vigilance Task (PVT) measurements; sleep features; route and layover context.
Deliverables
An analysis cohort, event/censoring variables, Cox model summaries, survival estimates, and diagnostic outputs.
01

Outcome construction

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.

02

Censoring and observation frequency

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.

03

Covariate engineering

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.

04

Model interpretation

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.

METHOD IN FOCUS

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

Explore censoring in a survival estimate

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

Checks that change the conclusion.

  • Proportional hazards

    Inspect cox.zph results and time-dependent residual patterns before treating a single hazard ratio as stable over follow-up.

  • Collinearity

    Review variance inflation factors and overlap between nested sleep windows; avoid interpreting unstable coefficients as distinct biological effects.

  • Sparse groups and missingness

    Track exclusions and available events by subgroup. A category with few observations cannot support the same precision as the full cohort.

  • Survival quantiles

    Derive medians from the estimated survival distribution. A median of the survfit time grid is not the median recovery time.

FOR THE TECHNICAL CONVERSATION

Where I would take the discussion next.

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

From method to meaning.

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.

Want to discuss the methods?

Email Raee