als-statistics
Version:
A powerful and lightweight JavaScript library for descriptive statistics, regression, clustering, outlier detection, and noise analysis using a flexible table/column architecture.
25 lines (16 loc) • 475 B
Markdown
# 📉 regressionSlope()
Calculates the slope of the best-fit line through a numeric column.
## 🔹 Signature
~~~js
column.regressionSlope(customX = null)
~~~
## 🔹 Description
Returns the slope of the regression line between:
- `this` column (Y)
- `customX` or the default `xValues = [1, 2, ..., n]`
## 🔹 Example
~~~js
const col = Statistics.newColumn([2, 4, 6]);
console.log(col.regressionSlope()); // 2
~~~
If `customX` is not provided, `[1, 2, 3]` is used.