Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

accumulator

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

If provided a value, returns an updated mid-range; otherwise, returns the current mid-range.

Notes

  • The mid-range is the arithmetic mean of maximum and minimum values. Accordingly, the mid-range is the midpoint of the range and a measure of central tendency.
  • 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

mid-range

Type declaration

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

      • Optional x: undefined | number

      Returns number | null

Functions

Export assignment incrmmidrange

  • Returns an accumulator function which incrementally computes a moving mid-range.

    Notes

    • The W parameter defines the number of values over which to compute the moving mid-range.
    • 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

    must provide a positive integer

    Parameters

    • W: number

      window size

    Returns accumulator

    accumulator function

    Example

    var accumulator = incrmmidrange( 3 );
    
    var mr = accumulator();
    // returns null
    
    mr = accumulator( 2.0 );
    // returns 2.0
    
    mr = accumulator( -5.0 );
    // returns -1.5
    
    mr = accumulator( 3.0 );
    // returns -1.0
    
    mr = accumulator( 5.0 );
    // returns 0.0
    
    mr = accumulator();
    // returns 0.0