Two-Way Table: A table showing the frequency distribution of two categorical variables.
Marginal Frequency: The total frequency for each row and column.
Marginal Relative Frequency: Marginal frequency divided by total sample size.
- Identify the two categorical variables
- Create rows for one variable and columns for the other
- Fill in the cell frequencies
- Calculate row totals and column totals
- Calculate marginal relative frequencies
Row totals: Male = 60 + 40 = 100, Female = 50 + 50 = 100
Column totals: Pizza = 60 + 50 = 110, Sandwiches = 40 + 50 = 90
Grand total = 200 ✓
Male: 100/200 = 0.50 or 50%
Female: 100/200 = 0.50 or 50%
Pizza: 110/200 = 0.55 or 55%
Sandwiches: 90/200 = 0.45 or 45%
Equal gender distribution (50% each)
Pizza is more popular than sandwiches (55% vs 45%)
The two-way table shows equal gender distribution with pizza being more popular than sandwiches.
Marginal relative frequencies: 50% male, 50% female, 55% pizza, 45% sandwiches.
• Marginal Relative Frequency: Category total ÷ Grand total
• Table Verification: Row totals and column totals must match grand total
• Percentage Calculation: Decimal × 100%
Conditional Relative Frequency: The relative frequency of one variable given a specific value of another variable.
Formula: Cell frequency ÷ Row/column total for the condition.
Given male, probability of preferring pizza = 60/100 = 0.60 or 60%
Given male, probability of preferring sandwiches = 40/100 = 0.40 or 40%
Given female, probability of preferring pizza = 50/100 = 0.50 or 50%
Given female, probability of preferring sandwiches = 50/100 = 0.50 or 50%
Percentage of males who prefer pizza: 60%
Percentage of females who prefer sandwiches: 50%
Males: 60% pizza, 40% sandwiches
Females: 50% pizza, 50% sandwiches
Males are more likely to prefer pizza than females
60% of males prefer pizza.
50% of females prefer sandwiches.
There appears to be a difference in lunch preferences by gender.
• Conditional Relative Frequency: Cell frequency ÷ Row total (for row condition)
• Association Detection: Compare conditional frequencies across categories
• Row Totals: Use for conditioning on row variable
Association: A relationship between two variables where knowing the value of one variable provides information about the value of the other.
Independence: No relationship exists between variables.
Given participates in sports: Job = 80/120 = 0.667 or 66.7%
Given participates in sports: No job = 40/120 = 0.333 or 33.3%
Given doesn't participate in sports: Job = 120/180 = 0.667 or 66.7%
Given doesn't participate in sports: No job = 60/180 = 0.333 or 33.3%
Sports participants: 66.7% have jobs, 33.3% don't
Non-participants: 66.7% have jobs, 33.3% don't
The conditional frequencies are identical!
Since the conditional relative frequencies are the same for both groups, there is no association between sports participation and having a part-time job.
The variables appear to be independent.
There is no association between sports participation and having a part-time job.
The conditional relative frequencies are identical for both groups.
The variables appear to be independent.
• Association Detection: Compare conditional frequencies across categories
• Independence: Identical conditional frequencies suggest independence
• Conditional Frequency: Cell frequency ÷ Row/column total
Two-Way Table: A table displaying the frequency distribution of two categorical variables.
Marginal Frequency: The totals for each row and column.
Conditional Frequency: The frequency of one variable given a specific value of another.
Joint Frequency: The frequency in each individual cell.
• Marginal Relative Frequency = Category Total ÷ Grand Total
• Conditional Relative Frequency = Cell Value ÷ Row/Column Total
• Joint Relative Frequency = Cell Value ÷ Grand Total
• Association exists when conditional frequencies differ significantly
Relative Frequency: The proportion of the total that falls into a particular category.
Joint Relative Frequency: Individual cell value divided by grand total.
Democrats: 150/400 = 0.375 or 37.5%
Republicans: 160/400 = 0.400 or 40.0%
Independents: 90/400 = 0.225 or 22.5%
Young Adults: 100/400 = 0.250 or 25.0%
Middle-aged: 180/400 = 0.450 or 45.0%
Older Adults: 120/400 = 0.300 or 30.0%
Young Democrat: 50/400 = 0.125 or 12.5%
Middle Republican: 80/400 = 0.200 or 20.0%
And so on for all cells
Republicans are the most common affiliation (40%)
Middle-aged adults are the largest age group (45%)
Young adults show more balanced party affiliation
The relative frequency of each political affiliation is:
Democrats: 37.5%, Republicans: 40.0%, Independents: 22.5%
Republicans are the most common political affiliation.
• Marginal Relative Frequency: Column total ÷ Grand total
• Joint Relative Frequency: Cell value ÷ Grand total
• Verification: All relative frequencies sum to 1
Academic Performance: Categorical variable with two outcomes (pass/fail).
Association Strength: Measured by comparing conditional probabilities.
Given regular tutoring: Pass = 150/200 = 0.75 or 75%
Given regular tutoring: Fail = 50/200 = 0.25 or 25%
Given no regular tutoring: Pass = 180/300 = 0.60 or 60%
Given no regular tutoring: Fail = 120/300 = 0.40 or 40%
Regular tutoring: 75% pass, 25% fail
No regular tutoring: 60% pass, 40% fail
There's a 15% difference in pass rates!
Students who attend tutoring regularly have a higher pass rate (75% vs 60%)
This suggests a positive association between tutoring attendance and academic success
There is a strong association between tutoring attendance and academic performance.
Students attending tutoring regularly have a 75% pass rate compared to 60% for those not attending regularly.
This suggests that attending tutoring is beneficial for academic success.
• Association Detection: Compare conditional relative frequencies
• Strength of Association: Larger differences indicate stronger association
• Causation vs Correlation: Association doesn't imply causation
Complete Summary: Two-Way Tables and Relative Frequencies
Two-Way Table: Displays frequency distribution of two categorical variables.
Marginal Frequency: Totals for each row and column.
Conditional Frequency: Frequency of one variable given a specific value of another.
Joint Frequency: Frequency in each individual cell.
Table Structure: Rows represent one variable, columns represent another.
Total Verification: Row totals and column totals must equal grand total.
Frequency Types: Marginal, conditional, and joint frequencies.
Association Detection: Compare conditional frequencies across categories.
Step 1: Identify two categorical variables.
Step 2: Create table with rows for one variable and columns for the other.
Step 3: Fill in cell frequencies.
Step 4: Calculate row and column totals.
Step 5: Calculate various types of relative frequencies.
Independence: Conditional frequencies are similar across categories.
Association: Conditional frequencies differ significantly.
Strength: Greater differences indicate stronger association.
Direction: Positive or negative relationship.
Two-Way Table: A contingency table that displays the frequency distribution of two categorical variables simultaneously.
Marginal Relative Frequency: The proportion of the total sample that belongs to a particular category of one variable.
Conditional Relative Frequency: The proportion of a subset (row or column) that falls into a particular category.
Joint Relative Frequency: The proportion of the total sample that falls into a specific combination of categories.
Association: A relationship between two variables where knowledge of one variable provides information about the other.
- Construct Table: Organize data into two-way table format.
- Calculate Totals: Find row totals, column totals, and grand total.
- Calculate Relative Frequencies: Compute marginal, conditional, and joint frequencies.
- Analyze Patterns: Compare conditional frequencies to detect associations.
- Draw Conclusions: Interpret results in context of the problem.
• Marginal Relative Frequency = Category Total ÷ Grand Total
• Conditional Relative Frequency = Cell Value ÷ Row/Column Total
• Joint Relative Frequency = Cell Value ÷ Grand Total
• Association exists when conditional frequencies differ significantly
Questions & Answers
Question: What's the difference between marginal, conditional, and joint relative frequencies? They all seem similar.
Answer: Great question! Here's how they differ:
Marginal Relative Frequency:
- Proportion of the total sample in a single category
- Example: Overall percentage of males in the sample
- Formula: Row/Column total ÷ Grand total
Conditional Relative Frequency:
- Proportion within a specific subgroup
- Example: Percentage of males who prefer pizza (given that they're male)
- Formula: Cell value ÷ Row/Column total (for condition)
Joint Relative Frequency:
- Proportion of the total sample in a specific combination of categories
- Example: Percentage of the total sample that is male AND prefers pizza
- Formula: Cell value ÷ Grand total
Conditional frequencies are key for detecting associations between variables.
Question: How do I know if two variables are independent based on a two-way table? What exactly does independence mean?
Answer: Independence means that knowing the value of one variable gives no information about the value of the other variable.
Testing Independence:
Compare conditional relative frequencies across different categories. If the conditional frequencies are the same (or very similar), the variables are independent.
Example:
- If 60% of males prefer A and 60% of females prefer A, then gender and preference are independent
- If 80% of males prefer A but only 30% of females prefer A, then gender and preference are dependent
Mathematical Definition:
Variables X and Y are independent if P(Y=y|X=x) = P(Y=y) for all values x and y.
This means the conditional probability equals the marginal probability.
Question: In Exercise 5, you said there's an association between tutoring and grades, but does that mean tutoring causes better grades?
Answer: This is a crucial distinction in statistics:
Association vs. Causation:
Association: Variables tend to occur together (correlation)
Causation: One variable directly causes changes in another
Confounding Variables:
Students who attend tutoring might be more motivated, spend more time studying, or have better study habits - these could explain the grade difference.
Establishing Causation:
- Requires controlled experiments
- Must eliminate confounding variables
- Needs to establish temporal order (cause before effect)
- Should show a dose-response relationship
We can say tutoring is associated with better grades, but we cannot conclude tutoring causes better grades without a controlled experiment.