Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

accumulator

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

If provided input values, the accumulator function returns an updated moving sample correlation distance. If not provided input values, the accumulator function returns the current moving sample correlation distance.

Notes

  • The correlation distance is defined as one minus the Pearson product-moment correlation coefficient and, thus, resides on the interval [0,2].
  • 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

value

returns

updated moving sample correlation distance

Type declaration

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

      • Optional x: undefined | number
      • Optional y: undefined | number

      Returns number | null

Functions

Export assignment incrmpcorrdist

  • Returns an accumulator function which incrementally computes a moving sample Pearson product-moment correlation distance.

    Notes

    • The W parameter defines the number of values over which to compute the moving sample correlation distance.
    • As W (x,y) pairs 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

    • meanx: number

      mean value

    • meany: number

      mean value

    Returns accumulator

    accumulator function

    Example

    var accumulator = incrmpcorrdist( 3, -2.0, 10.0 );
  • Returns an accumulator function which incrementally computes a moving sample Pearson product-moment correlation distance.

    Notes

    • The W parameter defines the number of values over which to compute the moving sample correlation distance.
    • As W (x,y) pairs 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

    Returns accumulator

    accumulator function

    Example

    var accumulator = incrmpcorrdist( 3 );
    
    var d = accumulator();
    // returns null
    
    d = accumulator( 2.0, 1.0 );
    // returns 1.0
    
    d = accumulator( -5.0, 3.14 );
    // returns ~2.0
    
    d = accumulator( 3.0, -1.0 );
    // returns ~1.925
    
    d = accumulator( 5.0, -9.5 );
    // returns ~1.863
    
    d = accumulator();
    // returns ~1.863