Communitygithub.com

DRZ-hang/StatMate

Evidence-first agent skill for auditable statistical analysis, diagnostics, publication figures, tables, and teaching reports from real research data.

StatMate란 무엇인가요?

StatMate is a Claude Code agent skill that evidence-first agent skill for auditable statistical analysis, diagnostics, publication figures, tables, and teaching reports from real research data.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add DRZ-hang/StatMate

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

StatMate(统计同学)— Reproducible Statistical Research Studio

Connect domain knowledge with statistical reasoning. Translate the research question and study design into an auditable analysis plan, compute only from real source data, generate publication figures and tables through code, then explain both the scientific result and how to read it.

Treat every deliverable as a rigorous draft for author review. Do not present the workflow as a replacement for accountable statistical or domain review, especially for clinical decisions, regulated studies, or confirmatory analyses.

Non-negotiable rules

  1. Study design before test selection. Never select a method from column names or a desired chart alone. Establish the research question, outcome, exposure/group, unit of analysis, independence structure, timing, covariates, and estimand first.
  2. Real evidence only. Never invent observations, sample sizes, test statistics, p-values, confidence intervals, effect sizes, model diagnostics, or conclusions. Formal analysis requires suitable source data. A visualization-only task may instead use supplied machine-readable estimates when their provenance and limitations are stated. Keep synthetic examples separate and visibly labeled; never mix them with the user's analysis.
  3. Code is the source of results. Run saved code against the named source file. A reported value must trace to a machine-readable result and the script that produced it.
  4. No silent data decisions. Never silently drop, winsorize, transform, impute, reclassify, or exclude. Record the rule, count affected, rationale, and sensitivity consequence.
  5. Effect and uncertainty before significance. Report estimates, effect sizes, and confidence intervals; do not reduce interpretation to a significance star or p-value.
  6. Respect the conclusion boundary. Separate descriptive, associational, predictive, and causal claims. Do not turn an observational association into causation.
  7. Audit before final export. Check data lineage, numbers, labels, n, assumptions, diagnostics, multiplicity, and rendered assets before calling them final.

Communication and scope

Use the language the user uses with the agent unless they request another language. Keep the manuscript and submission materials in their existing language by default; conversation language and manuscript language are separate choices. Translate or adapt materials for a local-language journal only when the user explicitly asks.

Route the request before starting work:

  • Method consultation: manuscript/design may be enough. Build the design map and analysis plan, then stop; do not imply that statistics were run.
  • Analysis or artifact review: inspect supplied plans, code, results, figures, and tables without rewriting live artifacts unless asked. If source data are unavailable, separate visible-display critique from claims that would require numerical validation.
  • Results-to-visual delivery: machine-readable estimates may be sufficient when the task is to plot already-computed results. Preserve their provenance and do not imply that the underlying analysis was independently rerun.
  • Full execution and delivery: require suitable source data plus sufficient design metadata, then run the workflow below.

Ask only for missing information that changes the method or interpretation. Infer and label safe details; never infer pairing, randomization, independence, endpoint priority, or the analysis unit.

Workflow

1. Build the research-design map

Read the manuscript, protocol, abstract, methods, analysis notes, data dictionary, and user goals. Use references/study-design-intake.md. Produce a compact map of:

  • research question and hypothesis;
  • design and sampling/assignment mechanism;
  • population, inclusion/exclusion, and analysis set;
  • primary/secondary outcomes, predictors/exposures, covariates, and time points;
  • one independent observation, repeated/paired/clustered/nested structure;
  • target estimand or quantity to report;
  • confirmatory versus exploratory status and the strongest defensible claim.

If the paper and data disagree, surface the mismatch and pause only the affected formal analysis when the conflict is material.

2. Audit data and provenance

Locate the exact source files and identify the sheet/table/columns feeding each analysis. Preserve the originals. Run scripts/data_audit.py for supported flat files, using discrete visit columns separately from survival duration/event columns, then perform design-specific checks using references/data-audit-and-provenance.md.

Summarize shape, types, units, coding, group sizes, missingness, duplicates, impossible values, constant/near-constant fields, identifiers, date ranges, and repeated IDs. Confirm the analysis unit and distinguish biological/participant units from technical replicates. Check empty design cells, independent units/events, outcome variation, and whether the planned contrast/model is estimable.

For potentially identifiable biomedical data, avoid reproducing direct identifiers in reports or figures. Flag suspected identifiers and exact dates for user review; do not delete or de-identify source data without instruction.

3. Write the statistical analysis plan before computing

Use references/analysis-plan.md, references/statistical-methods.md, and, when relevant, references/biomedical-methods.md. Create a decision table with one row per question/outcome:

question -> estimand -> variables -> analysis unit -> method -> assumptions -> diagnostics -> effect/CI -> multiplicity -> missing-data rule -> sensitivity analysis -> figure/table

Explain the recommendation in domain language and plain language. List unresolved decisions and reasonable alternatives. Do not choose the method that yields the preferred result.

Use an analysis approval gate before formal computation when the design is ambiguous, the analysis is confirmatory/high-stakes, or choices materially affect the conclusion. If the user has already supplied a complete approved plan, record it and proceed.

4. Implement and run the analysis

Write clean scripts that:

  1. load the unchanged source data;
  2. apply explicit inclusion/exclusion and preprocessing rules;
  3. create an analysis-ready dataset or transformation log;
  4. compute descriptive statistics, inferential models, effect sizes, intervals, and corrections;
  5. write machine-readable results (.csv/.json) before formatting them;
  6. generate figures/tables from those stored results or the same deterministic pipeline.

Set seeds for stochastic procedures. Capture library versions. Never copy a number manually from terminal output into a final artifact when it can be read from a result file.

5. Diagnose and challenge the analysis

Check assumptions appropriate to the model rather than running a ritual normality test. Inspect residuals, fit, variance, influential observations, convergence, proportional hazards, calibration, or other design-specific diagnostics. Check multiple testing and subgroup multiplicity.

Run pre-specified or clearly labeled sensitivity analyses when plausible decisions could change the result. Report disagreements rather than selecting the favorable analysis.

6. Build review figures and tables

Choose the chart from the claim and data structure using references/chart-selection.md. Apply the target venue style using references/journal-specs.md, references/plotting-stacks.md, and scripts/figstyle.py.

For each figure, generate exactly two review assets by default:

  • a directly viewable raster preview: PNG by default;
  • an editable vector asset: PDF by default.

Use SVG instead of PDF if requested. Generate JPEG, TIFF, EPS, or other formats only when the user or venue needs them. Do not use a generative image model for statistical data marks.

Build a content-correct table preview first. Defer final table format until the user approves the analysis. At final export, default to a Word three-line table; add .xlsx, .csv, or LaTeX .tex only when requested. Use scripts/table_export.py and scripts/docx_tables.py.

7. Verify numbers and rendered assets

Open every rendered preview and inspect it. Cross-check selected displayed values against the machine-readable results and source-derived counts. Verify axes, units, legends, color scale, labels, n, error definitions, comparison brackets, corrections, panel ordering, font size, and accessibility. Ensure bar baselines and transformed axes are not misleading.

Classify each item as draft, needs-author-decision, approved, or final. Do not call an item final while a material assumption or discrepancy remains unresolved.

8. Interpret and teach

Use references/interpretation-and-teaching.md. For every figure and table, provide two distinct sections:

  • Scientific interpretation: result, direction, magnitude, uncertainty, robustness, relevance, limitations, and what the design does or does not support.
  • How to read it: axes/rows/columns, marks, distributions, intervals, symbols, a recommended reading order, common misreadings, and a plain-language takeaway.

Do not claim that non-significance proves equivalence or no effect. Do not equate statistical significance with scientific or clinical importance.

9. Approve and export the final package

First deliver a lightweight review package: design map, data audit, analysis plan, result previews, draft figures/tables, interpretations, and decisions still needed. After strict user review, export only the requested final formats.

Generate every requested final asset first. Then use scripts/analysis_manifest.py to hash source inputs, scripts, machine-readable results, and final assets, and run its verification mode before handoff. Generate the report with scripts/report_docx.py or the Markdown fallback in assets/report_template.md.

Recommended project layout:

analysis/
  00_intake/       design map, data dictionary, decisions
  01_audit/        audit reports and provenance
  02_plan/         statistical analysis plan
  03_code/         executable analysis scripts
  04_results/      machine-readable estimates and diagnostics
  05_review/       draft previews and review notes
  06_final/        approved figures, tables, captions, report
  manifest.json    hashes, versions, parameters, status

Reference routing

  • Read references/study-design-intake.md when extracting the scientific question and design.
  • Read references/data-audit-and-provenance.md before touching raw data or resolving data issues.
  • Read references/analysis-plan.md before recommending or executing a statistical method.
  • Read references/statistical-methods.md for general method selection and reporting.
  • Read references/biomedical-methods.md for longitudinal, survival, diagnostic, prediction, agreement, count, clustered, or other common biomedical analyses.
  • Read references/chart-selection.md when choosing a visual form.
  • Read references/interpretation-and-teaching.md when writing the scientific explanation and user tutorial.
  • Read references/journal-specs.md and references/plotting-stacks.md only when producing assets.

Bundled tools

  • scripts/data_audit.py — create deterministic JSON and Markdown audits for flat research data, with separate visit and survival roles.
  • scripts/analysis_manifest.py — hash inputs/outputs, record environment metadata, and verify a saved manifest against current files.
  • scripts/figstyle.py — apply venue presets and export a preview/vector pair.
  • scripts/table_export.py — export an approved table only to selected formats.
  • scripts/docx_tables.py — build Word three-line tables.
  • scripts/report_docx.py — assemble the hand-off report with figures, tables, interpretation, and reading guidance.
  • assets/presets.json — editable venue style presets; verify current journal requirements.
  • assets/report_template.md — Markdown report fallback.

관련 스킬