Agent skill · Data & Analytics

bio-clinical-biostatistics-categorical-tests

Tests associations between categorical variables in clinical data using chi-square, Fisher's exact, Boschloo, Cochran-Mantel-Haenszel, and modern McNemar variants with calibrated confidence intervals (Wilson, Newcombe, Miettinen-Nurminen). Use when analyzing categorical outcomes, paired binary endpoints, or testing treatment-outcome independence in confirmatory or exploratory clinical trials.

BioTender-maxgithub.com/BioTender-maxGitHub ↗
claude-codeships scriptsNOASSERTION
Install
npx skills add BioTender-max/awesome-bio-agent-skills --skill categorical-tests --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 4
SKILL.md size: 25 KB
Bundled scripts: yes
Path: skills/bioskills/categorical-tests/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 135
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Tests associations between categorical variables in clinical data using chi-square, Fisher's exact, Boschloo, Cochran-Mantel-Haenzel, and modern McNemar variants with calibrated confidence intervals (Wilson, Newcombe, Miettinen-Nurminen). Use when analyzing categorical outcomes, paired binary endpoints, or testing treatment-outcome independence in confirmatory or exploratory clinical trials.

How it works

The skill prescribes a taxonomy of tests with design and operating characteristics, and includes executable code patterns (Python) for:

  • Pearson chi-square (no continuity correction) with contingency table construction and an explicit check on expected counts; switch to Boschloo or permutation chi-square for sparse data.
  • Fisher's exact test for 2x2 with an alternative Boschloo example, noting Boschloo computes an unconditional p-value and conditions on one margin.
  • CMH (Mantel-Haenszel) analysis across strata, producing pooled odds ratio, CMH test, and Breslow-Day test; includes per-method failure modes and guidance on interpretation.
  • McNemar tests for paired binary data: asymptotic (no continuity correction) when b+c >= 25, mid-p when b+c < 25, and exact conditional when mandated; includes examples of matrix inputs and function calls.
  • Effect sizes: Phi for 2x2 and Cramer's V for RxC, with guidance on bias-corrected variants and usage with pingouin.

Code samples reference functions and objects like chi2_contingency, from scipy.stats import fisher_exact, boschloo_exact, pd.crosstab, StratifiedTable, mcnemar, and pingouin; the workflow emphasizes checking expected counts, choosing tests by scenario, and reporting stratum-specific results where appropriate.

When to use it

Use in scenarios described in the decision tree for experimental design: independent 2x2 with adequate counts; independent 2x2 with small counts; independent RxC; stratified designs; paired binary data; matched-pair non-inferiority; and when selecting effect-size measures for categorical data. Also when regulatory considerations or SAPs prefer certain tests (e.g., Boschloo over Fisher) and when interpreting potential Simpson's paradox or heterogeneity across strata.

What it can touch

The skill uses Python and scipy-based tools as primary interfaces. It references scipy.stats.chi2_contingency, scipy.stats.fisher_exact, boschloo_exact, statsmodels.stats.contingency_tables.StratifiedTable, mcnemar, and pingouin for effect sizes. It assumes access to data arranged in contingency tables or data frames suitable for pd.crosstab.

Caveats

Compatibility notes specify SciPy 1.12+ (Boschloo and Barnard added in 1.7), StatsModels 0.14+, pingouin 0.5+, exact2x2 (R) 1.6+, pandas 2.1+, numpy 1.26+. It warns that exact conditional tests can be conservative, and that CMH requires attention to stratification to avoid inflated Type-I error; it advises supplementing with stratum-specific ORs or logistic regression with interaction. It notes potential limitations in per-method power under sparse data, and emphasizes verifying versions and API parameters when code throws ImportError, AttributeError, or TypeError.

From the SKILL.md

## Version Compatibility Reference examples tested with: scipy 1.12+ (Boschloo and Barnard added in 1.7), statsmodels 0.14+, pingouin 0.5+, exact2x2 (R) 1.6+, pandas 2.1+, numpy 1.26+. Before using code patterns, verify installed versions match. If versions differ: - Python: `pip show <package>` then `help(module.function)` to check signatures - R packages cited for reference (exact2x2, Exact, ratesci): use `packageVersion()` then `?function_name` to verify parameters If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying. # Categorical Association Tests for Clinical Data **"Test association between categorical variables"** -> Determine whether treatment and a categorical clinical outcome are statistically independent (or that marginal proportions agree, for paired data) using a test calibrated to the design, the sample size, and the regulatory question. ## Algorithmic Taxonomy | Test | Design | Asymptotic / exact | Conditioning | Strength | Fails when | |------|--------|--------------------|--------------|----------|------------| | Pearson chi-square (no continuity correction) |

What's inside
Steps it walks through
  1. Version Compatibility
  2. Algorithmic Taxonomy
  3. Decision Tree by Experimental Scenario
  4. Chi-Square Test (Pearson, no continuity correction)
  5. Fisher's Exact -- and why Boschloo is usually better
  6. Cochran-Mantel-Haenszel (Stratified)
  7. Per-method failure modes
  8. McNemar's Test for Paired Binary Data
  9. Effect Sizes for Categorical Data
  10. Reconciliation: When Methods Disagree
  11. Confidence Intervals for Proportions and Differences
  12. Post-Hoc Pairwise Comparisons
  13. Quantitative Thresholds
  14. Common Errors
Ships with 3 files
  • examples/categorical_test_results.csv
  • examples/categorical_tests_clinical.py
  • usage-guide.md
More from awesome-bio-agent-skills
All skills →
About this skill
What does the bio-clinical-biostatistics-categorical-tests skill do?

Tests associations between categorical variables in clinical data using chi-square, Fisher's exact, Boschloo, Cochran-Mantel-Haenszel, and modern McNemar variants with calibrated confidence intervals (Wilson, Newcombe, Miettinen-Nurminen). Use when analyzing categorical outcomes, paired binary endpoints, or testing treatment-outcome independence in confirmatory or exploratory clinical trials.

How do I install it?

Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill categorical-tests --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From BioTender-max/awesome-bio-agent-skills, a repository with 135 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going