Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

accumulator

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

If provided a value, returns an updated unbiased sample variance; otherwise, returns the current unbiased sample variance.

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

returns

unbiased sample variance

Type declaration

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

      • Optional x: undefined | number

      Returns number | null

Functions

Export assignment incrmvariance

  • incrmvariance(W: number, mean?: undefined | number): accumulator
  • Returns an accumulator function which incrementally computes a moving unbiased sample variance.

    throws

    first argument must be a positive integer

    Parameters

    • W: number

      window size

    • Optional mean: undefined | number

      mean value

    Returns accumulator

    accumulator function

    Example

    var accumulator = incrmvariance( 3 );
    
    var s2 = accumulator();
    // returns null
    
    s2 = accumulator( 2.0 );
    // returns 0.0
    
    s2 = accumulator( -5.0 );
    // returns 24.5
    
    s2 = accumulator( 3.0 );
    // returns 19.0
    
    s2 = accumulator( 5.0 );
    // returns 28.0
    
    s2 = accumulator();
    // returns 28.0

    Example

    var accumulator = incrmvariance( 3, -2.0 );