UNPKG

als-statistics

Version:

Modular JS statistics toolkit for Node.js and the browser: descriptive stats, correlations (Pearson/Spearman/Kendall), t-tests & ANOVA (Student/Welch), reliability (Cronbach’s alpha), regression (linear/logistic), clustering (DBSCAN/HDBSCAN), and table/co

24 lines (17 loc) 1.33 kB
## Changelog [2.1.0] - 2025-09-04 > **Breaking change:** `als-statistics` v2 is a **ground-up rewrite** with **no backward compatibility** with v1.x. **If you rely on v1:** pin your dependency to the latest 1.x release. ```bash npm i als-statistics@^1 ``` ### Changed - **`Stats.harmonicMean(...)`** — inputs `≤ 0` are now clamped to ε (`1e-12`) before computation (aligns with Python goldens), preventing `NaN`/division-by-zero surprises. - **`Stats.zScores({ values }, sample = false)`** — added a second parameter: - `sample = false` (default): population std (ddof = 0) — backward-compatible. - `sample = true`: sample std (ddof = 1) — matches NumPy/SciPy z-scores and golden summaries. - **`Stats.flatness({ values })`** — now returns `0` when the arithmetic mean is `0` (previously `NaN`), making all-zero vectors well-defined. ### Fixed - **`Stats.mad(...)`** — corrected median absolute deviation for edge cases. ### Tests - Added golden cross-checks against Python (NumPy/SciPy) and HDBSCAN labels; all pass within documented EPS tolerances. > **Notes:** Default behavior remains the same for `zScores` (ddof=0) unless `sample=true` is provided. If your code relied on `NaN` from `flatness`/`harmonicMean` for zero/negative inputs, update downstream checks accordingly.