S2 Chi Squared

Contingency tables
• A contingency table links together 2 variables.
• How do we know whether the data is
independent?
Contingency tables
• A contingency table links together 2 variables.
• How do we know whether the data is
independent?
Contingency tables
• Assume the totals are true.
• Use to work out expected values
Expected Values
χ2 test for independence in a
contingency table
• We can carry out a hypothesis test to see
whether the variables are independent (i.e.,
close to the expected values)
• The χ2 distribution is used, which depends on
degrees of freedom, v. v changes depending
on the size of the contingency table.
• χ2 values are calculated using the formula
for each cell.
Expected Values
Degrees of freedom
• The number of degrees of freedom is found by
the formula (m – 1)(n – 1), for an m by n table.
• The test statistic is 17.16.
• 17.16 > 12.59
• Evidence to suggest there is dependence.
Example