Skip to content

Loess.Function.smooth

Christian d'Heureuse edited this page Sep 25, 2026 · 1 revision

commons-math-interpolation / Loess / smooth

Function: smooth()

function smooth(parms): Float64Array;

Defined in: Loess.ts:263

Computes the weighted LOESS linear fit on a sequence of points.

For each point, a local linear regression is computed over the bandwidthFraction part of the points (with a non-zero weight) that are nearest to it. The points are weighted by the product of their weights and the tri-cube function of their x distance. In each robustness iteration, the robustness weights of the points are computed from the residuals of the previous pass (see SmoothParms.outlierDistanceFactor) and the regression is repeated.

If there are no more than 2 points, a copy of yVals is returned.

Parameters

parms

SmoothParms

The parameters.

Returns

Float64Array

The smoothed y values of the points. An element is NaN if the sum of the weights within its local regression is 0.

Throws

Error If the array lengths do not match, if xVals contains non-finite values or is not monotonically increasing, if yVals or weights contain non-finite values, if a numeric parameter is invalid, or if fewer than 2 points have a non-zero weight.

Clone this wiki locally