## 📈 Linear Regression

`LinearRegression` performs multiple linear regression on `Table` data.

### 🔹 Key Features
- Multiple predictors
- Intercept term
- Mediator and moderator support
- Coefficients, p-values, R²
- Interaction terms (X*Z)

### 🔹 Example

```js
const table = Statistics.newTable({
  X: [1, 2, 3, 4, 5],
  Y: [2, 4, 6, 8, 10]
});

const model = table.linearRegression("Y", ["X"]).calculate();
console.table(model.result);
// Expect Intercept ≈ 0, X Coefficient ≈ 2
```

### 🔹 With Mediator

```js
table.linearRegression("Y", ["X"])
  .mediator("M")
  .calculate();
```

### 🔹 With Moderator

```js
table.linearRegression("Y", ["X"])
  .moderator("Z")
  .calculate();
```

### 🔹 Output

```js
model.result
// {
//   Variable: ['Intercept', 'X', ...],
//   Coefficient: [...],
//   StdError: [...],
//   pValue: [...]
// }
```

### html table

```js
table.linearRegression("Y", ["X"]).htmlTable
```

### 🔹 Notes

- Internally uses matrix algebra
- Throws if predictors are constant or if matrix is singular

