Ordinal Outcome — Distribution Diagnostics & Hypothesis Testing
Table of Contents
Open-source skill.
Scope Boundary
Use this skill when:
- The outcome has a meaningful order and the first need is a nonparametric baseline plus ordinal distribution reporting.
- The goal is to establish an ordered-response checkpoint before ordinal regression or richer modeling.
Do not use this skill when:
- The classes are unordered or collapse naturally to a binary endpoint.
- The design is paired / repeated, survival, or latent-variable rather than cross-sectional ordinal data.
Workflow
Read each step file in workflow/ before executing that step.
| Step |
Responsibility |
Executor |
Document |
Input |
Output |
| Collect |
Collect Inputs |
Main Agent |
workflow/step01-collect-inputs.md |
User input |
Structured input summary |
| Diagnose |
Check Distribution |
Main Agent |
workflow/step02-check-distribution.md |
Prior step output |
PART 1 code block |
| Test |
Run Primary Test |
Main Agent |
workflow/step03-run-primary-test.md |
Prior step output |
PART 2-3 code blocks |
Decision Tree
1. CHECK DISTRIBUTION
├── Balanced levels (no cell < 5) → standard nonparametric tests
└── Sparse levels (any cell < 5) → warn, consider collapsing levels
2. GROUP COMPARISON
├── 2 groups → Mann-Whitney U + rank-biserial r
└── 3+ groups → Kruskal-Wallis + pairwise Dunn's + Cliff's delta
3. TREND TEST (if predictor is ordered)
└── Jonckheere-Terpstra trend test
Required Inputs
| Role |
What to collect |
| Outcome (Y) |
Variable name, ordered levels (confirm ordering with user) |
| Group variable |
What defines groups, how many levels |
| Predictors |
For recommendation block (not executed) |
| Covariates |
For recommendation block (not executed) |
Code Structure
PART 0: Setup & Data Loading
PART 1: Distribution Diagnostics → plot_01_ordinal_distribution.png
PART 2: Primary Hypothesis Test → plot_02_stacked_bar_[var].png
PART 3: Recommendation Block → text listing additional analyses available
Reporting Standards
- p-values: "< .001" not "0.000"; exact to 3 decimals otherwise
- Effect sizes: rank-biserial r (Mann-Whitney), Cliff's delta (2 groups), epsilon-squared (Kruskal-Wallis)
- Always report medians and IQRs for ordinal data, not means/SDs
- Mann-Whitney U: U = X, p = .XXX, rank-biserial r = .XXX
- Kruskal-Wallis: H(df) = X.XX, p = .XXX
- Proportions per level: report as percentages with 1 decimal
- Non-significance: "not statistically significant at α = .05" — never "no effect"
Hypothesis Tests
| Scenario |
Test |
Effect Size |
| 2 independent groups |
Mann-Whitney U |
Rank-biserial r |
| 3+ independent groups |
Kruskal-Wallis + Dunn's |
Cliff's delta (pairwise) |
| Ordered groups (trend) |
Jonckheere-Terpstra |
— |
Paired/repeated designs → vera-data-repeated-reviewing.
Example Dataset
R: vcd::Arthritis — Outcome = Improvement (None/Some/Marked), Predictors: Treatment, Sex, Age.
Python: reconstruct via statsmodels.datasets or manual construction from R dataset.
Method Status
| Status |
Methods |
| Implemented in this skill |
Ordinal frequency diagnostics, Mann-Whitney / Kruskal-Wallis testing, effect sizes for ordered outcomes, Jonckheere-Terpstra trend testing |
Implemented downstream in vera-data-ordinal-generating |
Proportional-odds, Brant testing, adjacent-category / continuation-ratio / stereotype models, ordinal-aware trees |
| Out of scope in this open-source baseline |
Unordered multi-class models, repeated ordinal workflows, and ordinal families not named above |
Minimal Smoke Test
- Smoke-test prompt: "Run
vera-data-ordinal-reviewing on the Arthritis example, treating Improvement as the ordinal outcome and Treatment as the primary grouping variable. Produce the standard baseline artifacts."
Cross-Skill Interface
Output:
├── code_r → .R script
├── code_python → .py script
├── figures/ → 2 PNGs (ordinal distribution + stacked bar)
└── recommendations → text block (additional analyses available)
Note: proportional-odds logistic regression and Brant/parallel-regression test for PO assumption are delivered by vera-data-ordinal-generating.
Next step: Invoke vera-data-ordinal-generating from this skillset to run the full pipeline (additional tests, subgroup analysis, modeling, manuscript generation). See ../../CROSS-SKILL-INTERFACE.md for the shared handoff contract.
1---2name: vera-data-ordinal-reviewing3description: Runs distribution diagnostics and primary hypothesis tests for ordinal outcome variables. Produces frequency tables, cumulative proportions, ordinal bar chart, and one fully interpreted nonparametric group comparison (Mann-Whitney U for 2 groups or Kruskal-Wallis for 3+ groups) with effect sizes (rank- biserial r or Cliff's delta) and Jonckheere-Terpstra trend test. Ends with a recommendation block listing additional analyses available. Outputs .R and .py scripts with 2 publication-quality plots. Triggered when user has an ordinal outcome and says "ordinal outcome," "Likert scale," "ordered categories," "rating scale," "severity levels," "none/mild/moderate/ severe," "low/medium/high," "improvement levels," "ranked outcome," "ordered factor," or names an ordinal variable like satisfaction, severity, agreement, stage, grade, rating.4---56# Ordinal Outcome — Distribution Diagnostics & Hypothesis Testing78## Table of Contents910- [Scope Boundary](#scope-boundary)11- [Workflow](#workflow)12- [Decision Tree](#decision-tree)13- [Required Inputs](#required-inputs)14- [Code Structure](#code-structure)15- [Reporting Standards](#reporting-standards)16- [Hypothesis Tests](#hypothesis-tests)17- [Example Dataset](#example-dataset)18- [Method Status](#method-status)19- [Minimal Smoke Test](#minimal-smoke-test)20- [Cross-Skill Interface](#cross-skill-interface)212223Open-source skill.2425## Scope Boundary2627Use this skill when:28- The outcome has a meaningful order and the first need is a nonparametric baseline plus ordinal distribution reporting.29- The goal is to establish an ordered-response checkpoint before ordinal regression or richer modeling.3031Do not use this skill when:32- The classes are unordered or collapse naturally to a binary endpoint.33- The design is paired / repeated, survival, or latent-variable rather than cross-sectional ordinal data.3435## Workflow3637Read each step file in `workflow/` before executing that step.3839| Step | Responsibility | Executor | Document | Input | Output |40|---|---|---|---|---|---|41| Collect | Collect Inputs | Main Agent | `workflow/step01-collect-inputs.md` | User input | Structured input summary |42| Diagnose | Check Distribution | Main Agent | `workflow/step02-check-distribution.md` | Prior step output | PART 1 code block |43| Test | Run Primary Test | Main Agent | `workflow/step03-run-primary-test.md` | Prior step output | PART 2-3 code blocks |4445## Decision Tree4647```481. CHECK DISTRIBUTION49 ├── Balanced levels (no cell < 5) → standard nonparametric tests50 └── Sparse levels (any cell < 5) → warn, consider collapsing levels51522. GROUP COMPARISON53 ├── 2 groups → Mann-Whitney U + rank-biserial r54 └── 3+ groups → Kruskal-Wallis + pairwise Dunn's + Cliff's delta55563. TREND TEST (if predictor is ordered)57 └── Jonckheere-Terpstra trend test58```5960## Required Inputs6162| Role | What to collect |63|---|---|64| **Outcome (Y)** | Variable name, ordered levels (confirm ordering with user) |65| **Group variable** | What defines groups, how many levels |66| **Predictors** | For recommendation block (not executed) |67| **Covariates** | For recommendation block (not executed) |6869## Code Structure7071```72PART 0: Setup & Data Loading73PART 1: Distribution Diagnostics → plot_01_ordinal_distribution.png74PART 2: Primary Hypothesis Test → plot_02_stacked_bar_[var].png75PART 3: Recommendation Block → text listing additional analyses available76```7778## Reporting Standards79801. p-values: "< .001" not "0.000"; exact to 3 decimals otherwise812. Effect sizes: rank-biserial r (Mann-Whitney), Cliff's delta (2 groups), epsilon-squared (Kruskal-Wallis)823. Always report medians and IQRs for ordinal data, not means/SDs834. Mann-Whitney U: U = X, p = .XXX, rank-biserial r = .XXX845. Kruskal-Wallis: H(df) = X.XX, p = .XXX856. Proportions per level: report as percentages with 1 decimal867. Non-significance: "not statistically significant at α = .05" — never "no effect"8788## Hypothesis Tests8990| Scenario | Test | Effect Size |91|---|---|---|92| 2 independent groups | Mann-Whitney U | Rank-biserial r |93| 3+ independent groups | Kruskal-Wallis + Dunn's | Cliff's delta (pairwise) |94| Ordered groups (trend) | Jonckheere-Terpstra | — |9596Paired/repeated designs → `vera-data-repeated-reviewing`.9798## Example Dataset99100R: `vcd::Arthritis` — Outcome = Improvement (None/Some/Marked), Predictors: Treatment, Sex, Age.101Python: reconstruct via `statsmodels.datasets` or manual construction from R dataset.102103## Method Status104105| Status | Methods |106|---|---|107| Implemented in this skill | Ordinal frequency diagnostics, Mann-Whitney / Kruskal-Wallis testing, effect sizes for ordered outcomes, Jonckheere-Terpstra trend testing |108| Implemented downstream in `vera-data-ordinal-generating` | Proportional-odds, Brant testing, adjacent-category / continuation-ratio / stereotype models, ordinal-aware trees |109| Out of scope in this open-source baseline | Unordered multi-class models, repeated ordinal workflows, and ordinal families not named above |110111## Minimal Smoke Test112113- Smoke-test prompt: "Run `vera-data-ordinal-reviewing` on the `Arthritis` example, treating `Improvement` as the ordinal outcome and `Treatment` as the primary grouping variable. Produce the standard baseline artifacts."114115## Cross-Skill Interface116117```118Output:119├── code_r → .R script120├── code_python → .py script121├── figures/ → 2 PNGs (ordinal distribution + stacked bar)122└── recommendations → text block (additional analyses available)123```124125Note: proportional-odds logistic regression and Brant/parallel-regression test for PO assumption are delivered by vera-data-ordinal-generating.126127Next step: Invoke `vera-data-ordinal-generating` from this skillset to run the full pipeline (additional tests, subgroup analysis, modeling, manuscript generation). See `../../CROSS-SKILL-INTERFACE.md` for the shared handoff contract.