A clinic reports that 22 percent of its visits involve a long wait. If you book a morning visit, is 22 percent the right figure for you? Not necessarily, because the rate among morning visits can differ from the rate among all visits. This lesson shows how to compute a probability within a subgroup, how these conditional probabilities combine into the overall rate, and what it means for two events to be independent. All counts on this page are constructed for illustration.
Key terms
Joint and marginal probability
Definition For two events and , the joint probability is the probability that both occur. A marginal probability is the probability of one event on its own, such as , without regard to the other classification. Marginal probabilities are sums of joint probabilities. The events and are disjoint with union , so
When a model is given as a two-way table of probabilities, the joint probabilities are the cells and the marginal probabilities are the row and column totals in the margins of the table.
In plain words Joint means both at once, and marginal means one classification while ignoring the other. Both are measured against the whole sample space, so in a table of counts both divide by the grand total.
Example A constructed set of clinic visits is classified by time of day and length of wait. Choose one visit at random, with all equally likely, so that each count divided by is a probability.
| Long wait | Short wait | Total | |
|---|---|---|---|
| Morning | 10 | 30 | 40 |
| Not morning | 12 | 48 | 60 |
| Total | 22 | 78 | 100 |
Let be the event of a morning visit and the event of a long wait. The joint probability is , and the marginal probabilities are and . The second one sums the joint probabilities in the long-wait column, .
Conditional probability
Definition Let and be events with . The conditional probability of given is
The vertical bar is read “given” and is not a division sign. When this formula does not define . For a fixed event with , the conditional probabilities given obey all the rules of a probability model, so for example .
In plain words Once you know that has happened, the outcomes outside are out of play. Restrict attention to and ask what share of it, measured by probability, also lies in . With equally likely outcomes this is the number of outcomes in both and divided by the number in . The order matters, because divides the joint probability by , while divides it by , and these two usually differ.
Example In the visit table, , the share of long waits among the morning visits. Among the other visits it is . Reversing the condition gives
about , the share of morning visits among the long waits. The joint probability is the same in both directions, but the denominators and differ. A higher rate of long waits among morning visits in these counts describes an association. On its own it does not show that the time of day causes the longer waits.
Multiplication rule
Definition For events and with ,
and likewise when . The rule is the definition of conditional probability multiplied out, and it holds whether or not the events are independent. It extends to more events, for example when .
In plain words To find the probability that both events happen, follow a path. First happens, and then happens given that did. Each branch of a probability tree carries the conditional probability of its step, and the probability of a whole path is the product along it.
Example In the visit table, , and the reverse route gives , the same joint probability. The rule is most useful when the second step depends on the first. Draw two items without replacement from a box of items of which are defective, with each draw equally likely to be any item still in the box. Let and be the events that the first and the second item are defective. After a defective first draw, of the remaining items are defective, so
Independent events
Definition Events and are independent if
When this is equivalent to , and when it is equivalent to . If and are independent, then so are and , and , and and . Disjoint events with and are never independent, because while . An event with probability or is independent of every event.
In plain words For events with positive probabilities, independence means that learning one of them occurred leaves the probability of the other unchanged. It is a property of a probability model, justified by the mechanism that produces the outcomes, such as a separate coin and die, or checked against data. Two disjoint events with positive probabilities are strongly related, since each one rules out the other. In observed counts the product equation usually fails to hold exactly even when the process behind them is independent, so judging independence from a sample is a task for later inference lessons.
Example In the visit table, , while . The two differ, so and are not independent in this set of visits, as the comparison also shows. In a model of a fair coin and a fair die tossed independently, the probability of heads and a six is , and knowing the coin shows heads leaves the probability of a six at . The events and are disjoint, and is not , so they are not independent.
Law of total probability
Definition Let be disjoint, exhaustive events with for every . Then for every event ,
The events are disjoint with union , so the addition rule gives , and the multiplication rule turns each term into . With two groups and , where , the sum has the two terms and .
In plain words An overall rate is a weighted average of the rates within the groups, with each group weighted by its share of the population. So it lies between the smallest and the largest group rate. If the mix of groups changes, the overall rate can change even when every group rate stays the same.
Example For the visits, with the groups morning and not morning,
The two terms and are the joint probabilities in the long-wait column. If the clinic shifted to percent morning visits and the two group rates stayed at and , the overall rate would become . Whether the group rates would really stay fixed after such a change is an assumption about the clinic, not a consequence of the formula.
Check yourself
- A constructed record of orders has express orders, of which arrived late, and standard orders, of which arrived late. One order is chosen at random, with all equally likely. Find the probability that it is express and late, the probability that it is late, the probability that it is late given that it is express, and the probability that it is express given that it is late.
Show the answer
Let be the event of an express order and the event of a late one. The joint probability is , and the marginal probability is . Within the express orders, . Within the late orders,
about . The two conditional probabilities share the numerator but have different denominators, and swapping them is a common mistake. Ten percent of express orders arrived late, while about percent of late orders were express.
- In a probability model, , and . Are and independent? Are they disjoint? Find and .
Show the answer
They are independent, since . They are not disjoint, because their intersection has probability , not . The addition rule gives . Next, and , so
which equals , as the independence of and requires. Independent events with positive probabilities always overlap, so they are never disjoint.
- A factory has three machines. Machine 1 makes percent of the parts with defect rate , machine 2 makes percent with defect rate , and machine 3 makes percent with defect rate . Find the probability that a randomly chosen part is defective. Why is the answer not the simple average of the three rates?
Show the answer
Let be the event that the part is defective. The machines split the parts into three disjoint, exhaustive groups, so the law of total probability gives
The simple average would treat the machines as if each made a third of the parts. Machine 3 has the highest rate but makes only percent of the parts, so its rate gets the weight . Even so, machine 3 supplies , about , of the defect probability, which shows again that a rate within a group and a share of a total are different quantities.