survival-epi

Estimate time-to-event outcomes with Kaplan–Meier, log-rank, and Cox PH models.

33|6|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/xjtulyc/awesome-rosetta-skills --skill survival-epi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: survival-epi
Source: https://github.com/xjtulyc/awesome-rosetta-skills/tree/main/skills/17-public-health/survival-epi
Command: npx skills add https://github.com/xjtulyc/awesome-rosetta-skills --skill survival-epi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires lifelines>=0.27, scikit-survival>=0.21, pandas>=1.5, matplotlib>=3.6, numpy>=1.23.

What problem does it solve?

This Skill helps you analyze epidemiological time-to-event outcomes, including comparing survival curves, estimating hazard effects, and handling competing risks when multiple causes of event can occur.

Core Features & Use Cases

  • Kaplan-Meier + log-rank: Estimate survival curves by exposure group and test differences with log-rank (including multi-group log-rank).
  • Cox PH with Schoenfeld residuals: Fit Cox proportional hazards models, estimate hazard ratios, and assess the proportional hazards assumption with scaled Schoenfeld residuals.
  • Parametric AFT + competing risks: Support flexible parametric survival via AFT models and competing-risks modeling using CIF estimation (Aalen–Johansen) plus cause-specific hazard comparisons (Fine–Gray concept referenced).

Example use: you have a cohort study where patients may die from the disease or from other causes, and you want to quantify how an exposure changes both overall risk over time and cause-specific incidence.

Quick Start

Use the survival-epi skill to generate synthetic survival data, run Kaplan-Meier curves with a log-rank test between exposure groups, then fit a Cox PH model with proportional-hazards checking.

Frequently Asked Questions about survival-epi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a Kaplan-Meier survival analysis with a log-rank test in Python?

Kaplan-Meier survival analysis estimates survival curves by exposure group and tests differences using log-rank hypothesis testing, requiring right-censored time-to-event data formatted with covariates for model fitting.

Can I fit a Cox proportional hazards model and check proportional hazards assumptions using Schoenfeld residuals?

Yes, you can fit a Cox proportional hazards model to estimate hazard ratios and check the proportional hazards assumption by testing scaled Schoenfeld residuals, ensuring the hazards remain proportional over time.

How does competing risks cumulative incidence estimation work for cohort studies?

Competing risks cumulative incidence estimation uses the Aalen-Johansen method to calculate cause-specific incidence when multiple event causes occur, referencing the Fine-Gray concept for cause-specific hazard comparisons.

Does survival analysis with time-varying covariates require a specific data format?

Survival analysis with time-varying covariates requires right-censored time-to-event data structured in a start/stop interval format, allowing the model to update covariate values over the follow-up period.

What Python libraries do I need for epidemiological survival analysis and hazard ratio modeling?

Epidemiological survival analysis and hazard ratio modeling require Python libraries including lifelines and scikit-survival for model fitting, alongside pandas, numpy, and matplotlib for data handling and visualization.

When should I use an AFT model instead of Cox PH for time-to-event outcomes?

Use an AFT parametric model instead of Cox PH for time-to-event outcomes when the proportional hazards assumption fails, as AFT provides flexible parametric survival modeling that estimates survival time directly.