{"id":46905260,"url":"https://github.com/ywatanabe1989/scitex-stats","last_synced_at":"2026-04-01T17:12:25.285Z","repository":{"id":343567981,"uuid":"1178198779","full_name":"ywatanabe1989/scitex-stats","owner":"ywatanabe1989","description":"Publication-ready statistical testing with 23 tests, effect sizes, power analysis, and APA formatting","archived":false,"fork":false,"pushed_at":"2026-03-26T01:18:51.000Z","size":1061,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-26T05:07:07.438Z","etag":null,"topics":["apa","effect-size","hypothesis-testing","mcp-server","power-analysis","python","scitex","statistical-testing","statistics"],"latest_commit_sha":null,"homepage":"https://scitex.ai","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ywatanabe1989.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-10T19:40:21.000Z","updated_at":"2026-03-24T23:58:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ywatanabe1989/scitex-stats","commit_stats":null,"previous_names":["ywatanabe1989/scitex-stats"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ywatanabe1989/scitex-stats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywatanabe1989%2Fscitex-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywatanabe1989%2Fscitex-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywatanabe1989%2Fscitex-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywatanabe1989%2Fscitex-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ywatanabe1989","download_url":"https://codeload.github.com/ywatanabe1989/scitex-stats/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywatanabe1989%2Fscitex-stats/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apa","effect-size","hypothesis-testing","mcp-server","power-analysis","python","scitex","statistical-testing","statistics"],"created_at":"2026-03-11T01:04:54.238Z","updated_at":"2026-04-01T17:12:25.280Z","avatar_url":"https://github.com/ywatanabe1989.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SciTeX Stats (\u003ccode\u003escitex-stats\u003c/code\u003e)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://scitex.ai\"\u003e\n    \u003cimg src=\"docs/scitex-logo-banner.png\" alt=\"SciTeX Stats\" width=\"400\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cb\u003ePublication-ready statistical testing with 23 tests, effect sizes, power analysis, and APA formatting\u003c/b\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://badge.fury.io/py/scitex-stats\"\u003e\u003cimg src=\"https://badge.fury.io/py/scitex-stats.svg\" alt=\"PyPI version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://scitex-stats.readthedocs.io/\"\u003e\u003cimg src=\"https://readthedocs.org/projects/scitex-stats/badge/?version=latest\" alt=\"Documentation\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/ywatanabe1989/scitex-stats/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://github.com/ywatanabe1989/scitex-stats/actions/workflows/test.yml/badge.svg\" alt=\"Tests\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.gnu.org/licenses/agpl-3.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-AGPL--3.0-blue.svg\" alt=\"License: AGPL-3.0\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://scitex-stats.readthedocs.io/\"\u003eFull Documentation\u003c/a\u003e · \u003ccode\u003epip install scitex-stats\u003c/code\u003e\n\u003c/p\u003e\n\n---\n\n## Problem\n\nStatistical 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.\n\n## Solution\n\nscitex-stats provides a unified interface that covers the full statistical workflow:\n\n- **23 statistical tests** with automatic recommendation based on data characteristics\n- **Built-in effect sizes** (Cohen's d, Cliff's delta, eta squared), **power analysis**, and **APA-formatted output**\n- **Three interfaces** — Python API, CLI, and MCP server — so human researchers and AI agents use the same engine\n\n```mermaid\nflowchart LR\n    A[Raw Data] --\u003e B{Recommend Test}\n    B --\u003e C[Run Test]\n    C --\u003e D[Effect Size]\n    C --\u003e E[Power Analysis]\n    D --\u003e F[APA Format]\n    E --\u003e F\n    F --\u003e G[Publication-Ready Result]\n\n    style A fill:#4a90d9,stroke:#2c3e50,color:#fff\n    style B fill:#f5a623,stroke:#2c3e50,color:#fff\n    style C fill:#27ae60,stroke:#2c3e50,color:#fff\n    style D fill:#8e44ad,stroke:#2c3e50,color:#fff\n    style E fill:#8e44ad,stroke:#2c3e50,color:#fff\n    style F fill:#e74c3c,stroke:#2c3e50,color:#fff\n    style G fill:#2c3e50,stroke:#1a252f,color:#fff\n```\n\n*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.*\n\nEvery test returns a **unified result dictionary** with consistent keys:\n\n```json\n{\n  \"test_method\": \"Student's t-test (independent)\",\n  \"statistic\": -3.210,\n  \"stat_symbol\": \"t\",\n  \"alternative\": \"two-sided\",\n  \"n_x\": 30,\n  \"n_y\": 30,\n  \"pvalue\": 0.0022,\n  \"stars\": \"**\",\n  \"alpha\": 0.05,\n  \"significant\": true,\n  \"effect_size\": -0.829,\n  \"effect_size_metric\": \"Cohen's d\",\n  \"effect_size_interpretation\": \"large\",\n  \"power\": 0.884,\n  \"H0\": \"μ(x) = μ(y)\",\n  \"formatted\": \"t = -3.210, p = 0.0022, Cohen's d = -0.829, **\"\n}\n```\n\n*Table 3. Unified result format. All 23 tests return the same dictionary structure with test statistics, p-value, effect size with interpretation, statistical power, and APA-formatted string.*\n\n## Installation\n\nRequires Python \u003e= 3.10.\n\n```bash\npip install scitex-stats\n\n# With MCP server for AI agents\npip install scitex-stats[mcp]\n\n# Everything\npip install scitex-stats[all]\n```\n\n\u003e **SciTeX users**: `pip install scitex` already includes Stats. Use `import scitex` then `scitex.stats`.\n\n## Quickstart\n\n```python\nimport scitex_stats as ss\n\n# Get test recommendation\nctx = ss.StatContext(n_groups=2, sample_sizes=[30, 30], outcome_type=\"continuous\", design=\"between\", paired=False)\nrecs = ss.recommend_tests(ctx)\n\n# Run a test\nresult = ss.run_test(\"ttest_ind\", data=group1, data2=group2)\n\n# APA-formatted output\nprint(result[\"formatted\"])\n```\n\n## Three Interfaces\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003ePython API\u003c/strong\u003e\u003c/summary\u003e\n\n\u003cbr\u003e\n\n```python\nimport scitex_stats as ss\n\n# Automatic test recommendation\nctx = ss.StatContext(n_groups=2, sample_sizes=[30, 30], outcome_type=\"continuous\", design=\"between\", paired=False)\nrecs = ss.recommend_tests(ctx)\n\n# Run a test\nresult = ss.run_test(\"ttest_ind\", data=group1, data2=group2)\n\n# Effect sizes\nfrom scitex_stats import effect_sizes\nd = effect_sizes.cohens_d(group1, group2)\n\n# Power analysis\nfrom scitex_stats import power\nn = power.sample_size_ttest(effect_size=0.5, alpha=0.05, power=0.8)\n\n# Multiple comparison correction\nfrom scitex_stats import correct\ncorrected = correct.correct_fdr(results)\n\n# Post-hoc tests\nfrom scitex_stats import posthoc\nresults = posthoc.posthoc_tukey(groups)\n```\n\n\u003e **[Full API reference](https://scitex-stats.readthedocs.io/)**\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eCLI Commands\u003c/strong\u003e\u003c/summary\u003e\n\n\u003cbr\u003e\n\n```bash\nscitex-stats --help-recursive                # Show all commands\nscitex-stats list-python-apis                # List Python API tree\nscitex-stats list-python-apis -v             # With docstrings\nscitex-stats mcp list-tools                  # List MCP tools\nscitex-stats mcp doctor                      # Check server health\nscitex-stats mcp start                       # Start MCP server\n```\n\n\u003e **[Full CLI reference](https://scitex-stats.readthedocs.io/)**\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eMCP Server — for AI Agents\u003c/strong\u003e\u003c/summary\u003e\n\n\u003cbr\u003e\n\nAI agents can run statistical tests and format publication-ready results autonomously.\n\n| Tool | Description |\n|------|-------------|\n| `recommend_tests` | Recommend appropriate tests based on data characteristics |\n| `run_test` | Execute a statistical test on provided data |\n| `format_results` | Format results in journal style (APA, Nature, etc.) |\n| `power_analysis` | Calculate statistical power or required sample size |\n| `correct_pvalues` | Apply multiple comparison correction |\n| `describe` | Calculate descriptive statistics |\n| `effect_size` | Calculate effect size between groups |\n| `normality_test` | Test whether data follows normal distribution |\n| `posthoc_test` | Run post-hoc pairwise comparisons |\n| `p_to_stars` | Convert p-value to significance stars |\n\n*Table 1. MCP tools available for AI agent integration via `scitex-stats mcp start`.*\n\n```bash\nscitex-stats mcp start\n```\n\n\u003e **[Full MCP specification](https://scitex-stats.readthedocs.io/)**\n\n\u003c/details\u003e\n\n## Choosing the Right Test\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/decision_flowchart.png\" alt=\"Statistical test decision flowchart\" width=\"700\"\u003e\n\u003c/p\u003e\n\n*Figure 2. Decision flowchart for choosing a statistical test. Start with your data type, then follow the branches based on number of groups and study design. Brunner-Munzel is recommended as the default for two-group comparisons due to its robustness to unequal variances and non-normality.*\n\n## Available Tests\n\n| Category | Tests |\n|----------|-------|\n| **Parametric** | t-test (ind, paired, 1-sample), ANOVA (1-way, RM, 2-way) |\n| **Nonparametric** | Mann-Whitney U, Wilcoxon, Kruskal-Wallis, Friedman, Brunner-Munzel |\n| **Correlation** | Pearson, Spearman, Kendall, Theil-Sen |\n| **Categorical** | Chi-squared, Fisher exact, McNemar, Cochran's Q |\n| **Normality** | Shapiro-Wilk, Kolmogorov-Smirnov (1-sample, 2-sample) |\n\n*Table 2. All 23 statistical tests organized by category.*\n\n## Lint Rules\n\nDetected by [scitex-linter](https://github.com/ywatanabe1989/scitex-linter) when this package is installed.\n\n| Rule | Severity | Message |\n|------|----------|---------|\n| `STX-ST001` | warning | `scipy.stats.ttest_ind()` — use `stx.stats.ttest_ind()` for auto effect size + CI |\n| `STX-ST002` | warning | `scipy.stats.mannwhitneyu()` — use `stx.stats.mannwhitneyu()` for auto effect size |\n| `STX-ST003` | warning | `scipy.stats.pearsonr()` — use `stx.stats.pearsonr()` for auto CI + power |\n| `STX-ST004` | warning | `scipy.stats.f_oneway()` — use `stx.stats.anova_oneway()` for post-hoc + effect sizes |\n| `STX-ST005` | warning | `scipy.stats.wilcoxon()` — use `stx.stats.wilcoxon()` for auto effect size |\n| `STX-ST006` | warning | `scipy.stats.kruskal()` — use `stx.stats.kruskal()` for post-hoc + effect sizes |\n\n## Part of SciTeX\n\nSciTeX Stats is part of [**SciTeX**](https://scitex.ai). When used inside the SciTeX framework, statistical testing integrates with the full pipeline — from data loading through analysis to publication-ready figures:\n\n```python\nimport scitex\n\n@scitex.session\ndef main(CONFIG=scitex.INJECTED, plt=scitex.INJECTED):\n    # Load data\n    data = scitex.io.load(\"measurements.csv\")\n\n    # Run statistical test\n    result = scitex.stats.run_test(\"ttest_ind\", data=group1, data2=group2)\n    scitex.io.save(result, \"stats_result.csv\")\n\n    # Visualize with figrecipe (scitex.plt)\n    fig, ax = scitex.plt.subplots()\n    ax.plot_box([group1, group2], labels=[\"Control\", \"Treatment\"])\n    ax.set_xyt(\"Group\", \"Value\", f\"p = {result['pvalue']:.4f} {result['stars']}\")\n    scitex.io.save(fig, \"comparison.png\")  # Saves plot + CSV data\n\n    return 0\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/example_ttest_figure.png\" alt=\"Example t-test visualization\" width=\"450\"\u003e\n\u003c/p\u003e\n\n*Figure 3. Example output combining scitex.stats (statistical test) with scitex.plt (publication-ready figure). The box plot shows group comparison with individual data points, significance bracket, p-value, and effect size — all generated from the unified result dictionary.*\n\nThe ecosystem modules work together:\n\n| Module | Package | Role |\n|--------|---------|------|\n| `scitex.stats` | [scitex-stats](https://github.com/ywatanabe1989/scitex-stats) | Statistical testing, effect sizes, power analysis |\n| `scitex.plt` | [figrecipe](https://github.com/ywatanabe1989/figrecipe) | Publication-ready figures with auto CSV export |\n| `scitex.io` | [scitex-io](https://github.com/ywatanabe1989/scitex-io) | Universal file I/O (30+ formats) |\n| `scitex.clew` | [scitex-clew](https://github.com/ywatanabe1989/scitex-clew) | Reproducibility verification via hash DAGs |\n\nThe SciTeX system follows the Four Freedoms for Research below, inspired by [the Free Software Definition](https://www.gnu.org/philosophy/free-sw.en.html):\n\n\u003eFour Freedoms for Research\n\u003e\n\u003e0. The freedom to **run** your research anywhere — your machine, your terms.\n\u003e1. The freedom to **study** how every step works — from raw data to final manuscript.\n\u003e2. The freedom to **redistribute** your workflows, not just your papers.\n\u003e3. The freedom to **modify** any module and share improvements with the community.\n\u003e\n\u003eAGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://scitex.ai\" target=\"_blank\"\u003e\u003cimg src=\"docs/scitex-icon-navy-inverted.png\" alt=\"SciTeX\" width=\"40\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c!-- EOF --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fywatanabe1989%2Fscitex-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fywatanabe1989%2Fscitex-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fywatanabe1989%2Fscitex-stats/lists"}