statslibx 0.2.9__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. statslibx-0.4.0/MANIFEST.in +3 -0
  2. statslibx-0.4.0/PKG-INFO +469 -0
  3. statslibx-0.4.0/README.md +429 -0
  4. {statslibx-0.2.9 → statslibx-0.4.0}/pyproject.toml +15 -11
  5. statslibx-0.4.0/statslibx/__init__.py +148 -0
  6. statslibx-0.4.0/statslibx/_stats_utils.py +346 -0
  7. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/backend.py +145 -15
  8. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/cli.py +8 -5
  9. statslibx-0.4.0/statslibx/computational.py +2256 -0
  10. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/datasets/__init__.py +32 -33
  11. statslibx-0.4.0/statslibx/descriptive.py +1382 -0
  12. statslibx-0.4.0/statslibx/distribution.py +379 -0
  13. statslibx-0.4.0/statslibx/eda.py +327 -0
  14. statslibx-0.4.0/statslibx/formatting.py +156 -0
  15. statslibx-0.4.0/statslibx/imputation.py +381 -0
  16. statslibx-0.4.0/statslibx/inferential.py +2911 -0
  17. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/preprocessing/__init__.py +78 -29
  18. statslibx-0.4.0/statslibx/timeseries.py +810 -0
  19. statslibx-0.4.0/statslibx/utils.py +1084 -0
  20. statslibx-0.4.0/statslibx/viewx/__init__.py +27 -0
  21. statslibx-0.4.0/statslibx/viewx/_availability.py +37 -0
  22. statslibx-0.4.0/statslibx/viewx/adapters.py +326 -0
  23. statslibx-0.4.0/statslibx/viewx/export.py +205 -0
  24. statslibx-0.4.0/statslibx/viewx/renderers.py +197 -0
  25. statslibx-0.4.0/statslibx/viz/__init__.py +25 -0
  26. statslibx-0.4.0/statslibx/viz/figures.py +298 -0
  27. statslibx-0.4.0/statslibx.egg-info/PKG-INFO +469 -0
  28. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx.egg-info/SOURCES.txt +21 -6
  29. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx.egg-info/requires.txt +12 -6
  30. statslibx-0.4.0/tests/test_diagnostics.py +202 -0
  31. statslibx-0.4.0/tests/test_distribution.py +132 -0
  32. statslibx-0.4.0/tests/test_eda.py +136 -0
  33. statslibx-0.4.0/tests/test_formatting.py +83 -0
  34. statslibx-0.4.0/tests/test_golden.py +54 -0
  35. statslibx-0.4.0/tests/test_imputation.py +152 -0
  36. statslibx-0.4.0/tests/test_performance.py +54 -0
  37. statslibx-0.4.0/tests/test_simulation.py +118 -0
  38. {statslibx-0.2.9 → statslibx-0.4.0}/tests/test_smoke.py +72 -2
  39. statslibx-0.4.0/tests/test_timeseries.py +189 -0
  40. statslibx-0.4.0/tests/test_v031_fixes.py +349 -0
  41. statslibx-0.2.9/MANIFEST.in +0 -1
  42. statslibx-0.2.9/PKG-INFO +0 -329
  43. statslibx-0.2.9/README.md +0 -293
  44. statslibx-0.2.9/statslibx/__init__.py +0 -81
  45. statslibx-0.2.9/statslibx/_stats_utils.py +0 -172
  46. statslibx-0.2.9/statslibx/computational.py +0 -1135
  47. statslibx-0.2.9/statslibx/datasets/course_completion.csv +0 -100001
  48. statslibx-0.2.9/statslibx/datasets/sp500_companies.csv +0 -504
  49. statslibx-0.2.9/statslibx/descriptive.py +0 -1276
  50. statslibx-0.2.9/statslibx/inferential.py +0 -1577
  51. statslibx-0.2.9/statslibx/utils.py +0 -1371
  52. statslibx-0.2.9/statslibx/viewx/__init__.py +0 -16
  53. statslibx-0.2.9/statslibx/viewx/adapters.py +0 -72
  54. statslibx-0.2.9/statslibx.egg-info/PKG-INFO +0 -329
  55. statslibx-0.2.9/tests/test1.py +0 -30
  56. statslibx-0.2.9/tests/test2.py +0 -39
  57. statslibx-0.2.9/tests/test3.py +0 -3
  58. {statslibx-0.2.9 → statslibx-0.4.0}/setup.cfg +0 -0
  59. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/datasets/Cocoa_Bubbles_Investment_Nigeria_Ghana_1980_2023.xlsx +0 -0
  60. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/datasets/iris.csv +0 -0
  61. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/datasets/penguins.csv +0 -0
  62. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/datasets/titanic.csv +0 -0
  63. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx/py.typed +0 -0
  64. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx.egg-info/dependency_links.txt +0 -0
  65. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx.egg-info/entry_points.txt +0 -0
  66. {statslibx-0.2.9 → statslibx-0.4.0}/statslibx.egg-info/top_level.txt +0 -0
@@ -0,0 +1,3 @@
1
+ recursive-include statslibx/datasets *.csv *.xlsx
2
+ recursive-exclude statslibx/datasets course_completion.csv
3
+ recursive-exclude statslibx/datasets sp500_companies.csv
@@ -0,0 +1,469 @@
1
+ Metadata-Version: 2.4
2
+ Name: statslibx
3
+ Version: 0.4.0
4
+ Summary: Statistical library for descriptive, inferential, and computational analysis
5
+ Author: Emmanuel Ascendra
6
+ License: MIT
7
+ Project-URL: Homepage, https://statslibx.vercel.app/
8
+ Project-URL: Documentation, https://github.com/GhostAnalyst30/StatsLibX
9
+ Keywords: statistics,data-science,pandas,polars,eda,imputation,time-series
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: numpy>=1.21
15
+ Requires-Dist: pandas>=1.3
16
+ Requires-Dist: scipy>=1.7
17
+ Requires-Dist: matplotlib>=3.4
18
+ Requires-Dist: sympy>=1.9
19
+ Provides-Extra: viewx
20
+ Requires-Dist: viewx>=0.3.0; extra == "viewx"
21
+ Provides-Extra: statsmodels
22
+ Requires-Dist: statsmodels>=0.13; extra == "statsmodels"
23
+ Provides-Extra: sklearn
24
+ Requires-Dist: scikit-learn>=1.0; extra == "sklearn"
25
+ Provides-Extra: excel
26
+ Requires-Dist: openpyxl>=3.0; extra == "excel"
27
+ Provides-Extra: polars
28
+ Requires-Dist: polars>=0.20; extra == "polars"
29
+ Provides-Extra: plots
30
+ Requires-Dist: seaborn>=0.11; extra == "plots"
31
+ Requires-Dist: plotly>=5.0; extra == "plots"
32
+ Provides-Extra: all
33
+ Requires-Dist: viewx>=0.3.0; extra == "all"
34
+ Requires-Dist: statsmodels>=0.13; extra == "all"
35
+ Requires-Dist: scikit-learn>=1.0; extra == "all"
36
+ Requires-Dist: openpyxl>=3.0; extra == "all"
37
+ Requires-Dist: polars>=0.20; extra == "all"
38
+ Requires-Dist: seaborn>=0.11; extra == "all"
39
+ Requires-Dist: plotly>=5.0; extra == "all"
40
+
41
+ <p align="center">
42
+ <img src="https://raw.githubusercontent.com/GhostAnalyst30/StatsLibX/main/StatsLibX.png" alt="StatsLibX" width="420"/>
43
+ </p>
44
+
45
+ <h1 align="center">StatsLibX</h1>
46
+
47
+ <p align="center">
48
+ <strong>Descriptive, inferential and computational statistics for Python — with pandas, polars and ViewX.</strong>
49
+ </p>
50
+
51
+ <p align="center">
52
+ <a href="https://pypi.org/project/statslibx/"><img src="https://img.shields.io/pypi/v/statslibx?label=PyPI&color=7c6af7" alt="PyPI version"/></a>
53
+ <a href="https://pypi.org/project/statslibx/"><img src="https://img.shields.io/pypi/pyversions/statslibx?label=Python&color=4fd1c5" alt="Python versions"/></a>
54
+ <a href="https://github.com/GhostAnalyst30/StatsLibX/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License MIT"/></a>
55
+ <a href="https://github.com/GhostAnalyst30/StatsLibX"><img src="https://img.shields.io/github/stars/GhostAnalyst30/StatsLibX?style=social" alt="GitHub stars"/></a>
56
+ </p>
57
+
58
+ <p align="center">
59
+ <a href="https://statslibx.vercel.app/">Documentation</a> ·
60
+ <a href="https://github.com/GhostAnalyst30/StatsLibX/blob/main/how_use_statslibx.ipynb">API Notebook</a> ·
61
+ <a href="https://github.com/GhostAnalyst30/StatsLibX/issues">Issues</a> ·
62
+ <a href="https://viewx.vercel.app/">ViewX</a>
63
+ </p>
64
+
65
+ ---
66
+
67
+ **StatsLibX** is a modern Python library for statistical analysis and data science, built for statisticians, analysts and data scientists. It offers a clear class-based API, dual **pandas / polars** support, structured result objects, bundled datasets, preprocessing, computational statistics and an optional **ViewX** reporting bridge.
68
+
69
+ > **Current version:** `0.4.0` · **Author:** Emmanuel Ascendra
70
+
71
+ ---
72
+
73
+ ## What's new in v0.4.0
74
+
75
+ This release focuses on **browser-ready packaging and four new analysis modules**.
76
+
77
+ ### New modules
78
+
79
+ | Module | Description |
80
+ |--------|-------------|
81
+ | **`timeseries`** | `TimeSeriesStats`: ACF / PACF with Ljung-Box, ADF + KPSS stationarity tests (opposite nulls for a robust diagnosis), classical trend/seasonal decomposition, rolling statistics and lag feature matrices |
82
+ | **`distribution`** | `fit_distributions` (scipy MLE over candidates ranked by AIC/BIC), `qq_data`, `goodness_of_fit` (KS with Lilliefors warning) |
83
+ | **`imputation`** | `missing_report` (per-column + per-pattern missingness), `impute` with constant/mean/median/mode/linear/ffill/bfill/**KNN**/**MICE-lite** strategies |
84
+ | **`eda`** | `profile()` — automatic EDA report with per-column statistics, correlation structure and data-quality alerts; exports a ViewX payload via `to_report_data()` |
85
+
86
+ ### New methods
87
+
88
+ - **`ComputationalStats.regression_diagnostics()`** / `RegressionResult.diagnostics()` — VIF, hat leverage, Cook's distance, Durbin-Watson, Breusch-Pagan heteroscedasticity, residual normality and influence flags.
89
+ - **`InferentialStats.suggest_test()`** — data-driven test recommender: inspects types, group counts, per-group normality and homoscedasticity, returns a `TestRecommendation` with assumption checks and a `.run()` shortcut.
90
+
91
+ ### Packaging
92
+
93
+ - **Fixed a broken import**: `statslibx` failed to import on Python ≥ 3.10 (a `plt.Figure` annotation in `utils.py`); all modules now use lazy annotation evaluation.
94
+ - `polars`, `seaborn` and `plotly` moved from hard dependencies to extras (`pip install statslibx[polars]`, `[plots]`) — the wheel is lighter and installs in **Pyodide/browser** environments.
95
+ - Bundled datasets in the wheel slimmed to `iris`, `penguins`, `titanic` (the large `course_completion` and `sp500_companies` datasets remain available in the repository).
96
+ - Legacy test files removed; new test suites for every new module.
97
+
98
+ ## What's new in v0.3.1
99
+
100
+ This release focuses on **statistical correctness, reproducibility and documentation**.
101
+
102
+ ### Correctness fixes
103
+
104
+ | Area | Fix |
105
+ |------|-----|
106
+ | **Games–Howell** | Now uses the studentized range distribution (previously pairwise Welch t-tests, which produced anti-conservative p-values) |
107
+ | **OLS inference** | Coefficient standard errors use the unbiased residual variance `SSE/(n-p-1)`; both engines now match `statsmodels` exactly |
108
+ | **Proportion CIs** | Wilson score interval by default (never outside [0, 1]); Wald available as an option |
109
+ | **Normality (KS)** | `method='ks'` now applies a Lilliefors Monte Carlo correction — the classical KS p-value is invalid with estimated parameters |
110
+ | **NaN handling** | All univariate statistics drop NaN consistently; `mean()` and `summary()` always agree; `n_missing` reported |
111
+ | **ddof** | Sample convention (`ddof=1`) everywhere by default, including bootstrap SE |
112
+ | **Permutation tests** | p-values use the `(count + 1) / (B + 1)` convention (never exactly zero) |
113
+ | **Reproducibility** | One `numpy.random.Generator` per instance: the constructor `seed` now controls bootstrap, Monte Carlo, CV, k-means and permutations |
114
+
115
+ ### New statistical functionality
116
+
117
+ | Module | Additions |
118
+ |--------|-----------|
119
+ | **DescriptiveStats** | Robust statistics (`mad`, `trimmed_mean`, `winsorized_mean`), weighted statistics (`weighted_mean/var/std/quantile`), `sem`, `cv`, `iqr`, `data_range`, `count`, `n_missing`, `freq_table`, `cramers_v`, grouped `summary_by` |
120
+ | **InferentialStats** | `tukey_hsd`, corrected `games_howell`, `dunn_test`, `mcnemar_test`, `chi_square_gof`, dedicated `wilcoxon_test`, `adjust_pvalues` (Bonferroni / Holm / Benjamini-Hochberg), full effect sizes (one-sample and paired d, rank-biserial r, epsilon² for Kruskal, omega² for ANOVA, Cramér's V for chi-square), Welch df reporting |
121
+ | **ComputationalStats** | **BCa bootstrap intervals** (recommended default), `bootstrap_regression` (coefficient CIs), delete-d jackknife, stratified k-fold CV, `loo_cv`, MAE metrics, `find_best_degree` by cross-validation |
122
+
123
+ ### API and documentation
124
+
125
+ - All docstrings rewritten in **English**, NumPy style, with assumptions and references.
126
+ - `bootstrapping()` renamed to **`bootstrap()`** (old name kept as a deprecated alias).
127
+ - `confidence_interval()` returns a structured `ConfidenceIntervalResult` (still unpacks as a tuple).
128
+ - Post-hoc tests return a `PairwiseResult` table with `to_dataframe()` / `to_markdown()` / `to_json()`.
129
+ - Dead code removed (unused `lang` translations, duplicate `__repr__` definitions).
130
+
131
+ See the [Migration notes](#migration-notes) below.
132
+
133
+ ---
134
+
135
+ ## Installation
136
+
137
+ ```bash
138
+ pip install statslibx
139
+ ```
140
+
141
+ ### Optional extras
142
+
143
+ ```bash
144
+ # ViewX (HTML reports, slides, matrices)
145
+ pip install statslibx[viewx]
146
+
147
+ # Advanced regression (statsmodels / sklearn)
148
+ pip install statslibx[statsmodels,sklearn]
149
+
150
+ # polars backend / advanced plots / Excel
151
+ pip install statslibx[polars]
152
+ pip install statslibx[plots]
153
+ pip install statslibx[excel]
154
+ pip install statslibx[all]
155
+ ```
156
+
157
+ | Extra | Packages |
158
+ |-------|----------|
159
+ | `viewx` | viewx ≥ 0.2.3 |
160
+ | `statsmodels` | statsmodels ≥ 0.13 |
161
+ | `sklearn` | scikit-learn ≥ 1.0 |
162
+ | `polars` | polars ≥ 0.20 |
163
+ | `plots` | seaborn ≥ 0.11, plotly ≥ 5.0 |
164
+ | `excel` | openpyxl ≥ 3.0 |
165
+ | `all` | All of the above |
166
+
167
+ **Requirements:** Python ≥ 3.9 · numpy · pandas · scipy · matplotlib · sympy (polars, seaborn and plotly are optional extras)
168
+
169
+ ---
170
+
171
+ ## Quick start
172
+
173
+ ```python
174
+ import statslibx as slx
175
+ from statslibx import DescriptiveStats, InferentialStats, ComputationalStats, Preprocessing
176
+ from statslibx.datasets import load_iris, generate_dataset
177
+
178
+ print(f"StatsLibX v{slx.__version__}")
179
+
180
+ # Load a bundled dataset (iris, penguins, titanic)
181
+ iris = load_iris()
182
+
183
+ # Descriptive statistics (all NaN-aware, sample conventions)
184
+ ds = DescriptiveStats(iris)
185
+ ds.mean("sepal_length")
186
+ ds.mad("sepal_length", scale="normal") # robust scale estimate
187
+ ds.trimmed_mean("sepal_length", 0.1) # robust location
188
+ ds.summary(percentiles=[0.05, 0.95]) # rich summary with n_missing
189
+
190
+ # Grouped summaries and frequency tables
191
+ ds.summary_by("species", ["sepal_length"])
192
+ ds.freq_table("species")
193
+
194
+ # Inferential statistics (structured results with effect sizes)
195
+ inf = InferentialStats(iris)
196
+ t = inf.t_test_1sample("sepal_length", popmean=5.8) # cohens_d in t.params
197
+ anova = inf.anova_oneway("sepal_length", "species") # eta² and omega²
198
+ posthoc = inf.tukey_hsd("sepal_length", "species") # or games_howell
199
+ posthoc.to_dataframe()
200
+
201
+ # Power analysis and multiple comparisons
202
+ inf.power_ttest(effect_size=0.5, n=30, test="1sample")
203
+ inf.adjust_pvalues([0.01, 0.04, 0.03], method="holm")
204
+
205
+ # Computational statistics — fully reproducible with a seed
206
+ comp = ComputationalStats(iris[["sepal_length", "sepal_width"]], seed=42)
207
+ boot = comp.bootstrap("sepal_length", n_samples=2000)
208
+ boot.bca_ci # BCa interval (recommended)
209
+ comp.jackknife("sepal_length")
210
+ comp.k_fold_cv("sepal_width", "sepal_length", n_folds=5)
211
+
212
+ # From a file
213
+ stats = DescriptiveStats.from_file("my_data.csv")
214
+
215
+ # Synthetic data
216
+ schema = {
217
+ "age": {"dist": "normal", "mean": 35, "std": 10, "type": "int"},
218
+ "group": {"dist": "categorical", "choices": ["A", "B", "C"]},
219
+ }
220
+ df = generate_dataset(n_rows=500, schema=schema, seed=42)
221
+ ```
222
+
223
+ ### Data engines (pandas / polars)
224
+
225
+ Every class that receives DataFrames supports the `backend` parameter:
226
+
227
+ ```python
228
+ from statslibx import DescriptiveStats, InferentialStats, ComputationalStats, Preprocessing
229
+
230
+ df = load_iris()
231
+
232
+ # Auto-detect: pandas DataFrame -> pandas, polars DataFrame -> polars
233
+ DescriptiveStats(df)
234
+
235
+ # Force the polars engine (converts pandas -> polars internally)
236
+ DescriptiveStats(df, backend="polars")
237
+
238
+ # From file
239
+ DescriptiveStats.from_file("data.csv", backend="polars")
240
+
241
+ # Inspect the active engine
242
+ stats = DescriptiveStats(df, backend="polars")
243
+ print(stats.backend) # "polars"
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Modules
249
+
250
+ | Class / Module | Description |
251
+ |----------------|-------------|
252
+ | **`DescriptiveStats`** | Central tendency, dispersion, robust and weighted statistics, frequency tables, correlation, Cramér's V, grouped summaries, OLS regression |
253
+ | **`InferentialStats`** | t-tests, ANOVA (classic / Welch / permutation), post-hoc (Tukey, Games-Howell, Dunn), non-parametric tests, categorical tests (chi-square, Fisher, McNemar), normality, power analysis, p-value adjustment, **`suggest_test()`** |
254
+ | **`ComputationalStats`** | Regression (+ **`regression_diagnostics()`**), bootstrap (with BCa), jackknife, Monte Carlo, permutation, cross-validation (k-fold / stratified / LOO), k-means, interpolation |
255
+ | **`Preprocessing`** | Cleaning, missing values, scaling, outliers, data quality, dtypes |
256
+ | **`UtilsStats`** | File loading, standalone visualization (matplotlib / seaborn / plotly), quick checks |
257
+ | **`TimeSeriesStats`** | ACF / PACF, ADF + KPSS stationarity, classical decomposition, rolling stats, lag matrices |
258
+ | **`distribution`** | `fit_distributions` (AIC/BIC ranking), `qq_data`, `goodness_of_fit` |
259
+ | **`imputation`** | `missing_report`, `impute` (mean/median/mode/linear/KNN/MICE-lite) |
260
+ | **`eda`** | `profile()` — automatic EDA report with alerts and ViewX payload |
261
+ | **`datasets`** | `load_dataset`, `load_iris`, `load_penguins`, `generate_dataset` |
262
+ | **`Backend`** | pandas / polars abstraction (`statslibx.backend`) |
263
+ | **`viewx`** | `HTML`, `Presentation`, `Slide`, `Report`, `DataMatrix`, `to_report_data`, `render_html` (optional) |
264
+
265
+ ---
266
+
267
+ ## Migration notes
268
+
269
+ Upgrading from v0.3.0:
270
+
271
+ | Before | Now |
272
+ |--------|-----|
273
+ | `cs.bootstrapping(...)` | `cs.bootstrap(...)` — old name still works with a `DeprecationWarning` |
274
+ | `games_howell()` returned a plain DataFrame | Returns a `PairwiseResult` (supports `len()`, `.columns`, indexing, plus `.to_dataframe()`) with **corrected p-values** |
275
+ | `confidence_interval()` returned a tuple | Returns `ConfidenceIntervalResult`; `lower, upper, point = result` still works |
276
+ | Proportion CI (Wald) | Wilson score by default; pass `method="wald"` for the old behavior |
277
+ | `normality_test(method='ks')` | Lilliefors-corrected p-value (the old p-value was systematically too large); `test_statistic` parameter deprecated |
278
+ | `lang='es-ES'` parameters | Deprecated and ignored; all output is in English |
279
+ | `std()` / `var()` on `Backend` | Default changed from `ddof=0` to `ddof=1` (sample convention) |
280
+ | Statistics with NaN present | Now dropped consistently everywhere (previously `mean()` could return NaN while `summary()` ignored them) |
281
+
282
+ Every result object keeps the standard exporters: `to_dict()`, `to_dataframe()`, `to_markdown()`, `to_json()`.
283
+
284
+ ---
285
+
286
+ ## ViewX integration
287
+
288
+ StatsLibX performs **all the analysis**. ViewX enters **only when exporting** results (HTML, PDF, presentation).
289
+
290
+ > **Without ViewX installed:** analysis works normally. The `.to_html()` / `.to_presentation()` methods raise a clear error with the install instruction.
291
+
292
+ ```python
293
+ from statslibx import DescriptiveStats, InferentialStats, load_iris
294
+
295
+ df = load_iris()
296
+ summary = DescriptiveStats(df).summary() # always works
297
+
298
+ # Requires: pip install statslibx[viewx]
299
+ summary.to_html("iris.html", theme="dark_enterprise", include_figures=True, data=df)
300
+ test = InferentialStats(df).t_test_1sample("sepal_length", popmean=5.0)
301
+ test.to_presentation("test.html", theme="dark")
302
+ ```
303
+
304
+ ### Ecosystem: the GhostAnalyst data stack
305
+
306
+ StatsLibX is the **statistics core** of the GhostAnalyst ecosystem, together with [ViewX](https://github.com/GhostAnalyst30/ViewX) (visualization & reporting) and [SynaptIX](https://github.com/GhostAnalyst30/SynaptIX) (machine learning). The three libraries share the same report-payload contract and dataset loaders, and **each works standalone**:
307
+
308
+ ```mermaid
309
+ flowchart TD
310
+ U["Raw data<br/>(CSV, DataFrame, arrays)"]
311
+ SLX["StatsLibX<br/>statistics + data handling + simulation"]
312
+ SYN["SynaptIX<br/>models + evaluation & tuning"]
313
+ VX["ViewX<br/>dashboards, EDA, PDF, slides"]
314
+ U --> SLX
315
+ U --> SYN
316
+ U --> VX
317
+ SLX -->|"DataFrame / polars"| SYN
318
+ SLX -->|"to_report_data() payload"| VX
319
+ SYN -->|"to_report_data() payload"| VX
320
+ SYN -->|"diagnostics() uses InferentialStats"| SLX
321
+ VX -->|"HTML / PDF / slides"| U
322
+ ```
323
+
324
+ - **SynaptIX → ViewX**: ML results (`evaluate()`, `compare_models()`, ...) export with `.to_html()` / `.to_report()` / `.to_presentation()` (`pip install synaptix[viewx]`).
325
+ - **SynaptIX → StatsLibX**: `model.diagnostics(X, y)` runs inferential tests on residuals/predictions via StatsLibX (`pip install synaptix[stats]`).
326
+ - **StatsLibX → SynaptIX**: DataFrames produced with the polars backend feed SynaptIX models directly (polars input is converted automatically).
327
+
328
+ #### End-to-end example (StatsLibX → SynaptIX → ViewX)
329
+
330
+ ```python
331
+ # pip install statslibx[viewx] synaptix[viewx,stats] viewx
332
+ from statslibx import DescriptiveStats, InferentialStats, load_iris
333
+ import synaptix as sx
334
+ from viewx import from_report_payload
335
+
336
+ df = load_iris()
337
+
338
+ # 1. Statistics: EDA + hypothesis testing (StatsLibX)
339
+ DescriptiveStats(df).summary()
340
+ anova = InferentialStats(df).anova_oneway("sepal_length", "species")
341
+
342
+ # 2. Machine learning: model + evaluation (SynaptIX)
343
+ X, y = df.drop(columns="species"), df["species"]
344
+ model = sx.supervised.RandomForestClassifier().fit(X, y)
345
+ eval_result = model.evaluate(X, y)
346
+
347
+ # 3. Reporting: everything into one dashboard (ViewX)
348
+ payload = eval_result.to_report_data(include_figures=True)
349
+ from_report_payload(payload, target="html", filename="analisis.html")
350
+ ```
351
+
352
+ > Portal with docs and a unified playground for the three libraries: **Libraries_of_Emms** (in this workspace).
353
+
354
+ ---
355
+
356
+ ## CLI
357
+
358
+ StatsLibX ships a command-line interface to explore CSVs without writing code.
359
+
360
+ ```bash
361
+ statslibx data iris.csv --summary --types --missing
362
+ statslibx describe iris.csv --numeric
363
+ statslibx describe iris.csv --categorical
364
+ statslibx quality iris.csv --verbose
365
+ statslibx preview iris.csv -n 10 --sample --seed 42
366
+ statslibx info iris.csv --detailed
367
+ statslibx --help
368
+ ```
369
+
370
+ ---
371
+
372
+ ## Computational statistics
373
+
374
+ ```python
375
+ from statslibx import ComputationalStats
376
+
377
+ cs = ComputationalStats(df, seed=42) # seed controls every stochastic method
378
+
379
+ # Regression with interaction terms and correct classical inference
380
+ model = cs.regression(X=["age", "score"], y="income", interaction_terms=True)
381
+ print(model.get_formula())
382
+ print(model.summary())
383
+
384
+ # Bootstrap with BCa intervals
385
+ boot = cs.bootstrap("income", n_samples=2000, statistic="mean")
386
+ print(boot.bca_ci) # recommended
387
+ print(boot.percentile_ci) # also available: basic_ci, normal_ci
388
+
389
+ # Bootstrap the regression coefficients
390
+ cs.bootstrap_regression(["age"], "income", n_samples=1000)
391
+
392
+ # Model selection by cross-validation
393
+ cs.find_best_degree("age", "income", max_degree=5, metric="cv_rmse")
394
+
395
+ # Clustering
396
+ kmeans = cs.k_means(k=3)
397
+ elbow = cs.elbow_method(max_k=10)
398
+ ```
399
+
400
+ ---
401
+
402
+ ## Preprocessing
403
+
404
+ ```python
405
+ pp = Preprocessing(df)
406
+
407
+ pp.data_quality()
408
+ pp.clean_data(
409
+ drop_duplicates=True,
410
+ handle_missing=True,
411
+ missing_strategy="median",
412
+ scale=True,
413
+ scaling_method="standard",
414
+ remove_outliers=True,
415
+ )
416
+ pp.preview_data(n=5)
417
+ ```
418
+
419
+ ---
420
+
421
+ ## Documentation
422
+
423
+ | Resource | Link |
424
+ |----------|------|
425
+ | Website | [statslibx.vercel.app](https://statslibx.vercel.app/) |
426
+ | Full notebook | [how_use_statslibx.ipynb](https://github.com/GhostAnalyst30/StatsLibX/blob/main/how_use_statslibx.ipynb) |
427
+ | Repository | [github.com/GhostAnalyst30/StatsLibX](https://github.com/GhostAnalyst30/StatsLibX) |
428
+ | ViewX | [viewx.vercel.app](https://viewx.vercel.app/) |
429
+
430
+ Every class also ships an interactive quick reference: `DescriptiveStats(df).help()`.
431
+
432
+ ---
433
+
434
+ ## Package structure
435
+
436
+ ```
437
+ statslibx/
438
+ ├── descriptive.py # DescriptiveStats, DescriptiveSummary, LinearRegressionResult
439
+ ├── inferential.py # InferentialStats, TestResult, PairwiseResult, adjust_pvalues, suggest_test
440
+ ├── computational.py # ComputationalStats, RegressionResult, BootstrappingResult, RegressionDiagnostics
441
+ ├── timeseries.py # TimeSeriesStats (ACF/PACF, ADF/KPSS, decomposition)
442
+ ├── distribution.py # fit_distributions, qq_data, goodness_of_fit
443
+ ├── imputation.py # impute, missing_report
444
+ ├── eda.py # profile() — automatic EDA report
445
+ ├── preprocessing/ # Preprocessing
446
+ ├── datasets/ # iris, penguins, titanic + generate_dataset
447
+ ├── utils.py # UtilsStats (I/O, plots, quick checks)
448
+ ├── backend.py # pandas / polars Backend
449
+ ├── viewx/ # ViewX bridge: adapters, renderers, export (optional)
450
+ ├── viz/ # Plotly figure builders (optional)
451
+ ├── cli.py # statslibx CLI
452
+ └── py.typed # PEP 561 typed package
453
+ ```
454
+
455
+ ---
456
+
457
+ ## Contributing
458
+
459
+ All improvements and ideas are welcome!
460
+
461
+ Open an [issue](https://github.com/GhostAnalyst30/StatsLibX/issues) or a pull request on GitHub.
462
+
463
+ **Contact:** [ascendraemmanuel@gmail.com](mailto:ascendraemmanuel@gmail.com)
464
+
465
+ ---
466
+
467
+ <p align="center">
468
+ Developed by <strong>Emmanuel Ascendra</strong> · StatsLibX v0.4.0 · MIT License
469
+ </p>