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

49 lines (33 loc) 1.84 kB
<title>Analyze — Overview & Patterns</title> <description>Connecting Tables to analyses with concise flows: correlations, mean comparisons, clustering, and regressions.</description> <keywords>analyze, correlate, compare means, regression, clustering, pipeline</keywords> # Analyze — overview & patterns This section ties together the shortcuts across `Table`, `Statistics`, and `Analyze`. ## From Table to analysis ```js import { Table } from 'als-statistics'; import { Analyze } from 'als-statistics'; const t = new Table(data, { name: 'Survey' }); // Correlation (single pair) const r1 = t.correlate('height','weight').pearson(); // Correlation matrix (3+ columns) const rAll = t.correlate('height','weight','age').pearson(); // Compare means (Welch, unequal variances) const w = t.compareMeans('groupA','groupB').independentWelch(); // One-way ANOVA (classic/Welch) const a1 = t.compareMeans('A','B','C').anova(); const aW = t.compareMeans('A','B','C').anovaWelch(); // Regression (linear/logistic) const lin = new Analyze.Regression(t.columns, { yName:'score', xNames:['age','hours'] }); const log = new Analyze.Regression(t.columns, { yName:'passed', xNames:['score'], type:'logistic' }); ``` ## Split → Combine (Statistics) → Analyze ```js // Split one table by a factor (returns Statistics with per-group tables) const S = t.splitBy('group', { 0:'ctrl', 1:'treat' }); // Combine the same column across all split tables into one Table const merged = S.columns('byGroup', 'score'); // -> ctrl_score, treat_score // Now analyze as usual const test = merged.compareMeans('ctrl_score','treat_score').independentWelch(); ``` > Keep **mutations** API-only (`addRow`, `setAt`, `splice`, `values=`). Avoid in-place array edits to preserve caches and consistent results.