fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Residuals, MAE, MSE, and RMSE

Install and import#

bash
npm install fintech-algorithms
ts
import { residualsMaeMseAndRmse } from "fintech-algorithms/financial-mathematics-statistics-and-data-foundations/dependence-regression-and-model-foundations/residuals-mae-mse-and-rmse";

Signature#

residualsMaeMseAndRmse(input)

Worked example#

verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

Input#

input
{
  "x": [1, 2, 3, 4, 5, 6],
  "y": [2, 3, 5, 4, 6, 7],
  "groups": ["A", "A", "A", "B", "B", "B"],
  "predictX": 7,
  "otherPredictor": [2, 4, 5, 8, 9, 13]
}

Call#

residualsMaeMseAndRmse(input)

Returns#

object with 2 fields: residuals, mae

{
  "residuals": [
    -0.14285714285714324,
    -0.08571428571428585,
    0.9714285714285715,
    -0.9714285714285715,
    0.08571428571428541,
    0.14285714285714324
  ],
  "mae": 0.40000000000000013
}

Diagrams#

Residuals, MAE, MSE, and RMSE — article hero
Residuals, MAE, MSE, and RMSE — calculation ledger
Residuals, MAE, MSE, and RMSE — concept anatomy
Residuals, MAE, MSE, and RMSE — failure boundary
Residuals, MAE, MSE, and RMSE — method map
Residuals, MAE, MSE, and RMSE — scenario contrast

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Dependence, Regression, and Model Foundations family#