APA 7th Edition statistical formatting for SSCI/SCI figures (Sections 6.36, 6.40--6.45, 7.28).
All function signatures match scripts/ssci_style.py.
| Symbol | Meaning | Symbol | Meaning | |
|---|---|---|---|---|
*** |
p < .001 | * |
p < .05 | |
** |
p < .01 | n.s. |
Not significant |
Optional: dagger for p < .10 (marginal significance; confirm journal policy first).
Every asterisk system requires a probability note: *p < .05. **p < .01. ***p < .001.
Consistency rule: same star count = same alpha level across all figures in the manuscript.
The non-significant marker is 'n.s.' (with periods, per APA convention for abbreviated phrases). Both p_to_stars() and add_significance_bracket() emit 'n.s.' consistently after D10 bug 3 fix.
from ssci_style import p_to_stars, add_significance_bracket
p_to_stars(0.003) # '**'
p_to_stars(0.12) # 'n.s.'
add_significance_bracket(ax, x1=0, x2=1, y=4.5, p_value=0.003)
# Optional: height=0.02, text_offset=0.01, lw=1.0, color=NEUTRAL['error_bar']| Situation | Format | Example |
|---|---|---|
| Typical | p = .XXX | p = .032 |
| Very small | p < .001 | p < .001 |
No leading zero (p cannot exceed 1). Report 2--3 decimal places. Never write p = .000.
from ssci_style import format_p_value
format_p_value(0.032) # '*p* = .032'
format_p_value(0.0004) # '*p* < .001'For multi-statistic clusters placed inside the axes area (the Chetty-style inline block widely used in top SSCI journals), the Skill provides add_inline_stats() in scripts/ssci_style.py. It accepts a dict (or list of tuples) of stat name -> value and auto-formats each entry per APA conventions:
from ssci_style import add_inline_stats
# Dict form (key -> value)
add_inline_stats(ax, {
'slope': 0.35,
'r': 0.71,
'p': 0.0002,
'n': 1248,
})
# Renders four lines at top-left:
# slope = 0.35
# *r* = .71
# *p* < .001
# *n* = 1,248
# Mixed form with pre-formatted CI string
add_inline_stats(ax, {
'HR': 0.42,
'CI': '[0.31, 0.57]',
'p': '< .001',
}, position='top_right', bbox=True)
# bbox=True draws white semi-transparent background for readability over dataKey parameters (full docstring in scripts/ssci_style.py):
| Param | Type / Default | Effect |
|---|---|---|
items |
dict OR list of (key, val) or (key, val, ci) tuples | Auto-formatted per stat |
position |
'top_left' (default), 'top_right', 'bottom_left', 'bottom_right', or (x, y) axes-fraction tuple |
Anchor placement |
fontsize |
None (reads _ACTIVE_PRESET['inline_stats_size'], default 8) |
Override per call |
sep |
'\\n' (default; one stat per line) |
Use ', ' for single-line layout |
bbox |
False (default) |
Draw white semi-transparent background |
italic_latin |
True (default) |
Auto-italicize Latin stat keys via $\\mathit{...}$ |
Auto-formatting rules (matched to APA 7 / journal-house conventions):
| Key class | Examples | Format |
|---|---|---|
| Correlation | r |
2 decimals, no leading zero: *r* = .42 |
| Probability | p |
3 decimals, no leading zero, < .001 for very small: *p* = .032 |
| Sample size | n, N |
Comma-separated integer: *n* = 1,248 |
| Effect size | d, g, b, B |
2 decimals, with leading zero: *d* = 0.45 |
| Ratio | AUC, HR, OR, RR |
2 decimals, with leading zero: *HR* = 0.42 |
| String | any | Rendered verbatim (use for pre-formatted CI strings like '[0.18, 0.52]') |
Italic / upright rules (from APA 7 Table 6.5):
- Latin keys auto-italicize:
r, p, n, N, t, F, M, SD, d, b, B, z, OR, HR, SE, AUC, R, Mdn, g, U, MS, SS, k, f, df, RR - Greek keys stay upright:
alpha, beta, chi, eta, omega, mu, sigma, tau, phi, lambda, pi, rho - Acronyms (CFI, RMSEA, SRMR, SHAP, BF_10) are upright by APA convention
Position aliases (matplotlib-style upper_* / lower_*) are accepted alongside the top_* / bottom_* names: upper_left is equivalent to top_left, etc.
For more context on when inline statistics improve "publication feel" -- and when the figure note is the right place instead -- see apa-figure-standards.md §13 (In-Figure Statistical Annotations).
| Metric | Context | Metric | Context |
|---|---|---|---|
| d | Group mean difference | eta^2 / eta_p^2 | ANOVA effect |
| g | Small-sample corrected d | omega^2 | Less biased ANOVA |
| r | Bivariate association | f^2 | Regression (Cohen) |
| R^2 | Variance explained | OR / RR | Odds / risk ratio |
- Italic for Latin-letter metrics: d, g, r, R^2, f^2
- Not italic for Greek-letter metrics: eta^2, eta_p^2, omega^2
- 2 decimal places. Pair with 95% CI when available.
- Leading zero: omit when metric cannot exceed 1 (r = .45); include otherwise (d = 1.23).
| Metric | Small | Medium | Large |
|---|---|---|---|
| d | 0.20 | 0.50 | 0.80 |
| r | .10 | .30 | .50 |
| eta^2 | .01 | .06 | .14 |
| f^2 | .02 | .15 | .35 |
Interpret in domain context; these are guidelines, not rigid cutoffs.
from ssci_style import annotate_effect_size
annotate_effect_size(ax, d=0.45, ci=(0.12, 0.78)) # "d = 0.45, 95% CI [0.12, 0.78]"
annotate_effect_size(ax, d=0.38, label="g") # "g = 0.38"
annotate_effect_size(ax, d=0.52, label="r", x=0.05, y=0.95) # position at top-left
# Parameters: label ('d'|'g'|'r'|...), x/y (axes fraction), fontsize (8)APA format: 95% CI [lower, upper] -- square brackets, comma-separated, explicit confidence level.
Examples: d = 0.45, 95% CI [0.12, 0.78] / OR = 2.31, 95% CI [1.45, 3.67]
The Note must state what error bars represent:
| Type | When to use | Note wording |
|---|---|---|
| SE | Precision of mean estimate | "Error bars represent standard errors." |
| SD | Data variability | "Error bars represent standard deviations." |
| 95% CI | Inferential (APA preferred) | "Error bars represent 95% confidence intervals." |
For repeated-measures designs, apply Morey (2008) within-subject correction and state: "Error bars represent within-subject 95% CIs (Morey, 2008)."
Core Latin algebraic symbols (italic):
b, B (regression), d (Cohen's), df, f, F, g (Hedges'), k, M, Mdn, MS, n, N, OR, p, r, R, R^2, SD, SE, SS, t, U, z
Note: n.s. (the non-significant marker, formerly ns) is not italic -- it is treated as an abbreviation per the D10 bug 3 fix that aligns p_to_stars() and add_significance_bracket() on the same string with periods.
Greek letters (upright): alpha, beta, chi^2, eta^2, eta_p^2, sigma, mu, omega^2, phi, lambda, pi, rho, tau, epsilon, delta
phi (the phi coefficient for 2x2 chi-square contingency) is upright per APA 7 Table 6.5. Do not confuse phi (Greek, upright) with phi written as a Latin variable (italic phi-like glyph -- not standard).
Abbreviations (upright): CI, ANOVA, SEM, CFA, EFA, CFI, RMSEA, SRMR, TLI, NFI, AIC, BIC, SHAP, BF, ROC, AUC (when written as the acronym rather than the metric -- see §4.5)
Numbers, operators (+, -, =, <, >), and label subscripts are also upright.
ax.text(x, y, r'$\mathit{p}$ < .001', fontsize=8) # italic Latin
ax.text(x, y, r'$\eta^2$ = .06', fontsize=8) # upright Greek
ax.text(x, y, r'$\mathit{R}^2$ = .34', fontsize=8) # italic R, superscript 2
ax.text(x, y, r'$\phi$ = .28', fontsize=8) # upright Greek phi
ax.text(x, y, r'$\mathit{I}^2$ = 28%', fontsize=8) # italic I, superscript 2 (heterogeneity)
ax.text(x, y, r'$\tau^2$ = .04', fontsize=8) # upright Greek tau, superscript 2annotate_effect_size() handles italic automatically via $\mathit{label}$. add_inline_stats() auto-italicizes Latin keys per APA 7 §6.42 (see §1.3).
After apply_style(), mathtext.fontset='custom' ensures that bare expressions $r$ / $p$ / $N$ render in the active body font's italic (Arial-Italic by default), not the matplotlib default DejaVuSans-Oblique. This is the D10 bug 1 fix.
The 25+ chart types in this Skill cover survival analysis, meta-analysis, ROC analysis, mediation, Bayesian comparison, and SHAP / interpretable-ML figures. Each of these brings statistical symbols (*AUC*, *HR*, *I*^2, *tau*^2, BF_10, SHAP) that are not in APA 7's basic worked examples (which are dominated by M, SD, t, F, p). The italic / upright classification of these symbols is settled by APA 7's general rule (Latin italic, Greek upright) plus accepted convention in each chart type's home discipline. §4.5 codifies the resolution for each new symbol.
| Symbol | Meaning | Source chart type | Italic? | Format example |
|---|---|---|---|---|
| AUC | Area Under ROC Curve | ROC + Calibration plot | italic (Latin) | *AUC* = 0.83, 95% CI [0.78, 0.88] |
| HR | Hazard Ratio | Kaplan-Meier, Cox regression | italic (Latin) | *HR* = 0.42, 95% CI [0.31, 0.57] |
| RR | Relative Risk / Risk Ratio | Meta-analysis, epidemiology | italic (Latin) | *RR* = 1.85, 95% CI [1.23, 2.78] |
| I^2 | Heterogeneity statistic | Forest plot (meta-analysis) | italic Latin I + upright superscript 2 | *I*^2 = 28% |
| Q | Cochran's Q (heterogeneity) | Forest plot (meta-analysis) | italic (Latin) | *Q*(9) = 12.45, *p* = .19 |
| phi | Phi coefficient (2x2 chi^2) | Mosaic, Marimekko, association | upright (Greek) | phi = .28 |
| tau | Kendall's tau OR meta-analysis Tau | rank corr, forest plot | upright (Greek) when used as Kendall's tau coefficient; check journal conventions for meta-analysis -- some treat tau as italic Latin equivalent in equations | tau = .31 (Kendall) or *tau*^2 = .04 (meta) |
| tau^2 | Between-study variance (meta) | Forest plot | upright Greek tau + upright superscript 2 | tau^2 = 0.04 |
| BF_10 | Bayes Factor in favor of H1 | Bayesian comparison | upright (acronym) | BF_10 = 12.4 |
| SHAP | Shapley Additive Explanation | SHAP summary plot | upright (acronym) | `Mean |
| b / B | Unstandardized regression | Mediation, path, regression | italic (Latin) | *b* = 0.35, *SE* = 0.04 |
Notes on the ambiguous cases:
-
tau has two distinct uses: (1) Kendall's tau -- a rank correlation coefficient, conventionally written as the upright Greek
tauper APA 7 Greek-upright rule; (2) meta-analysis tau / tau^2 -- the between-study variance in random-effects models. Some methodological journals treat this as an italic Latin equivalent (since it functions as a statistic estimated from data, not a population parameter); APA 7 itself does not address the case. Default to upright Greek unless the target journal's style guide explicitly directs otherwise; the leading meta-analysis statistical packages (metaforR,metaR) render it upright in their output. -
I^2 has two interpretations in literature: (1) the heterogeneity statistic where I is treated as a Latin-letter statistic so the symbol is italic; (2) some older texts treat I as an acronym for "inconsistency", in which case I is upright. APA 7 favors interpretation (1); this Skill renders
*I*^2(italic I, upright superscript 2). -
AUC is upright when written as the acronym ("AUC was 0.83") but italic when written as a statistical symbol in an equation ("AUC = 0.83"). The format guidance in §4.5 favors the italic symbol form because that is how it appears in inline figure annotations.
-
HR / RR / OR follow the same dual-use rule: italic when used as a statistical symbol with a value, upright when used as an acronym ("the hazard ratio was 0.42" -- upright HR -- vs. "HR = 0.42" -- italic).
The add_inline_stats() helper handles this automatically: when you pass {'HR': 0.42, 'AUC': 0.83, 'p': 0.0002, 'I2': 28} it renders italic Latin keys, upright Greek keys, and follows the per-statistic formatting rules in §1.3.
beta = .45*** (Greek beta, upright, with stars on the path arrow)
b = 1.23, SE = 0.34 (italic Latin letters)
ab = .12, 95% CI [.04, .22] (bootstrap CI for product of paths)
*Note.* Standardized coefficients shown. Model fit: chi^2(24) = 36.45,
p = .049, CFI = .97, RMSEA = .045, 90% CI [.001, .074], SRMR = .038.
Solid lines = significant paths; dashed lines = non-significant paths.
*p < .05. **p < .01. ***p < .001.
Non-significant paths: dashed lines, NEUTRAL["ns_path"] color (see scripts/ssci_style.py).
For the full set of conventions governing mediation diagram rendering (arrow semantics, c' curvature rule, indirect-effect reporting, panel-label cases), see apa-figure-standards.md §11 Mediation Diagram Conventions.
- Prefer exact p-values over asterisks alone; include exact values in Note when feasible.
- Always report effect sizes alongside significance -- p says "exists"; effect size says "matters."
- Multiple comparisons: state correction in Note ("Bonferroni-corrected p values are reported.").
- Bayes factors (optional): BF_10 = 12.4. Not italic (abbreviation). APA does not prescribe format.
- Survival analysis figures: report HR with 95% CI and log-rank p-value in Note. For Kaplan-Meier curves intended for NEJM / Lancet, include the at-risk table below the x-axis (see
chart-types-applied.md§1). - Meta-analysis figures: report heterogeneity statistics (Q, I^2, tau^2) and pooling method (REML / DL / inverse-variance) in Note. Format:
Heterogeneity: *Q*(9) = 12.45, *p* = .19, *I*^2 = 28%, *tau*^2 = 0.04, pooling method = REML. - Bayesian comparisons: if reporting
BF_10(favoring H1), also state the prior assumption ("default Cauchy prior, scale = 0.707" or the actual prior used). APA does not prescribe Bayes factor format; the format above is consistent withBayesFactorR package output. - ROC / AUC figures: report AUC with bootstrap 95% CI (typical: 2,000 iterations) and diagonal reference line ("Diagonal reference line represents chance performance.").
- SHAP / feature importance figures: report mean absolute SHAP value per feature; state the prediction target and model class in the Note. SHAP itself is an upright acronym, the mean magnitude is a continuous statistic without italic convention.
| Statistic | Decimals | Leading zero? | Example |
|---|---|---|---|
| M, SD | 1--2 | Yes | M = 3.45 |
| r, proportions | 2 | No | r = .45 |
| t, F, chi^2 | 2 | Yes | F(2, 97) = 4.56 |
| p | 2--3 | No | p = .032 |
| d, g | 2 | Yes | d = 0.45 |
| R^2, eta^2 | 2 | No | R^2 = .34 |
| OR, RR | 2 | Yes | OR = 2.31 |
Leading-zero rule: omit only when the statistic cannot exceed 1.00 in absolute value.
| Function | Purpose | Key parameters |
|---|---|---|
p_to_stars(p) |
p-value to ***/**/*/n.s. |
p: float |
format_p_value(p) |
APA string: *p* = .032 |
p: float, style='apa' |
add_significance_bracket(ax, x1, x2, y, p_value) |
Bracket with stars | height, text_offset, lw, color |
annotate_effect_size(ax, d, ci=None) |
Effect-size text on axes | label, x, y, fontsize |
add_inline_stats(ax, items, position=...) |
Multi-stat inline cluster | position, fontsize, bbox, italic_latin, sep |
add_reference_line(ax, value, orientation=...) |
Dashed gray reference line | color, linestyle, linewidth, label, label_position |
format_apa_figure_text(figure_number, title, ...) |
Full APA figure Markdown | note_text, specific_notes, p_levels, error_bar_type, model_fit, zwsp |
format_apa_figure_text example:
from ssci_style import format_apa_figure_text
text = format_apa_figure_text(
figure_number=1,
title="Mean Anxiety Scores by Treatment Condition",
note_text="N = 354. Error bars represent 95% confidence intervals.",
specific_notes=["^a n = 178.", "^b n = 176."],
p_levels=[("*", ".05"), ("**", ".01"), ("***", ".001")],
)Output:
**Figure 1**
*Mean Anxiety Scores by Treatment Condition*
*Note.* N = 354. Error bars represent 95% confidence intervals.
^a n = 178. ^b n = 176.
*p < .05. **p < .01. ***p < .001.