← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-data-visualization-statistical-annotation / references / usage-guide.md

Statistical Annotation - Usage Guide

Overview

Statistical annotation overlays pairwise p-value brackets and significance asterisks onto distribution plots. The visual is the same regardless of test; the underlying statistics are not. Choosing the appropriate test (parametric vs non-parametric, paired vs unpaired, nested vs independent) and adjusting for multiple comparisons are mandatory. ggpubr (R) and statannotations (Python) are the modern interfaces.

Prerequisites

install.packages(c('ggpubr', 'ggsignif', 'rstatix'))
pip install statannotations seaborn scipy

Quick Start

Tell your AI agent what you want to do: - "Add Wilcoxon p-values between control and treatment to my boxplot" - "Pairwise tests for 4 groups with Holm adjustment" - "Switch from t-test to Mann-Whitney because the data are non-normal" - "Show asterisks instead of numeric p" - "Use paired test because before-after measurements in same subjects"

Example Prompts

Two-group comparison

"Wilcoxon p-value bracket between Control and Treatment on the boxplot. Show numeric p, not asterisks."

Multi-group with adjustment

"Pairwise Wilcoxon tests across 4 conditions with Holm adjustment. Display as a bracket pyramid above the boxes with asterisks for significance."

Paired test

"Pre/post measurements paired by subject_id. Use paired Wilcoxon. Indicate paired-test in the figure legend."

Nested data

"I have ~200 cells per patient × 8 patients. Don't pseudo-replicate; aggregate to per-patient mean or use a linear mixed model."

Overall + post-hoc

"Kruskal-Wallis overall test in the top corner; per-pair Dunn post-hoc as brackets between groups."

What the Agent Will Do

  1. Identify N per group and overall data structure (paired? nested? repeated?).
  2. Test normality (Shapiro-Wilk) if borderline N for normal-based choice.
  3. Pick the appropriate test: t for normal+independent; Wilcoxon for non-normal or small N; paired versions when matched; ANOVA / Kruskal for 3+ groups.
  4. Compute pairwise comparisons; adjust with Holm (default) or BH.
  5. For nested data, switch to LMM or aggregate before pairwise testing.
  6. Render p-values as brackets with consistent height; show numeric p OR asterisks per request.
  7. Report effect size in caption/supplementary (Cohen's d, Cliff's delta, or median difference + CI).

Tips