WebCab Probability and Statistics for .NET v3.3 Demo

Probability.SetProbability Method (Int32[], Double[])

Sets a probability measure upon a set with a finite number of elements.

public void SetProbability(
   int[] elementsOfSet,
   double[] probabilityMeasure
);

Parameters

elementsOfSet
An array of integers which corresponds to the elements of the set.
probabilityMeasure
The values of the probability measure of the set. That is, the first element corresponds to the probability (i.e. a number in the interval [0,1]) of the first element of the set, the second element corresponds to the probability of the second element and so on.

Remarks

That is, we set the probability of each element of a finite set of elements.

Example

Say we have four possible outcomes: 1, 2, 3, 4; where the probability of each outcome is: 0.25, 0.2, 0.30, 0.25 respectively. Now in order to set the probability for this case you would need to pass the parameters as:

  1. elementsOfSet = {1, 2, 3, 4}
  2. probabilityMeasure = {0.25, 0.2, 0.3, 0.25}

Exceptions

Exception TypeCondition
WrongProbabilityExceptionThrown if the measure of probability is not within [0,1].

See Also

Probability Class | WebCab.Libraries.Statistics.DiscretePrb Namespace | Probability.SetProbability Overload List | Sets the probability measure when the frequency of each event is known. | Gets the reference numbers used to identify the events. | Gets the probabilities of the different events taking place.