stat-survival-analysis
Estimate and compare survival functions using Kaplan-Meier curves and log-rank test, with optional Cox proportional hazards regression.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 4
- Forks
- 1
01 前言 Front Matter
- name
- stat-survival-analysis
- description
- Estimate and compare survival functions using Kaplan-Meier curves and log-rank test, with optional Cox proportional hazards regression.
02 资源文件 43
- 参考文档agents/claude.yaml344 B
- 参考文档agents/openai.yaml345 B
- 参考文档config.yaml309 B
- 参考文档rules/3d.md2.2 KB
- 参考文档rules/animations.md778 B
- 参考文档rules/assets.md1.6 KB
- 其他rules/assets/charts-bar-chart.tsx3.3 KB
- 其他rules/assets/text-animations-typewriter.tsx2.1 KB
- 其他rules/assets/text-animations-word-highlight.tsx2.3 KB
- 参考文档rules/audio-visualization.md4.8 KB
- 参考文档rules/audio.md3.5 KB
- 参考文档rules/calculate-metadata.md3.2 KB
- 参考文档rules/can-decode.md1.6 KB
- 参考文档rules/charts.md2.9 KB
- 参考文档rules/compositions.md3.7 KB
- 参考文档rules/display-captions.md5.3 KB
- 参考文档rules/extract-frames.md5.4 KB
- 参考文档rules/ffmpeg.md998 B
- 参考文档rules/fonts.md3.4 KB
- 参考文档rules/get-audio-duration.md1.3 KB
- 参考文档rules/get-video-dimensions.md1.6 KB
- 参考文档rules/get-video-duration.md1.3 KB
- 参考文档rules/gifs.md3.6 KB
- 参考文档rules/images.md2.7 KB
- 参考文档rules/import-srt-captions.md2.2 KB
- 参考文档rules/light-leaks.md2.3 KB
- 参考文档rules/lottie.md1.8 KB
- 参考文档rules/maps.md11.0 KB
- 参考文档rules/measuring-dom-nodes.md973 B
- 参考文档rules/measuring-text.md2.7 KB
- 参考文档rules/parameters.md2.3 KB
- 参考文档rules/sequencing.md2.7 KB
- 参考文档rules/sfx.md867 B
- 参考文档rules/subtitles.md922 B
- 参考文档rules/tailwind.md420 B
- 参考文档rules/text-animations.md700 B
- 参考文档rules/timing.md3.9 KB
- 参考文档rules/transcribe-captions.md1.9 KB
- 参考文档rules/transitions.md5.7 KB
- 参考文档rules/transparent-videos.md2.2 KB
- 参考文档rules/trimming.md1.2 KB
- 参考文档rules/videos.md3.4 KB
- 参考文档rules/voiceover.md3.2 KB
03 SKILL.md 正文
Skill: Survival Analysis
Use When
- User wants to analyze time-to-event data (overall survival, disease-free survival, time to relapse)
- User wants to compare survival curves between two or more groups (e.g., high vs. low expression, treated vs. untreated)
- User wants to identify predictors of survival using multivariable Cox regression
- Use cases: clinical trial outcomes, patient survival, cancer prognosis
Inputs
- Required:
- Data table (CSV or TSV) with: time-to-event column (numeric), event indicator column (1 = event occurred, 0 = censored)
- Time column name
- Event column name
- Optional:
- Group column name for Kaplan-Meier comparison and log-rank test (if omitted: single KM curve)
- Covariate column names for Cox regression (if provided: runs multivariable Cox model)
- Time unit label (default:
days) - Output directory (default:
./survival_output)
Workflow
- Read data; validate that time column is non-negative numeric and event column is binary (0/1).
- Compute Kaplan-Meier survival estimate for each group (or overall if no group column).
- Report median survival time and 95% confidence interval (Greenwood formula) per group.
- If multiple groups: run log-rank test (Mantel-Cox); report chi-square statistic and p-value.
- Generate Kaplan-Meier plot with confidence intervals, censoring tick marks, and at-risk table.
- If covariate columns provided: a. Fit Cox proportional hazards model. b. Test proportional hazards assumption (Schoenfeld residuals). c. Report for each covariate: hazard ratio, 95% CI, z-statistic, p-value. d. Generate forest plot of hazard ratios.
- Write results and plots (PDF) to output directory.
- Save the executable analysis script (
analysis_code.pyoranalysis_code.R) and software version manifest (session_info.txt) used to produce results.
Output Contract
- KM table (TSV): time, survival_probability, ci_lower, ci_upper, n_at_risk, n_events, group
- Median survival table (TSV): group, median_survival, ci_lower, ci_upper
- Log-rank test result (TSV): chi_square, df, p_value (if multiple groups)
- Cox regression table (TSV): covariate, hazard_ratio, ci_lower, ci_upper, z_statistic, p_value (if covariates provided)
- Kaplan-Meier plot with at-risk table (PDF)
- Forest plot (PDF, Cox only)
- Reproducibility artifacts:
analysis_code.pyoranalysis_code.R, plussession_info.txt
Limits
- Requires accurate censoring information; informative censoring (censored because of outcome-related reasons) biases results.
- Cox model assumes proportional hazards — verify with Schoenfeld residuals test (p > 0.05 for each covariate).
- Log-rank test has low power when hazard ratio changes over time (crossing survival curves).
- Common failure: event column containing values other than 0/1 (e.g., 2 for competing events) — binarize or use competing risks models.
04 同仓库更多 Skills
structured-intelligence-skill-creator
Create or update repository skills that conform to local templates, provider metadata requirements, registry rules, and validation workflows.
stat-pca
Perform PCA on a numeric data matrix to reduce dimensionality, visualize sample structure, and identify top contributing features.
stat-pairwise-correlation
Compute pairwise correlations and significance tests across all numeric variables, and produce a correlation heatmap.
stat-nonlinear-embedding
Embed high-dimensional data into 2D using t-SNE or UMAP for exploratory visualization of sample or cell relationships.
stat-logistic-regression
Fit a logistic regression model for binary outcomes, report odds ratios and model performance (AUC-ROC, confusion matrix).
stat-learn-bayesian-network
Learn the structure and conditional probabilities of a Bayesian network from observational data for causal discovery or dependency modeling.