06 / 06 · Kaplan-Meier and log-rank
Teaching example. Synthetic data.
How long does a device remain failure-free?
Compare two device versions. Some tests ended before a failure occurred; those observations must not simply be discarded.
12 devices · 8 failures
- Failures / observations
- 8 / 12
- Logrank test: p
- 0.586
Inspect the original observations
| Group | Time | Event: 1 = yes, 0 = no |
|---|---|---|
| Version A | 0 | 1 |
| Version A | 2 | 1 |
| Version A | 4 | 0 |
| Version A | 6 | 1 |
| Version A | 8 | 1 |
| Version A | 10 | 0 |
| Version B | 1 | 1 |
| Version B | 3 | 0 |
| Version B | 5 | 1 |
| Version B | 7 | 1 |
| Version B | 9 | 0 |
| Version B | 11 | 1 |
Calculated by the Linza engine from this example’s data. Opening it in the editor runs a fresh calculation.
Why this method
Kaplan-Meier uses time to failure and right censoring. A censored device is only known to have avoided failure up to its last observation. Comparing mean observed times would lose this distinction. The logrank test compares whole curves rather than a selected time point.
Explore the theory: Time to event: Kaplan-Meier and log-rank →Work through it in Linza
In Data, distinguish time from failure status. Curve A has censoring at day 4: the number under observation decreases without a curve drop. Failure at day 6 creates a step. In Analyses, read the overall test alongside event counts and intervals.
Open a copy and recalculateTry changing one condition
For version A at day 4, replace censoring with a failure. How does the curve change at that time?
Show the explanation
An additional downward step appears because day 4 now has a recorded failure. The event count increases. This changes the meaning of an observation; in research, event status must reflect what happened, not a desired result.
Data and reproducibility
Teaching studies with synthetic data. The scenarios reflect practical questions, but do not report real experimental findings.