Smooths data by replacing each point with the least-squared linear interpolations of the points in its neighborhood
Can handle missing data, when there are null
or undefined
instead of numbers in the input data.
An optional options argument can contain any of the following fields:
radius
, defaulting to 2, specifies the neighborhood width extending fromradius
points below toradius
points above the current pointalgorithm
, which can be one of'leastSquares'
(default) replace each point with the least-squared linear interpolations of the points in its neighborhood'movingAverage'
replace each point with the moving average of the points in its neighborhood
falloff
, which cab be one of'exponential'
(default) give a weigh of each point that is an exponential decay with a time constant of the radius'step'
give equal weight to allradius*2+1
points in the neighborhood, and no weight to points outside the radius
Kind: global function
Returns: Array.<number>
- smoothed version of the input, with the same length
Param | Type | Default | Description |
---|---|---|---|
data | Array.<number> |
time series of equally-spaced values. | |
options | Object |
{radius:2,algorithm:'leastSquares',falloff:'exponential'} |