Class Bernoulli

Bernoulli distribution: A discrete probability distribution for a random variable that takes the value of 1 with probability p (success) and the value 0 with probability 1-p (failure).

Constructors

Properties

mean: number

The mean of the distribution.

p: number

The proability of a success.

q: number

The proability of a failure.

stdev: number

The standard deviation of the distribution.

variance: number

The variance of the distribution.

Methods

  • Get the probability of a success or failure.

    Parameters

    • x: number

      The value. (0: failure, 1: success)

    Returns number

    Return P(X=x).

  • Get the probability of a value greater than or equal to x.

    Parameters

    • x: number

      The value. (0: failure, 1: success)

    Returns number

    Return P(X>=x).

  • Get the probability of a value less than or equal to x.

    Parameters

    • x: number

      The value. (0: failure, 1: success)

    Returns number

    Return P(X<=x).