Skip to main content

Publication-ready statistical testing framework with 23 tests, effect sizes, power analysis, and MCP server

Project description

Stats (scitex-stats)

SciTeX Stats

Publication-ready statistical testing with 23 tests, effect sizes, power analysis, and APA formatting

PyPI version Documentation License: AGPL-3.0

Full Documentation · pip install scitex-stats


Problem

Statistical testing in Python is fragmented across scipy, statsmodels, and pingouin — each with different interfaces and output conventions. Getting publication-ready results requires substantial manual work: computing effect sizes, running power analysis, formatting to APA or journal standards. AI agents face a further barrier: they cannot call Python libraries directly and need structured, tool-based access.

Solution

scitex-stats provides a unified interface that covers the full statistical workflow:

  • 23 statistical tests with automatic recommendation based on data characteristics
  • Built-in effect sizes (Cohen's d, Cliff's delta, eta squared), power analysis, and APA-formatted output
  • Three interfaces — Python API, CLI, and MCP server — so human researchers and AI agents use the same engine
flowchart LR
    A[Raw Data] --> B{Recommend Test}
    B --> C[Run Test]
    C --> D[Effect Size]
    C --> E[Power Analysis]
    D --> F[APA Format]
    E --> F
    F --> G[Publication-Ready Result]

    style A fill:#4a90d9,stroke:#2c3e50,color:#fff
    style B fill:#f5a623,stroke:#2c3e50,color:#fff
    style C fill:#27ae60,stroke:#2c3e50,color:#fff
    style D fill:#8e44ad,stroke:#2c3e50,color:#fff
    style E fill:#8e44ad,stroke:#2c3e50,color:#fff
    style F fill:#e74c3c,stroke:#2c3e50,color:#fff
    style G fill:#2c3e50,stroke:#1a252f,color:#fff

Figure 1. Statistical testing workflow. scitex-stats automates the full pipeline from raw data to publication-ready results: test recommendation based on data characteristics, test execution with effect size and power analysis, and APA-formatted output.

Installation

Requires Python >= 3.10.

pip install scitex-stats

# With MCP server for AI agents
pip install scitex-stats[mcp]

# Everything
pip install scitex-stats[all]

SciTeX users: pip install scitex already includes Stats. Use import scitex then scitex.stats.

Quickstart

import scitex_stats as ss

# Get test recommendation
ctx = ss.StatContext(n_groups=2, paired=False)
recs = ss.recommend_tests(ctx)

# Run a test
result = ss.run_test("ttest_ind", data=group1, data2=group2)

# APA-formatted output
print(result["formatted"])

Three Interfaces

Python API
import scitex_stats as ss

# Automatic test recommendation
ctx = ss.StatContext(n_groups=2, paired=False)
recs = ss.recommend_tests(ctx)

# Run a test
result = ss.run_test("ttest_ind", data=group1, data2=group2)

# Effect sizes
from scitex_stats import effect_sizes
d = effect_sizes.cohens_d(group1, group2)

# Power analysis
from scitex_stats import power
n = power.sample_size_ttest(effect_size=0.5, alpha=0.05, power=0.8)

# Multiple comparison correction
from scitex_stats import correct
corrected = correct.correct_fdr(results)

# Post-hoc tests
from scitex_stats import posthoc
results = posthoc.tukey_hsd(groups)

Full API reference

CLI Commands
scitex-stats --help-recursive                # Show all commands
scitex-stats list-python-apis                # List Python API tree
scitex-stats list-python-apis -v             # With docstrings
scitex-stats mcp list-tools                  # List MCP tools
scitex-stats mcp doctor                      # Check server health
scitex-stats mcp start                       # Start MCP server

Full CLI reference

MCP Server — for AI Agents

AI agents can run statistical tests and format publication-ready results autonomously.

Tool Description
recommend_tests Recommend appropriate tests based on data characteristics
run_test Execute a statistical test on provided data
format_results Format results in journal style (APA, Nature, etc.)
power_analysis Calculate statistical power or required sample size
correct_pvalues Apply multiple comparison correction
describe Calculate descriptive statistics
effect_size Calculate effect size between groups
normality_test Test whether data follows normal distribution
posthoc_test Run post-hoc pairwise comparisons
p_to_stars Convert p-value to significance stars

Table 1. MCP tools available for AI agent integration via scitex-stats mcp start.

scitex-stats mcp start

Full MCP specification

Available Tests

Category Tests
Parametric t-test (ind, paired, 1-sample), ANOVA (1-way, RM, 2-way)
Nonparametric Mann-Whitney U, Wilcoxon, Kruskal-Wallis, Friedman, Brunner-Munzel
Correlation Pearson, Spearman, Kendall, Theil-Sen
Categorical Chi-squared, Fisher exact, McNemar, Cochran's Q
Normality Shapiro-Wilk, Kolmogorov-Smirnov (1-sample, 2-sample)

Table 2. All 23 statistical tests organized by category.

Part of SciTeX

Stats is part of SciTeX. When used inside the SciTeX framework, statistical testing integrates with the full pipeline:

import scitex

@scitex.session
def main(CONFIG=scitex.INJECTED):
    data = scitex.io.load("measurements.csv")
    result = scitex.stats.run_test("ttest_ind", data=group1, data2=group2)
    scitex.io.save(result, "stats_result.csv")
    return 0

The SciTeX ecosystem follows the Four Freedoms for researchers:

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because research infrastructure deserves the same freedoms as the software it runs on.


SciTeX

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scitex_stats-0.1.1.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scitex_stats-0.1.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file scitex_stats-0.1.1.tar.gz.

File metadata

  • Download URL: scitex_stats-0.1.1.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for scitex_stats-0.1.1.tar.gz
Algorithm Hash digest
SHA256 55511438c0de34be986ecf61b6edc1b73efab99a1e38033f4c57fa90eb99fae3
MD5 e27f949f9d29f0713223725a68588424
BLAKE2b-256 853ecc42cf13a2244f2fa0a4deccaf791933435c8f7ac6a24d151439d5534899

See more details on using hashes here.

File details

Details for the file scitex_stats-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: scitex_stats-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for scitex_stats-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55f757015d8c738d1497fafb9e8ad77ceb1ada2c1153d2d338601adbccd1e7d8
MD5 6b1fb76c16f85ee1e0a6336381a2a121
BLAKE2b-256 5f695f7f359f9ab9d0cd02a1a62c5d8ab7b27011f977d2ffced72354025f2260

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page