Calculates the probability of one of the events from two collections of events selected from the same discrete probability space taking place.
The probability of the union of eventsA
and eventsB
.
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.
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
.
Exception Type | Condition |
---|---|
IncompatibleEventException | Thrown if any of two events is incorrect. |
ProbabilityNotSetException | Thrown if the probability measure has not been set using SetProbability. |
Probability Class | WebCab.Libraries.Statistics.DiscretePrb Namespace | Used to set the events with corresponding probabilities. | Used to set the events with corresponding probabilities.