We use a contingency table to represent the probabilities of two events, A and B, which may or may not be independent. For example, event A could be that Ronit does all of her homework and event B is that Ronit passes her first quiz. The contingency table might look like this:
In the contingency table, an important square is the intersection of A and B. This is the probability of the event (A and B), which in this example is 0.4, or 40 percent. The upper-left corner gives the probability of event B occurring without event A, which in this example is 0.3, or 30 percent.
The lower-left corner gives the probability that neither A nor B occurs, which is 20 percent in this example. Finally, at the intersection of A and Bc we have event A occurring without event B occurring, which in this example is a 10 percent probability.
Overall, event A has a probability of 0.5, which is the column sum under the A column. Event B has a probability of 0.7 (70 percent), which is the sum of row B.
Some important relationships are visible in the contingency table. In particular:
Often, you are given information in a contingency table that is incomplete. You can use these relationships to fill in the rest of the information.
You can use the information in a contingency table to test for statistical independence. In particular, compare P(A and B) with P(A)P(B). In the example above, P(A and B) is 0.4, which is greater than P(A)P(B) = (0.5)(0.7) = .35, which means that A and B are positively related. In words, Ronit getting a passing grade on the test is positively related to her doing her homework.When P(A and B) is less than P(A)P(B), then the two events are negatively related. When P(A and B) = P(A)P(B), the two events are statistically independent. Conditional Probability
Conditional probability is an invisible component of a contingency table. It can easily be calculated from the table.
The conditional probability of B given A, written as P(B|A) = P(A and B)/P(A). In the example, P(B|A) = .4/.5 = .8, or 80 percent.
The conditional probability of A given B, written as P(A|B) = P(A and B)/P(B). In the example, P(B|A) = .4/.7 = .43, or 43 percent.
Sometimes, you will be given three pieces of information: P(A), P(B), and P(B|A). You can use this information to fill out the entire contingency table.