Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "stats/incr/wmean/docs/types/index.d"

Index

Type aliases

Functions

Type aliases

accumulator

accumulator: (x?: undefined | number, w?: undefined | number) => number | null

If provided both arguments, returns an updated weighted arithmetic mean; otherwise, returns the current weighted arithmetic mean.

Notes

  • If provided NaN or a value which, when used in computations, results in NaN, the accumulated value is NaN for all future invocations.
param

value

param

weight

returns

weighted arithmetic mean

Type declaration

    • (x?: undefined | number, w?: undefined | number): number | null
    • Parameters

      • Optional x: undefined | number
      • Optional w: undefined | number

      Returns number | null

Functions

Export assignment incrwmean

  • Returns an accumulator function which incrementally computes a weighted arithmetic mean.

    Returns accumulator

    accumulator function

    Example

    var accumulator = incrwmean();
    
    var mu = accumulator();
    // returns null
    
    mu = accumulator( 2.0, 1.0 );
    // returns 2.0
    
    mu = accumulator( 2.0, 0.5 );
    // returns 2.0
    
    mu = accumulator( 3.0, 1.5 );
    // returns 2.5
    
    mu = accumulator();
    // returns 2.5