Investment Studio > Expressions > Functions > Statistical > PROB
float prob(float array x_values, float array probability_values, float lower_limit, float upper_limit = lower_limit)
Returns the probability that an element in x_values, randomly selected according to the distribution described by probability_values, is in the range [lower_limit, upper_limit].
x_values contains the possible values of x.
probability_values contains the probabilities Î [0, 1] associated with each element in x_values. Their sum must equal 1 to within 1E-10.
All array elements are converted to float, with exclusion if conversion fails. Arrays with different dimensions are allowed as long as they all have the same number of elements (e.g. 2 x 3 and 3 x 2 arrays). Corresponding elements are determined by order of appearance (reading from left to right, top to bottom).
If upper_limit is omitted, it defaults to lower_limit. The probability that a randomly selected element in x_values equals lower_limit is then returned.
Examples
=prob({1, 2, 3, 4}, {0.2, 0.3, 0.35, 0.15}, 3)
equals 0.35;
=prob({1, 2, 3, 4}, {0.2, 0.3, 0.35, 0.15}, 2, 3)
equals 0.65;
=prob({1, 2, 3, 4}, {0.2, 0.3, 0.35, 0.15}, 2.5, 3.5)
equals 0.35 (there is one possible value in that range: 3, with probability 0.35).