PitchKit
API Reference@pitchkit/coreFunctions

silvermanBandwidth()

function silvermanBandwidth(values): number;

Defined in: packages/core/src/kde/density.ts:38

Silverman's rule of thumb for a d-dimensional Gaussian kernel: h = σ · (4 / (d + 2))^(1/(d+4)) · n^(-1/(d+4)). For d = 2 the constant factor is exactly 1, leaving h = σ · n^(-1/6) — the same default seaborn's kdeplot (which mplsoccer wraps) starts from.

Hand-rolled, like color/scale.ts's colour interpolation, rather than taking a stats dependency for six lines of arithmetic.

Parameters

ParameterType
valuesreadonly number[]

Returns

number

On this page