Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 1.44 KB

api.md

File metadata and controls

22 lines (18 loc) · 1.44 KB

smoothish(data, options) ⇒ Array.<number>

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 from radius points below to radius points above the current point
  • algorithm, 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 all radius*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'}