skillfed

lifelines

Lifelines is a Python survival analysis library built for medical research and epidemiology. It models time-to-event outcomes like disease progression or recovery, properly accounting for censored data from patients who leave studies early. Use it to estimate survival curves, compare treatment groups, and identify risk factors through Cox proportional hazards regression.

Lifelines analyzes clinical trial survival data using Kaplan-Meier curves and Cox regression to handle censored observations.

AI-generated summary based on this skill's SKILL.md

19 2 MIT updated by tondevrel

Install

tondevrel/scientific-agent-skills/lifelines

CLI (skillfed)coming soon
git clone https://github.com/tondevrel/scientific-agent-skills
cp -r scientific-agent-skills/skills/lifelines ~/.claude/skills/lifelines

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is lifelines and what does it do?

Lifelines is a Python survival analysis library built for medical research and epidemiology. It models time-to-event outcomes like disease progression or recovery, properly accounting for censored data from patients who leave studies early. Use it to estimate survival curves, compare treatment groups, and identify risk factors through Cox proportional hazards regression.

How does lifelines handle censored data in time-to-event analysis?

Lifelines is designed to properly handle censored time-to-event data in medical research by accounting for patients who leave studies early or whose events haven't occurred by the study end. Its core algorithms—including Kaplan-Meier estimation and Cox regression—incorporate censoring information directly, ensuring unbiased survival estimates even when follow-up is incomplete.

Can lifelines perform Kaplan-Meier curves for clinical trials?

Yes. Lifelines includes a Kaplan-Meier fitter that estimates and visualizes survival curves for clinical trials. It generates survival probability estimates over time and supports stratified analysis to compare outcomes between treatment groups, making it ideal for analyzing clinical trial survival data.

How do I use Cox regression to identify hazard ratios in lifelines?

Lifelines' Cox proportional hazards model quantifies risk factors by computing hazard ratios—the relative risk of an event between groups or per unit change in a covariate. Fit your time-to-event data with covariates, and the model outputs hazard ratios and confidence intervals to identify and measure which factors influence survival.

What statistical tests does lifelines provide for comparing survival outcomes?

Lifelines supports logrank tests and other statistical comparisons to test whether survival curves differ significantly between treatment groups. These tests help determine if observed differences in survival outcomes are statistically meaningful in clinical trial data analysis.

Is lifelines suitable for building predictive survival models?

Yes. Lifelines supports building predictive survival models for patient prognosis using Cox regression and parametric survival models like Weibull. These models estimate individual survival probabilities and can help clinicians assess disease progression and recovery risk.

SKILL.md

rendered from the published skill — quoted content, verbatim

Lifelines - Survival Analysis

In medicine, we often care about "Time to Event" (death, recovery, relapse). Lifelines handles the complexity of "censored" data (patients who left the study).

When to Use

  • Analyzing clinical trial data (time to death, disease progression).
  • Comparing survival between treatment groups.
  • Identifying risk factors using Cox Proportional Hazards regression.
  • Building survival models for prognosis.
  • Epidemiology studies (time to infection, recovery).

Core Principles

Censoring

Patients who haven't experienced the event by the end of the study are "censored". Lifelines properly accounts for this.

Hazard Ratios

In Cox regression, a hazard ratio > 1 means increased risk; < 1 means decreased risk.

Survival Curves

Kaplan-Meier estimates the probability of survival over time without assuming a distribution.

Quick Reference

Standard Imports

```python from lifelines import

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
skills/lifelines/SKILL.md

Related skills

Tags

medical-statistics time-to-event biostatistics clinical-research hazard-modeling epidemiological-analysis censored-data prognostic-modeling survival-curves parametric-distributions