Skip to content

pearsonR

function pearsonR(m): MetricResult;

Defined in: metrics/distance.ts:140

Linear correlation between the original and projected distances.

A quick global check: high means far-apart points stayed far apart. Blind to a uniform rescaling, unlike stress, but also blind to non-linear distortions that preserve ordering — see spearmanRho for the ordinal version.

  • Needs: high-dimensional data and projection. No labels.
  • Range: [-1, 1], higher is better.
  • Cost: O(1), from an O(N²·D) pass.

Computed over the full N×N matrix including its zero diagonal, matching zadu. That convention shifts the value against a condensed (upper-triangle) one, so compare like with like.

ParameterType
mDistanceMoments

MetricResult

import { analyze, pearsonR, residualVariance } from "@saehrimnir/sickle";
const a = analyze(data, projection);
pearsonR(a.moments).value; // 0.9967 — correlation of the two distance sets
residualVariance(a.moments).value; // 0.0066 — the same thing as 1 - r²