Natural language hypothesis testing and comprehensive statistics library
Project description
HypoTestX
Natural Language Hypothesis Testing for Python
Ask a statistical question in plain English. Get a structured result back — with the right test chosen automatically.
The problem with scipy
# scipy — you decide the test, extract groups, interpret results yourself
from scipy import stats
males = df[df['gender'] == 'M']['salary'].values
females = df[df['gender'] == 'F']['salary'].values
t, p = stats.ttest_ind(males, females, equal_var=False)
# p = 0.0012 ... now what?
# HypoTestX — ask the question, get a full result
import hypotestx as hx
result = hx.analyze(df, "Do males earn more than females?")
print(result.summary())
[ Welch's t-test (unequal variances) ]
=============================================
Statistic (t): 3.2456
p-value: 0.0012
Significant: Yes (alpha = 0.05)
Effect size (d): 0.6834 (medium)
95% CI: [1.23, 4.56]
Install
pip install hypotestx
No mandatory dependencies — pure Python stdlib for all math and HTTP calls.
Usage
Natural language (no API key needed)
import hypotestx as hx
import pandas as pd
df = pd.read_csv('data.csv')
result = hx.analyze(df, "Is there a correlation between age and salary?")
result = hx.analyze(df, "Did scores improve from pre_score to post_score?")
result = hx.analyze(df, "Are gender and department independent?")
result = hx.analyze(df, "Compare satisfaction scores across all regions")
With a real LLM backend (better accuracy on complex questions)
# Google Gemini — free tier, 1500 req/day
result = hx.analyze(df, "...", backend="gemini", api_key="AIza...")
# Groq — free tier, very fast
result = hx.analyze(df, "...", backend="groq", api_key="gsk_...")
# Local Ollama — completely offline, no API key
result = hx.analyze(df, "...", backend="ollama")
Direct API (explicit control)
result = hx.ttest_2samp(group1, group2, equal_var=False, alpha=0.01)
result = hx.pearson(x, y, alternative='greater')
result = hx.chi2_test(contingency_table)
result = hx.mannwhitney(group1, group2)
Result object
result.p_value # 0.0012
result.is_significant # True
result.effect_size # 0.6834
result.effect_magnitude # 'medium'
result.confidence_interval # (1.23, 4.56)
result.interpretation # plain-English explanation
result.summary() # formatted summary string
result.to_dict() # dict for logging or serialization
Supported tests
Parametric: one-sample t-test, two-sample t-test, Welch's t-test, paired t-test, one-way ANOVA
Non-parametric: Mann-Whitney U, Wilcoxon signed-rank, Kruskal-Wallis
Categorical: chi-square (independence + GoF), Fisher's exact
Correlation: Pearson, Spearman, point-biserial
Plus: assumption checking, effect sizes, power analysis, bootstrap & permutation tests, HTML/PDF reporting
Links
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hypotestx-1.0.6.tar.gz.
File metadata
- Download URL: hypotestx-1.0.6.tar.gz
- Upload date:
- Size: 137.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
451df3abf6215d54f810b50d79cd7645ac329da17635457f00fdc5bc5fdbb2e3
|
|
| MD5 |
d0c336eb6477516b8bf51653d38244c4
|
|
| BLAKE2b-256 |
f8e5935aa25ddf67855471b2ffdea6a974b9894c3af7d63188d9507a2d1cc1c8
|
File details
Details for the file hypotestx-1.0.6-py3-none-any.whl.
File metadata
- Download URL: hypotestx-1.0.6-py3-none-any.whl
- Upload date:
- Size: 131.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce73be7b403f8f535a87103dca2895047844a5935ced4679f5eac7bae8eeb3b9
|
|
| MD5 |
67a2565e0dc7385a024b1c507f3acde5
|
|
| BLAKE2b-256 |
c9072cc9aeea64fe3533fba949f6890c0c73620bdc4b621acce18a5703d97c7a
|