WebCab Probability and Statistics Web Services for .NET v3.3 Demo

Probability.ProbabilityUnion Method 

Calculates the probability of one of the events from two collections of events selected from the same discrete probability space taking place.

public double ProbabilityUnion(
   int[] eventsA,
   int[] eventsB
);

Parameters

eventsA
The first (sub)set of events given as an array of integers which corresponds to the index of the events within the set of all events.
eventsB
The second (sub)set of events given as an array of integers which corresponds to the index of the events within the set of all events.

Return Value

The probability of the union of eventsA and eventsB.

Remarks

Recall that the probability space contains all the possible events which can occur, that is the sum of all events within the probability space is 1. Before this method is called the set of events and the corresponding probabilities of each event within the two sets of events must be set using SetProbability, or SetProbability.

Example

If we are considering a set of four events for which the probability of each event taking place is p = {0.2, 0.3, 0.4, 0.1} respectively, then we can evaluate that the probability of one event from the collections eventA = {0, 2} (i.e. the first and third events) and eventB = {0, 3} (i.e. the first and fourth events) will be 0.7. The reason being that the probability of a member of eventA occurring is 0.2 + 0.4 = 0.6, whereas the probability of a member of eventB occurring is 0.2 + 0.1 = 0.3. The probability of a random event being in the sets eventA and eventB, is 0.2, since the first and only the first event is in both sets. Therefore, by the union law we have 0.6 + 0.3 - 0.2 = 0.7.

Exceptions

Exception TypeCondition
IncompatibleEventExceptionThrown if any of two events is incorrect.
ProbabilityNotSetExceptionThrown if the probability measure has not been set using SetProbability.

See Also

Probability Class | DiscreteProbability Namespace | SetProbability | SetProbability