Test of Independence Tests the claim that the two variables related. For example: each sample (incident) was classified by the type of crime and the victim Does the type crime committed depend on or influenced by the relationship to the victim? HomicideRobberyForgery Stranger Acquaintance
Example: Test of Homogeneity Test the claim that different populations have the same proportions of some characteristics For example: each student in out sample was classified by their grade and favorite subject Do upper and lower classmen like the same subjects at the same percentages? MathEnglishSocial Studies ScienceOther Under Upper
Contingency Table Each sample is characterized by two variables; each variable has at least two possible values The table lists the individual frequencies for every combination of values. –One variable is used to categorize rows. –A second variable is used to categorize columns. HomicideRobberyForgery Stranger Acquaintance
Independence
Independence, again
Test Procedure Compare a test statistics with a critical value Critical values from the Chi-squared table Test statistic is a sum of calculations in the Observed and Expected values Observed values are the sample data Expected values are what we should have seen if our claim was true
Expected Value For each cell we need the expected number For every cell in the contingency table, the expected frequency E should be at least 5. –There is no requirement that every observed frequency must be at least 5.
Example HomicideRobberyForgeryRow total Stranger12 (29.37) 378 (284.67) 726 (803.43) 1116 Acquaintance38 (21.07) 105 (200.36) 641 (565.57) 784 Column total
Test of Independence Test Statistic Test statistic: add up the difference ratio for each cell Critical Values –Found in Table A-4 –Degrees of freedom = (r - 1)(c - 1) –r is the number of rows and c is the number of columns Tests of Independence are always right-tailed. X 2 = ( O - E ) 2 E
Example HomicideRobberyForgeryRow total Stranger12 (29.37) [10.27] 378 (284.67) [31.28] 726 (803.43) [7.27] 1116 Acquaintance38 (21.07) [15.26] 105 (200.36) [44.44] 641 (565.57) [10.33] 784 Column total
Test Statistic Test statistic: X 2 = = Critical value: X 2 = (from Table A-4) α = 0.05 ( r -1) ( c -1) = (2 -1) (3 -1) = 2 degrees of freedom
0 Reject Independence Fail to Reject Independence Comparing the values H 0 : variables are independent H 1 : variables are dependent
Caveat This procedure cannot be used to establish a direct cause-and-effect link between variables in question. –Dependence means only there is a relationship between the two variables.
Example: Test of Homogeneity Do upper and lower classmen like the same subjects at the same percentages? MathEnglishSocial Studies ScienceOther Under Upper
0 = 0.05 Reject Sameness Fail to Reject Sameness Comparing the values H 0 : proportions are the same H 1 : proportions are different
Your turn Is political party affiliation dependent on gender? DemocratIndependentRepublican Female Male241113
Your turn Do males and females like the same subjects? ArtsEngFoodLangMathPESciSoc Female Male
1.Enter table into matrix 2.STAT->TEST->χ 2 -Test… 3.Data matrix into Observed 4.‘Empty’ matrix into Expected 5.Select Calculate 6.Read test statistic and/or p-value