pg-nonparametriclisted
Install: claude install-skill Exekiel179/pingouin-psych-stats
# PG Nonparametric
Use when the outcome is ordinal, or continuous but non-normal with small n, so a rank-based test is safer than a t test or ANOVA.
## Load
Read:
- `../../references/supervision-gates.md`
- `../../references/pingouin-api-quickref.md`
- `../../references/apa-output-template.md` if writing results.
## Decision Rules
- Two independent groups -> `pg.mwu(x, y)` (Mann-Whitney U).
- Same participants measured twice / paired -> `pg.wilcoxon(x, y)` (signed-rank).
- Three or more independent groups, one factor -> `pg.kruskal(data, dv, between)`.
- Three or more repeated conditions, continuous/ordinal -> `pg.friedman(data, dv, within, subject)`.
- Three or more repeated conditions, binary outcome -> `pg.cochran(data, dv, within, subject)`.
- Follow a significant omnibus with `pg.pairwise_tests(..., parametric=False, padjust="holm")`.
## Required Inputs
- Outcome column and its scale (ordinal or non-normal continuous).
- Grouping (between) or condition (within) column.
- Subject ID for paired/repeated designs.
- Post hoc correction: default `holm`.
- Alternative hypothesis: default `two-sided` (mwu/wilcoxon only).
## Code Patterns
Mann-Whitney U (independent):
```python
x = df.loc[df["group"].eq("A"), "score"]
y = df.loc[df["group"].eq("B"), "score"]
res = pg.mwu(x, y, alternative="two-sided").round(3)
pg.print_table(res)
```
Wilcoxon signed-rank (paired):
```python
res = pg.wilcoxon(df["pre"], df["post"], alternative="two-sided").round(3)
pg.print_table(res