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

22 lines (19 loc) 785 B
import { Cache } from "./cache.js"; import { Counter } from "../utils/counter.js"; import { addStats } from './add-stats.js' import { prepare } from "./prepare.js"; export default class Column extends Cache { static counter = new Counter('column') constructor(data, name, _labels = []) { const { values, labels, invalid } = prepare(data,_labels) super(values) this.name = Column.counter.getName(name); this.labels = labels; this.invalid = invalid; } addValue(value,index) { return this.insertAt(index,value) } deleteValue(index) { this.removeAt(index,1)} get n() { return this.values.length } clone(name) { return new Column(this, name || `${this.name}-clone`, (this.labels || []).slice()) } } addStats(Column)