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

Spearman Rank Correlation and Kendall Tau

Install and import#

bash
npm install fintech-algorithms
ts
import { spearmanRankCorrelationAndKendallTau } from "fintech-algorithms/financial-mathematics-statistics-and-data-foundations/dependence-regression-and-model-foundations/spearman-rank-correlation-and-kendall-tau";

Signature#

spearmanRankCorrelationAndKendallTau(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#

spearmanRankCorrelationAndKendallTau(input)

Returns#

object with 2 fields: spearman, kendallTauA

{
  "spearman": 0.9428571428571428,
  "kendallTauA": 0.8666666666666667
}

Diagrams#

Spearman Rank Correlation and Kendall Tau — article hero
Spearman Rank Correlation and Kendall Tau — calculation ledger
Spearman Rank Correlation and Kendall Tau — concept anatomy
Spearman Rank Correlation and Kendall Tau — failure boundary
Spearman Rank Correlation and Kendall Tau — method map
Spearman Rank Correlation and Kendall Tau — 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#