Function Math Statistics Class

Probability

Returns the probability that the values in range vXValues are between two limits.

Signature (Visual Basic / VBA)

Public Function Probability( _
      ByRef vXValues As Variant _
    , ByRef vProbValues As Variant _
    , ByVal vLowerLimit As Variant _
    , Optional ByVal vUpperLimit As Variant _
    ) As Variant

Code Example

    Probability(Array(1, 2, 3, 4), Array(.1, .2, .3, .4), 2) = .2
    Probability(Array(1, 2, 3, 4), Array(.1, .2, .3, .4), 2, 3) = .5

Parameters

Parameter Description
vXValues Range of numeric values. Numeric-type array or Variant array containing only numeric elements. This function is NOT affected by the current setting of the StatVarType Property. It assumes that vXValues is an array that contains only numeric elements.
vProbValues Range of probabilities associated with the corresponding values in vXValues. Numeric-type array or Variant array containing only numeric elements. This function assumes that vProbValues is an array that contains only numeric elements.
vLowerLimit Lower limit on the range of values in vXValues.
vUpperLimit Upper limit on the range of values in vXValues.

Return Value

When vUpperLimit is supplied, function returns the probability that the values in vXValues are between vLowerLimit and vUpperLimit. When vUpperLimit is missing, function returns the probability that the values in vXValues are equal to vLowerLimit. Function returns Null if the arrays vXValues and vProbValues contain a different number of elements, if any of the numeric values in vProbValues are <= 0 or > 1, if the numeric values in vProbValues do not add up to approximately 1, or if there is some type of error, such as if the argument is a Variant array which contains an Object reference or String.