scientific-skills/Data Analysis/statistical-analysis/SKILL.md
Guided statistical analysis for test selection, assumption checks, power analysis, and APA-style reporting. Use when you need to choose an appropriate statistical test for your data and produce publication-ready results (including effect sizes and diagnostics).
npx skillsauth add aipoch/medical-research-skills statistical-analysisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when you need to:
For programming model-specific workflows (especially regression variants and custom diagnostics), prefer statsmodels directly; this skill focuses on guided selection, checks, interpretation, and reporting.
references/test_selection_guide.md).scripts/assumption_checks.py (see references/assumptions_and_diagnostics.md).references/bayesian_statistics.md).references/effect_sizes_and_power.md).references/reporting_standards.md).Python (recommended 3.10+) with:
numpy>=1.24pandas>=2.0scipy>=1.10statsmodels>=0.14pingouin>=0.5matplotlib>=3.7pymc>=5.0 (Bayesian workflows)arviz>=0.16 (Bayesian diagnostics/plots)The example below is designed to be runnable end-to-end: it generates synthetic data, checks assumptions, runs an independent-samples t-test with effect size, performs power analysis, and prints an APA-style result string.
import numpy as np
import pandas as pd
import pingouin as pg
from statsmodels.stats.power import tt_ind_solve_power
# If your repo provides this module, use it; otherwise comment it out.
from scripts.assumption_checks import comprehensive_assumption_check
# ----------------------------
# 1) Create example dataset
# ----------------------------
rng = np.random.default_rng(7)
n_a, n_b = 50, 52
group_a = rng.normal(loc=75, scale=9, size=n_a)
group_b = rng.normal(loc=69, scale=9, size=n_b)
df = pd.DataFrame({
"score": np.r_[group_a, group_b],
"group": ["A"] * n_a + ["B"] * n_b
})
# ----------------------------
# 2) Assumption checks
# ----------------------------
assump = comprehensive_assumption_check(
data=df,
value_col="score",
group_col="group",
alpha=0.05
)
print("Assumption check summary:")
print(assump["summary"] if "summary" in assump else assump)
# ----------------------------
# 3) Run test + effect size
# ----------------------------
res = pg.ttest(group_a, group_b, correction="auto") # Welch if needed
t_stat = float(res["T"].iloc[0])
dfree = float(res["dof"].iloc[0])
pval = float(res["p-val"].iloc[0])
d = float(res["cohen-d"].iloc[0])
ci_low, ci_high = res["CI95%"].iloc[0]
# ----------------------------
# 4) Power analysis (planning)
# ----------------------------
n_required = tt_ind_solve_power(
effect_size=0.5, alpha=0.05, power=0.80, ratio=1.0, alternative="two-sided"
)
# ----------------------------
# 5) APA-style reporting string
# ----------------------------
m_a, sd_a = group_a.mean(), group_a.std(ddof=1)
m_b, sd_b = group_b.mean(), group_b.std(ddof=1)
apa = (
f"Group A (n = {n_a}, M = {m_a:.2f}, SD = {sd_a:.2f}) and "
f"Group B (n = {n_b}, M = {m_b:.2f}, SD = {sd_b:.2f}) differed, "
f"t({dfree:.0f}) = {t_stat:.2f}, p = {pval:.3f}, d = {d:.2f}, "
f"95% CI [{ci_low:.2f}, {ci_high:.2f}]."
)
print("\nAPA-style result:")
print(apa)
print(f"\nPlanning note: to detect d = 0.50 with 80% power, "
f"required n per group ≈ {n_required:.0f}.")
Use references/test_selection_guide.md as the primary decision aid. The selection is typically driven by:
Common mappings:
The automated workflow in scripts/assumption_checks.py (referenced in the original documentation) is expected to cover:
Key parameter:
alpha (default commonly 0.05): decision threshold for assumption tests.Recommended remedies (see references/assumptions_and_diagnostics.md):
Effect sizes should be reported alongside inferential results (see references/effect_sizes_and_power.md):
Always prefer confidence intervals (frequentist) or credible intervals (Bayesian) to communicate precision.
Implemented via statsmodels.stats.power:
n given target effect size, alpha, and desired power.n, alpha, and desired power.Avoid “post-hoc power” computed from observed p-values; use sensitivity analysis instead.
Use references/reporting_standards.md to ensure inclusion of:
For Bayesian reporting (see references/bayesian_statistics.md), include:
tools
Generates complete conventional oncology bulk-transcriptome biomarker and hub-gene research designs from a user-provided cancer type and study direction. Always use this skill whenever a user wants to design, plan, or build a tumor bioinformatics study centered on differential expression, prognostic filtering or risk modeling, PPI-based hub-gene prioritization, diagnostic/prognostic evaluation, clinical association, immune infiltration context, methylation context, and optional tissue or cell validation. Covers five study patterns (signature-first prognostic workflow, hub-gene-first biomarker workflow, hybrid signature-to-hub workflow, immune-context biomarker workflow, translational validation workflow) and always outputs four workload configs (Lite / Standard / Advanced / Publication+) with recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, publication upgrade path...
development
Generates complete conventional non-oncology bioinformatics research designs from a user-provided disease context, process-related gene family or biological theme, and validation direction. Use when a study centers on multi-dataset bulk transcriptome integration, DEG analysis, process-gene intersection, enrichment analysis, GSEA, PPI hub-gene prioritization, TF/miRNA regulatory networks, ROC-based biomarker evaluation, and immune infiltration analysis. Covers five study patterns (process-DEG discovery, enrichment/GSEA interpretation, hub-gene prioritization, regulatory-network and immune interpretation, multi-layer public validation) and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.
tools
Plans confounder control, variable adjustment logic, and bias mitigation strategies at the protocol stage for clinical, epidemiologic, translational, observational, and biomarker studies. Always use this skill when a user needs to identify major confounders, decide which variables should or should not be adjusted for, compare matching/stratification/weighting approaches, anticipate selection or measurement bias, or pressure-test a study design before execution. Focus on bias sensing, causal structure awareness, variable-role classification, and critical design review rather than generic statistical advice.
testing
Generates complete comparative network-toxicology research designs from a user-provided exposure pair, shared toxic phenotype, and validation direction. Use when a study centers on two related exposures under one outcome and needs target collection, shared-vs-specific target decomposition, enrichment, PPI hub prioritization, docking, optional transcriptomic cross-checks, and conservative mechanistic synthesis. Covers five study patterns and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.