Course contentsShow
← Data Science
Lesson 807 of 2,14521. Survival AnalysisFree lesson

Survival Data Structure

Formatting survival data with time, event indicator, and covariates for statistical analysis.

Survival Data Structure

You'll learn how to organize survival data into the three essential columns needed for statistical analysis.

The Three Pillars of Survival Data

Survival analysis requires data structured in a specific way—different from typical regression or classification datasets. Think of it like a medical record that needs to track when something happened, whether it actually happened, and what factors might have influenced it.

Your survival dataset must contain three core components:

1. Time Variable

This records how long each subject was observed—from the defined time origin (e.g., treatment start, diagnosis) until either the event occurs or observation ends. Time is typically measured in days, months, or years depending on your study.

2. Event Indicator

A binary flag (usually 0 or 1) showing whether the event of interest occurred. A value of 1 means the event happened (patient died, machine failed), while 0 indicates censoring—the subject left the study, time ran out, or they're still event-free.

3. Covariates

Additional variables that might influence survival: age, treatment group, baseline health metrics, machine model, etc. These are your explanatory variables.

Why This Structure Matters

This format allows survival models to properly handle censored observations—subjects whose event status is incomplete. Without the event indicator, you couldn't distinguish between "event didn't happen yet" and "we stopped observing them."

Think of it like tracking runners in a marathon: you need their finish time (time variable), whether they crossed the finish line or dropped out (event indicator), and their characteristics like training history (covariates).

Key Takeaway: Survival data requires three components—time to event or censoring, an event indicator flag, and covariates—to properly account for both complete observations and censored cases in your analysis.