skills/63-tondevrel-scientific-agent-skills/lifelines/SKILL.md
Complete survival analysis library in Python. Handles right-censored data, Kaplan-Meier curves, and Cox regression. Standard for clinical trial analysis and epidemiology.
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research lifelinesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
In medicine, we often care about "Time to Event" (death, recovery, relapse). Lifelines handles the complexity of "censored" data (patients who left the study).
Patients who haven't experienced the event by the end of the study are "censored". Lifelines properly accounts for this.
In Cox regression, a hazard ratio > 1 means increased risk; < 1 means decreased risk.
Kaplan-Meier estimates the probability of survival over time without assuming a distribution.
from lifelines import KaplanMeierFitter, CoxPHFitter
from lifelines.statistics import logrank_test
import pandas as pd
# 1. Kaplan-Meier (Visualizing survival)
kmf = KaplanMeierFitter()
kmf.fit(durations=df['days'], event_observed=df['died'])
kmf.plot_survival_function()
kmf.median_survival_time_ # Time when 50% have died
# 2. Cox Proportional Hazards (Risk factors)
cph = CoxPHFitter()
cph.fit(df, duration_col='days', event_col='died')
cph.print_summary() # See hazard ratios for age, drug type, etc.
cph.plot_partial_effects_on_outcome(covariates=['age'], values=[30, 50, 70])
cph.check_assumptions() to validate Cox model.from lifelines.statistics import multivariate_logrank_test
# Compare survival across treatment groups
results = multivariate_logrank_test(df['days'], df['group'], df['died'])
print(results.p_value)
from lifelines import WeibullFitter, ExponentialFitter
# When you need to extrapolate beyond observed data
wf = WeibullFitter()
wf.fit(df['days'], df['died'])
wf.plot()
Lifelines transforms complex survival data into actionable medical insights, enabling evidence-based decisions in clinical research and practice.
tools
Recommend AND run open-source AI tools, agents, Claude Code / Codex skills, and MCP servers for any stage of a literature review — searching, reading, extracting, synthesizing, screening, citation-checking, and paper writing. Use when the user asks "what tool should I use to..." OR "install/run/use <tool> to ..." for research/lit-review work: automating a survey or related-work section, PDF→Markdown extraction for LLMs (MinerU/marker/docling), PRISMA / systematic review (ASReview), citation-backed Q&A over PDFs (PaperQA2), wiring papers into Claude/Cursor via MCP (arxiv/paper-search/zotero servers), or chatting with a Zotero library. Ships a launcher (scripts/litrun.py) that installs each tool in an isolated venv and runs it. Curated catalog of 70+ vetted projects. 支持中英文(用于「文献综述工具选型」与「一键安装/运行」)。
development
Route empirical-research requests through the Auto-Empirical Research Skills catalog when this whole repository is installed as one skill in Codex, CodeBuddy, Claude Code, or another IDE. Use to choose and load the right vendored AERS skill for causal inference, econometrics, replication, data acquisition, manuscript writing, peer review and referee responses, citation checking, de-AIGC editing, or full empirical-paper workflows without reading the entire repository at once.
documentation
Use when the project collects primary data or runs a field, lab, or survey experiment, before the intervention begins — write the pre-analysis plan, size the sample from a power calculation, and register with the AEA RCT Registry. Apply after the design is chosen in aer-identification and before any outcome data are seen.
tools
Guide economists to authoritative data sources with explicit, confirmed data specifications before retrieval; interfaces with Playwright MCP to navigate portals and extract real data, not articles about data.