Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

accumulator

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

If provided a value, returns an updated corrected sample standard deviation; otherwise, returns the current corrected sample standard deviation.

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

corrected sample standard deviation

Type declaration

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

      • Optional x: undefined | number

      Returns number | null

Functions

Export assignment incrmstdev

  • incrmstdev(W: number, mean?: undefined | number): accumulator
  • Returns an accumulator function which incrementally computes a moving corrected sample standard deviation.

    Notes

    • The W parameter defines the number of values over which to compute the moving sum.
    • As W values are needed to fill the window buffer, the first W-1 returned values are calculated from smaller sample sizes. Until the window is full, each returned value is calculated from all provided values.
    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 = incrmstdev( 3 );
    
    var s = accumulator();
    // returns null
    
    s = accumulator( 2.0 );
    // returns 0.0
    
    s = accumulator( -5.0 );
    // returns ~4.95
    
    s = accumulator( 3.0 );
    // returns ~4.36
    
    s = accumulator( 5.0 );
    // returns ~5.29
    
    s = accumulator();
    // returns ~5.29

    Example

    var accumulator = incrmstdev( 3, 5.0 );