SuperAPI AI Directory

rigor

Classical hypothesis testing, effect sizes, power and sample-size analysis and multiple-comparisons correction, returned as cited, assumption-checked answers.

Open website

About this tool

Purpose

rigor provides AI agents with verified statistical inference capabilities. Large language models are good at reciting statistical knowledge, but they struggle to reliably perform calculations—t-statistics or required sample sizes are often numbers recalled from training data, rather than results computed from scratch and verified. rigor is the alternative to this problem: all statistics are computed from scratch, returning cited, assumption-checked answers.

Main capabilities

  • Classical and nonparametric hypothesis tests: one-sample/two-sample/paired t-tests, one-proportion/two-proportion z-tests, chi-square goodness-of-fit and independence tests, Fisher's exact test, McNemar's test and its exact version, one-way ANOVA, Levene (Brown-Forsythe) test for homogeneity of variance. Nonparametric versions include Mann-Whitney U, Wilcoxon signed-rank, and Kruskal-Wallis. Each result returns the statistic, degrees of freedom, two-tailed p-value, confidence interval, citations, and assumption warnings.
  • Correlation and regression: Pearson and Spearman correlation (including Fisher z-transformed confidence intervals); simple ordinary least squares regression (slope, intercept, R², slope significance test, and confidence interval).
  • Effect sizes: Cohen's d, Hedges' g, Cohen's h, Cramér's V, eta²/omega², rank-biserial correlation.
  • Power and sample size: power and required sample size for one-sample/two-sample t-tests and two-proportion z-tests, with the two directions being exact numerical inverses of each other, and sanity-checked against Cohen's (1988) textbook case (d=0.5, α=.05, power=.80 → n≈64).
  • Multiple comparison correction: Bonferroni and Benjamini-Hochberg (FDR).
  • Sequential testing: always-valid p-values based on the mixture sequential probability ratio test (mSPRT), which can be checked repeatedly after each new observation without inflating the false positive rate, suitable for real-time A/B testing dashboards. It also includes a naive_peeking_inflation Monte Carlo demonstration showing the failure mode of naive repeated peeking.
  • Test recommendation assistant: recommend_test, based on data/question characteristics (continuous/proportion/categorical/ordinal, number of groups, whether paired, small sample or skewed, association rather than difference, whether repeatedly viewed) returns the tool that should be called, alternatives when assumptions do not hold, and tools that should be run at the same time.
  • Batch pairwise comparisons: pairwise_group_comparisons runs all pairwise comparisons for more than 2 groups at once and applies Bonferroni/BH correction, preventing agents from manually orchestrating k*(k-1)/2 calls and missing the correction step.

How to use

After installation, two console commands are available:rigor(CLI) and rigor-mcp(MCP server). It can also be run directly from the code repository:python3 rigor.py .... The MCP server uses stdio transport and can be registered with MCP clients such as Claude Code:claude mcp add rigor -- rigor-mcp. The PyPI distribution name is rigor-mcp(because rigor is already taken by an unrelated package), but the importable package and CLI command remain rigor. The statistical core (distributions.py, inference.py, nonparametric.py, correlation.py, regression.py, effect_size.py, power.py, corrections.py, advisor.py, batch.py, sequential.py) is implemented purely with the standard library and has no dependencies; the entire package depends on the official mcp SDK, because the MCP server is a core deliverable.

Use cases

  • When an AI agent needs to reliably perform statistical tests, calculate sample sizes, or correct for multiple comparisons.
  • In real-time experiment monitoring, when results need to be checked repeatedly without inflating the false positive rate.
  • When an appropriate test method needs to be automatically recommended based on data characteristics.
  • Batch pairwise comparisons with automatic correction.

Limitations

  • Regression supports only simple (single-predictor) ordinary least squares.
  • Sequential tests cover two-sample means and two proportions; other cases will explicitly state that they are not supported.
  • In small samples with complete separation (e.g., 0/5 vs 5/5), sequential tests report no available evidence (p=1) rather than maximum evidence.
  • The statistical core has no dependencies, but the MCP server requires the mcp SDK to be installed.
  • The project uses the MIT license.