Datasets with counts 150 people were surveyed about their softdrink preferences. They were asked, “Do you prefer coke, pepsi, or sprite?”. 50 people said “coke”. 70 people said “pepsi”. 30 people said “sprite”. Test the hypothesis that people differ in their soda preferences. Solution: H 0 : p pepsi = p coke =p sprite =1/3 H A : not all p’s are equal Use a one-way chi-square test. PepsiCokeSprite
One-way Chi-Square Test ( 2 ) Used when your dependent variable is counts within categories (# pepsi lovers, # coke lovers, # sprite lovers) Used when your DV has two or more mutually exclusive categories Compares the counts you got in your sample to those you would expect under the null hypothesis Also called the Chi-Square “Goodness of Fit” test.
One-way 2 example Which power would you rather have: flight, invisibility, or x-ray vision? FlightInvisibilityX-ray vision 18 people14 people10 people Is this difference significant, or is just due to chance?
One-way 2 example H 0 : p fly = p invis = p xray = 1/3 H A : not all p’s are equal FlightInvisibilityX-ray vision f o = 18f o = 14f o = 10 Step 1: Write hypotheses Step 2: Write the observed frequencies, and also the frequencies that would be expected under the null hypothesis N=42
One-way 2 example FlightInvisibilityX-ray vision f o = 18 f e = 14 f o = 14 f e = 14 f o = 10 f e = 14 H 0 : p fly = p invis = p xray = 1/3 H A : not all p’s are equal Step 1: Write hypotheses Step 2: Write the observed frequencies, and also the frequencies that would be expected under the null hypothesis N=42
One-way 2 example FlightInvisibilityX-ray vision f o = 18 f e = 14 f o = 14 f e = 14 f o = 10 f e = 14 N=42 Step 3: Compute the relative squared discrepancies And sum them up
One-way 2 example FlightInvisibilityX-ray vision f 0 = 18 f e = 14 f 0 = 14 f e = 14 f 0 = 10 f e = 14 N=42 Step 4: Compare to critical value of Retain null!
Steps: 1) State hypotheses 2) Write observed and expected frequencies 3) Get 2 by summing up relative squared deviations 4) Use Table I to get critical 2 Calculating one-way 2
Practice Suppose we ask 200 randomly selected people if they think that voting should be made compulsory. The data come out like this: NoYes f o = 84f 0 = 116 Is there evidence for a clear preference?
Practice Suppose we ask 200 randomly selected people if they think that voting should be made compulsory. The data come out like this: NoYes f 0 = 84f 0 = 116 f e =100 Reject null!
we tested H 0 that all cell frequencies are equal But can test any expected frequencies example – political affiliation among psych grad students: DemocratRepublicanIndependent 9518 political affiliation in the U.S. (Gallup): DemocratRepublicanIndependent 46%43%11% Other null hypotheses
DemocratRepublicanIndependent f o = 9 f e = 14.7 f o = 5 f e = 13.8 f o = 18 f e = 3.5 N=32 Is the distribution for psych grad students different than the distribution for the U.S.? If not, then 46% of the 32 students would be Democrats, 43% would be republican, and 11% would be independent Reject null!
Points of interest about 2 2 cannot be negative 2 will be zero only if each observed frequency exactly equals the expected frequency 3.The larger the discrepancies, the larger the 2 4.The greater the number of groups, the larger the 2. That’s why 2 distribution is a family of curves with df = k-1.
Two Factor Chi-Square A 1999 New Jersey poll sampled people’s opinions concerning the use of the death penalty for murder when given the option of life in prison instead. 800 people were polled, and the number of men and women supporting each penalty were tabulated. Preferred Penalty Death PenaltyLife in PrisonNo Opinion Female Male Contingency table: shows contingency between two variables Are these two variables (gender, penalty preference) independent??
Two-Factor Chi-Square Test Used to test whether two nominal variables are independent or related E.g. Is gender related to socio-economic class? Compares the observed frequencies to the frequencies expected if the variables were independent Called a chi-squared test of independence Fundamentally testing, “do these variables interact”?
Example A 1999 New Jersey poll sampled people’s opinions concerning the use of the death penalty for murder when given the option of life in prison instead. 800 people were polled, and the number of men and women supporting each penalty were tabulated. Preferred Penalty Death PenaltyLife in PrisonNo Opinion Female Male H 0 : distribution of female preferences matches distribution of male preferences H A : female proportions do not match male proportions
Example Preferred Penalty Death PenaltyLife in PrisonNo Opinion Femalef 0 = 151 f e = ___ f 0 = 179 f e = ___ f 0 = 80 f e = __ Malef 0 = 201 f e = ___ f 0 = 117 f e = ___ f 0 = 72 f e = __
Example Preferred Penalty Death PenaltyLife in PrisonNo Opinion Femalef 0 = 151 f e = 133.3? f 0 = 179 f e = 133.3? f 0 = 80 f e = 133.3? Malef 0 = 201 f e = 133.3? f 0 = 117 f e = 133.3? f 0 = 72 f e = 133.3? WRONG -- this is saying there is an equal # of men and women, and an equal preference for prison sentences (e.g. no main effects). We are willing to let there be main effects. We just want to test whether the distribution of preferences for men and women is the same (e.g. no interaction effects)
Example Preferred Penalty Death PenaltyLife in PrisonNo Opinion Femalef 0 = 151 f e = ___ f 0 = 179 f e = ___ f 0 = 80 f e = __ Malef 0 = 201 f e = ___ f 0 = 117 f e = ___ f 0 = 72 f e = __ We need to look at the marginal totals to get our expected frequencies
Example Preferred Penalty Death PenaltyLife in PrisonNo Opinionf row Femalef 0 = 151 f e = ___ f 0 = 179 f e = ___ f 0 = 80 f e = __ 410 Malef 0 = 201 f e = ___ f 0 = 117 f e = ___ f 0 = 72 f e = __ 390 f col n = 800
Example Preferred Penalty Death PenaltyLife in PrisonNo Opinionf row Femalef 0 = 151 f e = ___ f 0 = 179 f e = ___ f 0 = 80 f e = __ 410 Malef 0 = 201 f e = ___ f 0 = 117 f e = ___ f 0 = 72 f e = __ 390 f col 352 p death = p life = p none =.19 n = 800
Example Preferred Penalty Death PenaltyLife in PrisonNo Opinionf row Femalef 0 = 151 f e =.44(410) f 0 = 179 f e =.37(410) f 0 = 80 f e =.19(410) 410 Malef 0 = 201 f e =.44(390) f 0 = 117 f e =.37(390) f 0 = 72 f e =.19(390) 390 f col 352 p death = p life = p none =.19 n = 800
Example Preferred Penalty Death PenaltyLife in PrisonNo Opinionf row Femalef 0 = 151 f e =180.4 f 0 = 179 f e =151.7 f 0 = 80 f e = Malef 0 = 201 f e =171.6 f 0 = 117 f e =144.3 f 0 = 72 f e = f col 352 p death = p life = p none =.19 n = 800 Reject null!
Steps: 1) State hypotheses 2) Get expected frequencies 3) Get 2 by summing up relative squared deviations 4) Use table to get critical 2 Calculating two-way 2
Practice Suppose we want to determine if there is any relationship between level of education and medium through which one follows current events. We ask a random sample of high school graduates and a random sample of college graduates whether they keep up with the news mostly by reading the paper or by listening to the radio or by watching television. radiopaperTV HS college244432
Practice radiopaperTVf row HSf o =10 f e =17 f o =29 f e =36.5 f o =61 f e = collegef o =24 f e =17 f o =44 f e =36.5 f o =32 f e = f col 34 p radio = p paper = p TV =.465 N=200 = df = (2)*(1) = 2
Assumptions of Chi-Square Test 1. Categories are mutually exclusive –A subject cannot be counted in more than one cell 2. Expected frequency in each cell must be –at least 10 when k A and k B are less than or equal to 2 –at least 5 when k A or k B is greater than 2 (e.g., a 2x3 design) –N must be sufficiently large to ensure that this is true