stat-compare-two-groups
Compare a continuous variable between two groups with automatic selection of t-test, Welch test, or Mann-Whitney U test based on data properties.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 4
- Forks
- 1
01 前言 Front Matter
- name
- stat-compare-two-groups
- description
- Compare a continuous variable between two groups with automatic selection of t-test, Welch test, or Mann-Whitney U test based on data properties.
02 资源文件 3
- 参考文档agents/claude.yaml364 B
- 参考文档agents/openai.yaml365 B
- 参考文档config.yaml335 B
03 SKILL.md 正文
Skill: Two-Group Statistical Comparison
Use When
- User wants to test whether a continuous measurement differs between two experimental groups (e.g., treated vs. control, knockout vs. wild-type)
- User needs a p-value, effect size, and confidence interval for a two-group comparison
- User is unsure which statistical test is appropriate and wants automatic method selection
Inputs
- Required:
- Data table (CSV or TSV) with a numeric value column and a group column (exactly two group levels)
- Optional:
- Group variable column name (default: auto-detected if only one non-numeric column)
- Value variable column name (default: auto-detected if only one numeric column)
- Paired comparison:
trueorfalse(default:false) - Alternative hypothesis:
two-sided(default),greater, orless - Output directory (default:
./compare_output)
Workflow
- Read data; validate that group column has exactly two levels.
- Run normality test (Shapiro-Wilk) on each group separately.
- If both groups are normal: run Levene's test for equal variance.
- Equal variance (p > 0.05): Student's t-test.
- Unequal variance (p ≤ 0.05): Welch's t-test.
- If either group is non-normal: Mann-Whitney U test (unpaired) or Wilcoxon signed-rank test (paired).
- Compute effect size: Cohen's d (parametric) or rank-biserial correlation r (non-parametric).
- Compute 95% confidence interval for the difference in means (parametric) or Hodges-Lehmann estimator (non-parametric).
- Generate a box plot with individual data points and significance annotation.
- Write a structured result and plot (PDF) to output directory.
- Report method used, test statistic, p-value, effect size, confidence interval, and interpretation.
- Save the executable analysis script (
analysis_code.pyoranalysis_code.R) and software version manifest (session_info.txt) used to produce results.
Output Contract
- Result (TSV): group1, group2, method_used, statistic, p_value, effect_size, effect_size_type, ci_lower, ci_upper, n_group1, n_group2
- Box plot with data points (PDF)
- Decision log explaining method selection (printed to stdout)
- Reproducibility artifacts:
analysis_code.pyoranalysis_code.R, plussession_info.txt
Limits
- Requires exactly two groups; use
stat-compare-multiple-groupsfor three or more groups. - Minimum recommended sample size: n ≥ 5 per group (results are unreliable below this).
- Paired comparison requires equal sample sizes in both groups.
- Common failure: group column contains more than two levels — filter data before running.
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-survival-analysis
Estimate and compare survival functions using Kaplan-Meier curves and log-rank test, with optional Cox proportional hazards regression.
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).