Class: probabilityLib

probabilityLib()

Class aggregating probability methods.

Constructor

new probabilityLib()

Source:

Methods

(static) valuesOk(x, y) → {boolean}

Checks if probabilities are valid (i.e. between 0 and 1)
Parameters:
Name Type Description
x number probability
y number probability
Source:
Returns:
true of x and y are valid probabilities
Type
boolean

(static) XandNotY(x, y) → {number}

Calculates probability of independent X and Y - X occurs but not Y.
Parameters:
Name Type Description
x number probability of X (0 <= x <= 1)
y number probability of Y (0 <= y <= 1)
Source:
Returns:
probability of X occuring but not Y
Type
number

(static) XandY(x, y) → {number}

Calculates probability of independent X and Y occuring together.
Parameters:
Name Type Description
x number probability of X (0 <= x <= 1)
y number probability of Y (0 <= y <= 1)
Source:
Returns:
probability of X and Y occuring
Type
number

(static) XgivenNotY(x, y) → {number}

Calculates the conditional probability of X given Y not occuring.
Parameters:
Name Type Description
x number probability of X (0 <= x <= 1)
y number probability of Y (0 <= y <= 1)
Source:
Returns:
probability of X if Y did not occured
Type
number

(static) XgivenY(x, y) → {number}

Calculates the conditional probability of X given Y.
Parameters:
Name Type Description
x number probability of X (0 <= x <= 1)
y number probability of Y (0 <= y <= 1)
Source:
Returns:
probability of X if Y occured
Type
number

(static) XorY(x, y) → {number}

Calculates probability of one of independent X and Y occuring.
Parameters:
Name Type Description
x number probability of X (0 <= x <= 1)
y number probability of Y (0 <= y <= 1)
Source:
Returns:
probability of X or Y occuring
Type
number