Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/scitex_stats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
(Cohen's d / Cliff's delta / eta-sq / sample-size-ttest /
Bonferroni / FDR / Tukey HSD / Dunn / ...).
- APA / Nature / LaTeX formatting via `result["formatted"]`.
- `full_report(result, ...)` — six-stat reporting doctrine bundler:
packages n, 95% CI, method, p-value, effect size, and test statistic
into one dict + human-readable string, deriving the CI analytically
(scipy closed-form) or via bootstrap when raw data is supplied.
Raises when any of the six fields can't be determined — partial
reports are treated as incomplete, not silently accepted.

IO
--
Expand Down Expand Up @@ -107,10 +113,14 @@
"effect_sizes": "effect_sizes",
"posthoc": "posthoc",
"power": "power",
"reporting": "reporting",
"tests": "tests",
# Dispatcher
"available_tests": "_dispatch",
"run_test": "_dispatch",
# Six-stat reporting doctrine (n, 95% CI, method, p-value, effect size,
# test statistic — see scitex_stats.reporting.full_report)
"full_report": "reporting",
# JSON
"to_json_safe": "_utils._serialize",
# Stats ↔ SciTeX bundle I/O (optional scitex-io; extra [bundle])
Expand Down Expand Up @@ -210,10 +220,13 @@ def __dir__() -> list[str]:
"effect_sizes",
"posthoc",
"power",
"reporting",
"tests",
# Dispatcher
"run_test",
"available_tests",
# Six-stat reporting doctrine
"full_report",
# Descriptive
"describe",
# JSON serialization
Expand Down
3 changes: 2 additions & 1 deletion src/scitex_stats/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)

# Formatters
from ._formatters import fmt_stat, fmt_sym, italicize_stats, p2stars
from ._formatters import fmt_stat, fmt_sym, fmt_sym_md, italicize_stats, p2stars

# Normalizers
from ._normalizers import force_dataframe
Expand Down Expand Up @@ -53,6 +53,7 @@
# Formatters
"fmt_stat",
"fmt_sym",
"fmt_sym_md",
"italicize_stats",
"p2stars",
# Normalizers
Expand Down
35 changes: 35 additions & 0 deletions src/scitex_stats/_utils/_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,41 @@ def fmt_sym(symbol: str) -> str:
return _MATHTEXT.get(symbol, f"${symbol}$")


def fmt_sym_md(symbol: str) -> str:
"""Return a markdown-italicized stat symbol for plain-text reports.

Companion to :func:`fmt_sym` (which targets matplotlib mathtext): this
targets plain-text / Markdown six-stat report strings (see
``scitex_stats.reporting.full_report``). Sample-size subscripts keep the
N (subject-level, upper-case) / n (window-level, lower-case) convention
verbatim from the caller — this function only italicizes the base
letter, it does not decide N vs n.

Parameters
----------
symbol : str
Plain symbol name (e.g. 't', 'p', 'n_x', 'N_subjects').

Returns
-------
str
Markdown-italicized string (e.g. '*t*', '*n*_x', '*N*_subjects').

Examples
--------
>>> fmt_sym_md('t')
'*t*'
>>> fmt_sym_md('n_x')
'*n*_x'
>>> fmt_sym_md('N_subjects')
'*N*_subjects'
"""
if "_" in symbol:
base, sub = symbol.split("_", 1)
return f"*{base}*_{sub}"
return f"*{symbol}*"


def fmt_stat(
symbol: str,
value,
Expand Down
17 changes: 17 additions & 0 deletions src/scitex_stats/reporting/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File: src/scitex_stats/reporting/__init__.py

"""Six-stat reporting bundle.

Encodes the operator's six-stat reporting doctrine (2026-07-05) as a
checked invariant rather than a documentation convention: any reported
statistic must carry all of (1) n, (2) 95% CI, (3) method/test name,
(4) p-value, (5) effect size, (6) test statistic. See :func:`full_report`.
"""

from ._full_report import SIX_STAT_FIELDS, IncompleteReportError, full_report

__all__ = ["full_report", "SIX_STAT_FIELDS", "IncompleteReportError"]

# EOF
Loading
Loading