Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "stats/base/dists/binomial/entropy/docs/types/index.d"

Index

Functions

Functions

entropy

  • entropy(n: number, p: number): number
  • Returns the entropy of a binomial distribution.

    Notes

    • If provided a number of trials n which is not a nonnegative integer, the function returns NaN.
    • If p < 0 or p > 1, the function returns NaN.

    Parameters

    • n: number

      number of trials

    • p: number

      success probability

    Returns number

    entropy

    Example

    var v = entropy( 100, 0.1 );
    // returns ~2.511

    Example

    var v = entropy( 20, 0.5 );
    // returns ~2.223

    Example

    var v = entropy( 10.3, 0.5 );
    // returns NaN

    Example

    var v = entropy( 20, 1.1 );
    // returns NaN

    Example

    var v = entropy( 20, NaN );
    // returns NaN