Notes on Contingency Tables, Joint/Marginal/Conditional Probabilities

Class Plan and Quick Recap

  • Today’s plan: review 4.1–4.3 for the first 10 minutes, then cover new content 4.4–4.6.

  • Quiz today on sections 3.1–3.2 (the quiz that was due Wednesday).

  • Wednesday plan: exam review for the first 1.5 hours; last 20 minutes quiz on 3.3–4.3.

  • Time management: a 10-minute Q&A session will be set up at the start; then move into new content.

  • Students asked to discuss and confirm plan: yes to proceed.

  • Schedule confirmation: quiz on 3.3–4.3 this Wednesday; exam review on Wednesday.

Questions and Concept Clarifications from the Q&A

  • Question: If two of four events (A, B, C, D) are not mutually exclusive, is the entire set not mutually exclusive?

    • Answer given: If two events are not mutually exclusive, then the whole set A, B, C, D is not mutually exclusive. The idea is that not all events can be mutually exclusive if any pair among them overlaps.

    • Analogy: batch of apples where one bad apple ruins the batch; similarly, if any pair of events overlaps, the whole set cannot be mutually exclusive.

  • Example discussed: government treasurer occurs only one time; probability relates to relative frequency.

  • Relative frequency example: a distribution where you sum certain groups to get the probability of a broader category (e.g., 180–499 acres and 180–999 acres combined).

  • Relative frequency questions: do the subcategory probabilities add to 100%? Yes (sum to 1 when using fractions of the total).

Key Concepts Introduced in This Session

  • Bivariate data: data describing two variables simultaneously.

  • Contingency table (two-way table): summarizes data from two categorical variables into a table with rows representing one variable and columns representing the other.

  • Joint probability: probability that two events occur at the same time, P(A ∩ B).

  • Marginal probability: the probability of a single event occurring, ignoring the other variable(s) (e.g., P(A) or P(B)).

  • Conditional probability: the probability of an event given that another event has occurred, P(A|B).

  • Relationship among joint, marginal, and conditional probabilities:

    • P(AB)=P(AB)P(B)=P(BA)P(A)P(A \cap B) = P(A|B) \cdot P(B) = P(B|A) \cdot P(A)

    • P(AB)=P(AB)P(B),P(BA)=P(AB)P(A)P(A|B) = \frac{P(A \cap B)}{P(B)}, \quad P(B|A) = \frac{P(A \cap B)}{P(A)}

  • Two-way table terminology: rows describe one variable (e.g., drink preference), columns describe another (e.g., time of day).

  • Totals: all cells in the table sum to the total sample size.

  • Completing missing entries in a contingency table by using row/column totals and total sample size.

  • Practical interpretation: probabilities can be expressed as fractions of the total or as percentages.

Contingency Tables: Worked Example with Tea/Coffee and Time of Day

  • Data setup (n = 30 students):

    • Tea & Morning: 8

    • Tea & Night: 4

    • Coffee & Morning: 5

    • Coffee & Night: 13

  • Row totals (Time of Day): Morning = 8 + 5 = 13; Night = 4 + 13 = 17.

  • Column totals (Drink): Tea = 8 + 4 = 12; Coffee = 5 + 13 = 18.

  • Probabilities from the table:

    • Joint probability: P(MorningTea)=8300.2667(26%),P(\text{Morning} \cap \text{Tea}) = \frac{8}{30} \approx 0.2667\, (26\%),
      because 8 students are both Morning and Tea out of 30.

    • Joint probability: P(NightCoffee)=13300.4333(43%),P(\text{Night} \cap \text{Coffee}) = \frac{13}{30} \approx 0.4333\, (43\%),
      because 13 students are Night and Coffee.

    • Marginal probability: P(Morning)=13300.4333(43.3%),P(\text{Morning}) = \frac{13}{30} \approx 0.4333\, (43.3\%),
      because 13 students are Morning (regardless of drink).

    • Marginal probability: P(Coffee)=1830=0.6(60%).P(\text{Coffee}) = \frac{18}{30} = 0.6\, (60\%).

  • Conditional probabilities (look inside the relevant subgroup):

    • Probability a randomly selected person is a Morning person who likes Tea (joint already listed): 8/30 = 0.2667.

    • Determine whether a chosen person is Night and Coffee (joint): 13/30 = 0.4333.

    • Conditional example 1: Probability of Coffee given Morning:

    • Inside the Morning group (n = 13), Coffee among them is 5.

    • P(CoffeeMorning)=5130.3846P(\text{Coffee} | \text{Morning}) = \frac{5}{13} \approx 0.3846

    • Conditional example 2: Probability of Morning given Coffee:

    • Inside the Coffee group (n = 18), Morning among them is 5.

    • P(MorningCoffee)=5180.2778P(\text{Morning} | \text{Coffee}) = \frac{5}{18} \approx 0.2778

    • Relationship intuition: For conditional probabilities, you often look inside the subset defined by the conditioning event (the denominator is the size of that subset).

  • Alternative viewpoint using the conditional probability rule:

    • Given Coffee (A) and Morning (B): A = Coffee, B = Morning.

    • Intersection: P(AB)=530P(A \cap B) = \frac{5}{30}; P(B)=1330P(B) = \frac{13}{30}.

    • So P(AB)=P(AB)P(B)=5/3013/30=513.P(A|B) = \frac{P(A \cap B)}{P(B)} = \frac{5/30}{13/30} = \frac{5}{13}.

    • This demonstrates the equivalence of the two approaches to obtain the same conditional probability.

  • Summary of conditional probability rule:

    • For any two events A and B with P(B) > 0:

    • P(AB)=P(AB)P(B).P(A|B) = \frac{P(A \cap B)}{P(B)}.

    • P(BA)=P(AB)P(A).P(B|A) = \frac{P(A \cap B)}{P(A)}.

    • Consequently, P(AB)P(BA)=P(A)P(B).\frac{P(A|B)}{P(B|A)} = \frac{P(A)}{P(B)}.

Completing a Contingency Table with Total Counts (Military Personnel Example)

  • Given a two-variable table (e.g., Marital Status vs Pay Grade) with a total of N=324,371N = 324{,}371 individuals.

  • Key procedure to fill a missing cell:

    • The sum of totals across the relevant row/column must equal N.

    • Example approach described:

    • Compute a missing cell by subtracting the sum of the known cells in the row/column from the total N.

    • Example: the missing top-right cell was found to be 117,470.117{,}470.

    • Then compute another missing cell (bottom-right) by subtracting the sums of others from N, giving 50,109.50{,}109.

  • Worked probability question from the filled table:

    • Probability of being enlisted and in a civilian marriage:

    • Intersection value given: 124{,}976 individuals.

    • P(extEnlistedCivilian Marriage)=124,976324,3710.3852(38.52%).P( ext{Enlisted} \cap \text{Civilian Marriage}) = \frac{124{,}976}{324{,}371} \approx 0.3852\, (38.52\%).

    • Probability of not being enlisted and not having a civilian marriage:

    • Identify the six cells outside both the enlisted and civilian marriage columns/rows.

    • Sum their counts, divide by total N, giving approximately 0.0564(5.64%).0.0564\, (5.64\%).

  • Observations to keep in mind:

    • The sum of probabilities across all categories must equal 1 (or 100%).

    • The explanation includes interpreting the proportions in terms of the population (not just within subgroups).

Conditional Probability: Practical Rules of Thumb

  • Goal: find P(A|B), the probability of A given B has occurred.

  • Strategy 1 (Divide within the B group):

    • Look inside the group defined by B, count how many also satisfy A, and divide by the size of the B group.

    • Example: P(Coffee | Morning) = 5/13 because among the 13 Morning people, 5 like Coffee.

  • Strategy 2 (Use A ∩ B and P(B))

    • Compute P(A ∩ B) directly, then divide by P(B).

    • Example: P(Coffee ∩ Morning) = 5/30; P(Morning) = 13/30; hence P(Coffee|Morning) = (5/30) / (13/30) = 5/13.

  • Strategy 3 (Symmetry of conditional probabilities)

    • If you know P(A) and P(B) and P(A ∩ B), you can derive P(A|B) and P(B|A) using the formulas above.

  • Important framing questions when solving problems:

    • Which event is conditioned on which? (What is A? What is B?)

    • What is the denominator? (The total relevant to the conditioning event.)

  • Practical note: The denominator in a conditional probability is the probability of the conditioning event, not the overall total.

Quick Recap of Formulas (LaTeX)

  • Joint probability:

    • P(AB)P(A \cap B)

  • Marginal probability:

    • P(A)orP(B)P(A)\quad \text{or}\quad P(B)

  • Conditional probability:

    • P(AB)=P(AB)P(B),P(BA)=P(AB)P(A)P(A|B) = \frac{P(A \cap B)}{P(B)}, \quad P(B|A) = \frac{P(A \cap B)}{P(A)}

  • Relationship between conditional probabilities and intersection:

    • P(AB)=P(AB)P(B)=P(BA)P(A)P(A \cap B) = P(A|B) \cdot P(B) = P(B|A) \cdot P(A)

  • Example values from the tea/coffee dataset:

    • P(MorningTea)=8300.2667P(\text{Morning} \cap \text{Tea}) = \frac{8}{30} \approx 0.2667

    • P(NightCoffee)=13300.4333P(\text{Night} \cap \text{Coffee}) = \frac{13}{30} \approx 0.4333

    • P(Morning)=13300.4333P(\text{Morning}) = \frac{13}{30} \approx 0.4333

    • P(Coffee)=1830=0.6P(\text{Coffee}) = \frac{18}{30} = 0.6

    • P(CoffeeMorning)=5130.3846P(\text{Coffee}|\text{Morning}) = \frac{5}{13} \approx 0.3846

    • P(MorningCoffee)=5180.2778P(\text{Morning}|\text{Coffee}) = \frac{5}{18} \approx 0.2778

Practical Takeaways for Exam Preparation

  • Be able to construct and interpret a contingency table for two categorical variables.

  • Distinguish between joint, marginal, and conditional probabilities and compute them from the table.

  • Use the conditional probability rules to compute P(A|B) and P(B|A) and to derive P(A ∩ B).

  • Learn to fill in missing cells in a two-way table using total counts by subtracting sums of known cells from the total sample size.

  • Practice converting between counts and probabilities, and be comfortable with both fractions and percentages.

  • Remember to pay attention to which event is being conditioned on which, as it changes the denominator in conditional probability.

Quick Glance: What’s Next in the Course (Reminder)

  • Today: 4.4, 4.5, 4.6 (Contingency tables, conditional probability, and the multiplication rule).

  • 3.1–3.2 quiz today (the quiz due on Wednesday).

  • Wednesday: exam review all class content; last 20 minutes quiz on 3.3–4.3.

  • Remember the emphasis on two-variable data, interpretation of joint vs marginal vs conditional probabilities, and the utility of contingency tables in summarizing data.


Class Plan and Quick Recap
  • Three quizzes not picked up last class: Aria, Roberto, and Sarai should pick up their quizzes. This ensures all students have their graded work and can review any feedback.

  • Over the weekend, a video covering sections 4.1–4.3 was assigned. The goal of this video was to introduce foundational concepts of probability, including definitions of events, sample spaces, and basic probability rules, allowing for in-class time to focus on advanced applications and clarification. Question to students: who watched it, how did they feel about clarity, any questions? This helps gauge student preparation and identify areas needing more attention.

  • Offer for a quick 10-minute Q&A session before new material today. This dedicated time provides an immediate opportunity for students to ask questions about the pre-recorded video content or previous material without delaying the main lesson.

  • Today’s plan: review 4.1–4.3 for the first 10 minutes, further solidifying understanding from the video, then cover new content 4.4–4.6. The new sections will focus on bivariate data, contingency tables, and advanced probability rules.

  • Quiz today on sections 3.1–3.2 (the quiz that was due Wednesday). This quiz assesses understanding of previously covered introductory probability concepts.

  • Wednesday plan: exam review for the first 1.5 hours, covering all material from previous weeks to prepare students thoroughly; last 20 minutes quiz on 3.3–4.3. This quiz will cover more advanced topics like counting rules and basic probability theorems.

  • Time management: a 10-minute Q&A session will be set up at the start; then move into new content. This structured approach ensures both review and new learning are accommodated efficiently.

  • Students asked to discuss and confirm plan: yes to proceed. This ensures student consensus and readiness for the planned activities.

  • Schedule confirmation: quiz on 3.3–4.3 this Wednesday; exam review on Wednesday. This reiterates important upcoming dates for students.

Questions and Concept Clarifications from the Q&A
  • Question: If two of four events (A, B, C, D) are not mutually exclusive, is the entire set not mutually exclusive?

    • Answer given: If two events are not mutually exclusive, meaning they can occur at the same time (P(AextandB)>0P(A ext{ and } B) > 0), then the whole set A, B, C, D is not mutually exclusive. For a set of events to be considered mutually exclusive, all possible pairs of events within that set must be mutually exclusive. If even one pair overlaps, the condition for the entire set is violated.

    • Analogy: batch of apples where one bad apple ruins the batch; similarly, if any pair of events overlaps, the whole set cannot be mutually exclusive. Just as one rotten apple makes the entire batch unsuitable for some uses, one overlapping pair of events means the entire collection doesn't meet the strict criteria of mutual exclusivity.

  • Example discussed: government treasurer occurs only one time; probability relates to relative frequency. When discussing the probability of a unique or specific event, like the occurrence of a single government treasurer, we often look at the relative frequency, which is the number of times the event occurred divided by the total number of observations.

  • Relative frequency example: a distribution where you sum certain groups to get the probability of a broader category (e.g., 180–499 acres and 180–999 acres combined). This demonstrates how probabilities of disjoint subcategories can be added to find the probability of a larger, encompassing category. For instance, if P(180499extacres)=0.3P(180 - 499 ext{ acres}) = 0.3 and P(500999extacres)=0.2P(500 - 999 ext{ acres}) = 0.2, then P(180999extacres)=0.3+0.2=0.5P(180 - 999 ext{ acres}) = 0.3 + 0.2 = 0.5.

  • Relative frequency questions: do the subcategory probabilities add to 100%? Yes (sum to 1 when using fractions of the total). If all possible subcategories of a variable are listed, their relative frequencies (probabilities) must sum to 100% or 1 (as a decimal) because they represent all possible outcomes within the sample space.

Key Concepts Introduced in This Session
  • Bivariate data: This refers to data that describes two different variables for each observation or individual. Unlike univariate data (which deals with a single variable), bivariate data allows for the study of relationships between two characteristics. For example, simultaneously recording a student's height and weight, or their drink preference and time of day.

  • Contingency table (two-way table): A statistical tool used to summarize and display the relationship between two categorical variables. The rows represent the categories of one variable, and the columns represent the categories of the second variable. Each cell within the table shows the frequency or count of observations that fall into a specific combination of categories from both variables.

  • Joint probability: The probability that two specific events occur at the same time. It's denoted as P(AextandB)P(A ext{ and } B) or P(AextttB)P(A exttt{\cap} B). In a contingency table, a joint probability is calculated by dividing the count in a specific cell (representing the intersection of a row category and a column category) by the total number of observations.

  • Marginal probability: The probability of a single event occurring, without considering the outcome of any other variable. It's often found in the margins (totals) of a contingency table, hence the name. For example, P(A)P(A) or P(B)P(B). It is calculated by dividing a row total or a column total by the overall total number of observations.

  • Conditional probability: The probability of an event occurring given that another event has already occurred. It is denoted as P(AextttB)P(A exttt{|} B) (the probability of A given B) or P(BextttA)P(B exttt{|} A) (the probability of B given A). The crucial aspect here is that the sample space for this probability calculation is reduced to just the outcomes where the conditioning event (B or A) has occurred.

  • Relationship among joint, marginal, and conditional probabilities:

    • The multiplication rule of probability states: P(AextttB)=P(AextttB)P(B)=P(BextttA)P(A)P(A exttt{\cap} B) = P(A exttt{|} B) \cdot P(B) = P(B exttt{|} A) \cdot P(A). This formula shows how to find the probability of both events occurring if you know one conditional probability and the marginal probability of the conditioning event.

    • The formulas for conditional probability are derived from the multiplication rule:

      • P(A exttt{|} B) = \frac{P(A \texttt{\cap} B)}{P(B)}, where P(B)>0P(B) > 0. This means the probability of A given B is the joint probability of A and B, divided by the marginal probability of B.

      • P(B exttt{|} A) = \frac{P(A \texttt{\cap} B)}{P(A)}, where P(A)>0P(A) > 0. Similarly, the probability of B given A is the joint probability of A and B, divided by the marginal probability of A.

  • Two-way table terminology: rows describe one variable (e.g., drink preference), columns describe another (e.g., time of day). The labels for rows and columns clearly define the categories for each variable, making the table easy to interpret.

  • Totals: all cells in the table sum to the total sample size. The grand total in the bottom-right corner represents the total number of observations. Row totals show the marginal frequencies for the row variable, and column totals show marginal frequencies for the column variable.

  • Completing missing entries in a contingency table by using row/column totals and total sample size. Since row totals are the sum of values in that row and column totals are the sum of values in that column, missing values can be found through simple subtraction or addition, working from the known totals.

  • Practical interpretation: probabilities can be expressed as fractions of the total or as percentages. For clarity, it's often useful to present probabilities as decimals or percentages, especially when communicating findings to a broader audience.

Contingency Tables: Worked Example with Tea/Coffee and Time of Day
  • Data setup (n = 30 students): A survey of 30 students recorded their preferred drink (Tea or Coffee) and their preferred time to consume it (Morning or Night). This forms the basis of our contingency table.

    • Tea & Morning: 8 students (joint count)

    • Tea & Night: 4 students (joint count)

    • Coffee & Morning: 5 students (joint count)

    • Coffee & Night: 13 students (joint count)

  • Row totals (Time of Day): Morning = 8+5=138 + 5 = 13 students; Night = 4+13=174 + 13 = 17 students. These represent the marginal frequencies for morning and night preferences.

  • Column totals (Drink): Tea = 8+4=128 + 4 = 12 students; Coffee = 5+13=185 + 13 = 18 students. These represent the marginal frequencies for tea and coffee preferences.

  • Probabilities from the table:

    • Joint probability: P(\text{Morning} \texttt{\cap} \text{Tea}) = \frac{8}{30} \approx 0.2667 \text{ (or } 26.67\%),
      because 8 students are both Morning and Tea out of the total 30 students. This represents the proportion of the entire student body that prefers tea in the morning.

    • Joint probability: P(\text{Night} \texttt{\cap} \text{Coffee}) = \frac{13}{30} \approx 0.4333 \text{ (or } 43.33\%),
      because 13 students prefer coffee at night out of the total 30. This is the proportion of the entire student body preferring coffee at night.

    • Marginal probability: P(Morning)=13300.4333 (or 43.33%),P(\text{Morning}) = \frac{13}{30} \approx 0.4333 \text{ (or } 43.33\%),
      because