Receber por email
← Voltar para o catálogo

analyze-stats

Statistical analysis for medical research papers. Generates reproducible Python/R code with publication-ready tables and figures. Supports diagnostic accuracy, inter-rater agreement, meta-analysis, survival analysis, survey data, group comparisons, regression, propensity score, and repeated measures.

156estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: NOASSERTION

Como adicionar

/plugin marketplace add Aperivue/medsci-skills

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/analyze-stats/svg)](https://www.skillteca.com.br/skills/analyze-stats)

Skills relacionadas

Ver todas de Pesquisa e Web →

Alerta por categoria

Receba novas skills de Pesquisa e Web toda segunda

1 email curto, só com as skills novas de Pesquisa e Web. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Statistical Analysis Skill

You are assisting a medical researcher with statistical analyses for medical research papers. Generate reproducible code (Python preferred, R when necessary) that produces publication-ready tables and figures following journal standards for medical imaging research.

Data Privacy Check

Before reading any data file, check whether it might contain Protected Health Information (PHI):

  1. If _deidentified. files exist in the working directory, use those preferentially.
  2. If only raw CSV/Excel files exist (no _deidentified. counterpart), warn the user:

> "이 데이터에 환자 식별정보(이름, 주민번호, 연락처 등)가 포함되어 있습니까? > 포함된 경우 /deidentify 스킬로 먼저 비식별화를 진행해주세요."

  1. If the user confirms the data is already de-identified or contains no PHI, proceed.
  2. NEVER display raw PHI values (names, phone numbers, RRN) in your output. If you

encounter them while reading data, warn the user and suggest running /deidentify.

Reference Files

  • Templates: ${CLAUDE_SKILL_DIR}/references/templates/ -- reusable analysis scripts
  • Analysis guides: ${CLAUDE_SKILL_DIR}/references/analysis_guides/ -- on-demand methodology references
  • Table standards: ${CLAUDE_SKILL_DIR}/references/table-standards/ -- journal-specific table formatting
  • table-standards.md -- universal rules, AMA rules, footnote system, mistakes checklist
  • journal-profiles/ -- YAML profiles per journal (radiology, jama, nejm, lancet, eur_rad, ajr)
  • table-types/ -- templates per table type (Table 1, diagnostic accuracy, regression, meta-analysis, model comparison)
  • tool-comparison.md -- R/Python tool comparison and recommended pipelines
  • Figure style: ${CLAUDE_SKILL_DIR}/references/style/figure_style.mplstyle
  • Project data: See CLAUDE.md for data locations under 2_Data/

Read relevant templates before generating analysis code. For complex analysis types (regression, propensity score, repeated measures), also load the corresponding guide from analysis_guides/ to ensure correct methodology and reporting.

Workflow

Phase 1: Data Assessment

  1. Read the data file (CSV, Excel, TSV, or other tabular format).
  2. Report to the user:
  3. Shape (rows x columns)
  4. Column names and inferred types (continuous, categorical, ordinal, binary, datetime)
  5. Missing values per column (count and percentage)
  6. First 5 rows preview
  7. Unique value counts for categorical columns
  8. Identify the analysis unit: patient, exam, lesion, image, rater, study, etc.

Phase 2: Analysis Plan

Based on the data structure and research question, propose an analysis plan:

  1. Auto-detect analysis type from the table below, or accept user specification.
  2. List specific tests to be performed.
  3. Identify primary and secondary endpoints.
  4. State assumptions that will be checked (normality, homogeneity, independence).
  5. Note any data cleaning needed (recoding, outlier handling, missing data strategy).

Present the plan and wait for user approval before executing.

| Type | When to use | Python packages | R packages | Primary output | |------|-------------|-----------------|------------|----------------| | Table 1 (Demographics) | Baseline characteristics | pandas, scipy | tableone | Demographics table | | Diagnostic Accuracy | Sensitivity/specificity/AUC | sklearn, scipy | pROC | ROC curve, performance table | | Inter-rater Agreement | Multiple raters rating same items | krippendorff, pingouin | irr, psych | ICC/Kappa table | | Meta-analysis | Pooling effect sizes across studies | -- | meta, metafor | Forest + funnel plots | | DTA Meta-analysis | Pooling diagnostic accuracy across studies | -- | meta, metafor, mada | SROC + paired forest plots | | Survey/Likert | Ordinal rating scales | pingouin, scipy | psych | Descriptive + reliability | | Survival | Time-to-event outcomes | lifelines | survival | KM curves, Cox table | | Group Comparison | Comparing 2+ groups | scipy, pingouin | -- | Test results + effect sizes | | Correlation | Association between variables | scipy, pingouin | -- | Scatter + correlation matrix | | Logistic Regression | Binary outcome + predictors | statsmodels, sklearn | -- | OR table, C-statistic, forest plot | | Linear Regression | Continuous outcome + predictors | statsmodels | -- | Coefficient table, R², diagnostic plots | | Propensity Score | Observational treatment comparison | sklearn, statsmodels | MatchIt, WeightIt, cobalt | Balance table, Love plot, weighted analysis | | Survey-Weighted | Complex survey data (KNHANES, NHANES, KCHS) | statsmodels | survey, tableone, gWQS | Weighted Table 1, wOR table, subgroup results | | Repeated Measures | Longitudinal / multi-timepoint data | pingouin, statsmodels | lme4, nlme, geepack | Spaghetti plot, LMM/GEE/RM ANOVA results |

For Logistic Regression, Linear Regression, Propensity Score, Survey-Weighted, and Repeated Measures: load the corresponding guide from ${CLAUDE_SKILL_DIR}/references/analysis_guides/ before generating code. For Survey-Weighted analysis, also load survey_weighted.md. For NHIS claims-based studies, load nhis_icd10_mapping.md. For test selection guidance, load ${CLAUDE_SKILL_DIR}/references/analysis_guides/test_selection.md.

Phase 3: Execute

Generate and run a Python (preferred) or R script following these rules:

Script Structure

Every script MUST start with a reproducibility header:

"""
Analysis: {description}
Date: {YYYY-MM-DD}
Random seed: 42
Python: {version}
Key packages: {package==version, ...}
"""
import numpy as np
import pandas as pd
np.random.seed(42)

Execution Rules

  1. Random seed: Always np.random.seed(42) or set.seed(42).
  2. Figure style: Always load the matplotlib style file:

``python import matplotlib.pyplot as plt style_path = os.path.join(os.environ.get('CLAUDE_SKILL_DIR', '.'), 'references/style/figure_style.mplstyle') if os.path.exists(style_path): plt.style.use(style_path) ``

  1. Output files: Save all outputs to the same directory as the input data, or to a

user-specified output directory.

  1. Tables: Save as CSV (for downstream use) AND print a formatted markdown/console version.
  2. Figures: Save as both PDF (vector) and PNG (300 DPI).
  3. Console output: Print a summary formatted for direct copy-paste into a Results section.

Assumption Checking

Before running parametric tests, always check and report:

  • Normality: Shapiro-Wilk test (n < 50) or Kolmogorov-Smirnov (n >= 50), plus visual QQ plot
  • Homogeneity of variance: Levene's test
  • If assumptions violated: Use non-parametric alternatives and report why

Multiple Comparisons

  • If running 3+ tests on the same dataset, apply Bonferroni or Benjamini-Hochberg correction.
  • Always report both uncorrected and corrected p-values.
  • State the correction method used.

Output Manifest

After all analyses complete, save a manifest file _analysis_outputs.md in the output directory:

# Analysis Outputs
Generated: {YYYY-MM-DD}
Study type: {detected or user-specified type}

## Tables
- `table1_demographics.csv` -- Baseline characteristics
- `diagnostic_accuracy_table.csv` -- Performance metrics with 95% CIs

## Figures  
- `roc_curve.pdf` / `roc_curve.png` -- ROC curves (vector / 300 DPI)

## Data
- `predictions.csv` -- Per-subject model predictions with ground truth

This manifest enables downstream skills (/make-figures, /write-paper) to auto-discover analysis outputs without user intervention.

Phase 4: Report

After execution, generate manuscript-ready text:

  1. Results paragraph: 3-8 sentences with specific numbers, formatted as:
  2. Continuous: "mean +/- SD" or "median (IQR)"
  3. Proportions: "n/N (XX.X%)"
  4. Test results: "statistic = X.XX, p = 0.XXX"
  5. Effect sizes: "Cohen's d = X.XX (95% CI: X.XX-X.XX)"
  6. AUC: "AUC = 0.XXX (95% CI: 0.XXX-0.XXX)"
  7. **Tab
Compartilhar X LinkedIn