Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

accumulator

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

If provided a value, the accumulator function returns an updated variance. If not provided a value, the accumulator function returns the current 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

variance or null

Type declaration

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

      • Optional x: undefined | number

      Returns number | null

Functions

Export assignment increwvariance

  • Returns an accumulator function which incrementally computes an exponentially weighted variance.

    throws

    must provide a nonnegative number

    throws

    must be on the interval [0,1]

    Parameters

    • alpha: number

      smoothing factor

    Returns accumulator

    accumulator function

    Example

    var accumulator = increwvariance( 0.5 );
    
    var v = accumulator();
    // returns null
    
    v = accumulator( 2.0 );
    // returns 0.0
    
    v = accumulator( -5.0 );
    // returns 12.25
    
    v = accumulator();
    // returns 12.25