Georgetown University Seal

Department of Psychology

Students walking across lawn.

Chi Square: Two Way

Two-way chi square

What is it?

A two-way chi square differs on one independent variable and is measured on a dependent variable. For example, males and females (independent variable: gender) are asked whether which candidate they will vote for (dependent variable: candidate preference).

 


 

 

Calculation:

First, set up a table:

Observed squirrel movement based on food thrown on Healy Lawn:

Notice that the squirrels differ in one dimension: whether they ran towards or away from the food.

  Peanut Banana Hamburger Row Totals
Ran towards the food 15 7 4 26
Ran away from the food 2 6 12 20
Column Totals 17 13 16 Grand Total: 46

It would appear that squirrels prefer peanuts and don’t like hamburgers. However, because 46 squirrels is only a random sample of the overall squirrel population, we need to test the null hypothesis to see if this is true for all squirrels.

Second, calculate expected frequencies: Multiply the associated row total by the associated column total and divide by the grand total. Below is the table of the expected frequencies:

  Peanut Banana Hamburger
Ran towards (26*17)/46 = 9.6 (26*13)/46= 7.4 (26*16)/46= 9.0
Ran away ((20*17)/46= 7.4 (20*13)/46= 5.7 (20*16)/46= 6.0

And now, apply the chi square formula

The formula has to be applied separately for each cell because the expected outcomes are different for each cell:

Towards/peanut: 3.04
Away/peanut: 3.94
Towards/Banana: .022
Away/Banana: .016
Towards/Hamburger: 2.78
Away/Hamburger, 3.57
Sum: 13.37

The observed value of chi square is 13.37. Now we need to determine whether this is significant:

Determine degrees of freedom:

Df= (number of rows - 1)(number of columns – 1) = 2

Compare the observed value of the chi square with the critical value of chi square. For two degrees of freedom, the critical value at the .05 level is 5.991.

If the observed value of chi square is greater than the critical value, reject the null hypothesis; otherwise, do not reject it. Since 13.37 is greater than 5.991, we can reject the null hypothesis and conclude that the differences are statistically significant because chances are that our results did not occur by chance.


Computation:

Excel:

1. Enter data into cell


Unfortunately, you have to enter both actual and expected (calculated)
TIP: when entering expected, enter like this:
(for example) In cell B9, enter “= ($E$3*B5) / $E$5”
Click and drag for the other five cells. The $ sign means that it keeps those values the same, while changing the other ones relative to the location of the original formula entered (in cell B9).


2. In an empty cell, type the following: “=CHITEST(actual_range,expected_range).

3. After you enter the first parenthesis, you can click and drag around the “actual” data table; which in this example would be b3:d4

4. Enter a comma, and then repeat the process for the expected range—again, click and drag if you want; in this example you’d drag from b9:d10

5. Close parentheses

6. The empty cell will give you your p value. If it is less than .05, you may reject the null hypothesis. If it is greater than .05, you must accept the null hypothesis. 

 

SPSS:

1. Go to ANALYZE > DESCRIPTIVE STATISTICS > CROSS TABS

2. Select independent and dependent variables (a good rule of thumb is to enter the variable with more measurement levels in “rows.”)

3. Go to STATISTICS > CHI-SQUARED (BOX) > CONTINUE > OK

4. Look at your output window.

5. The first table shows the number of participants in each cell.

6. The second table is the outcome of the test. The “Pearson Chi-Square” is the result you want to look at.

7. “Value” is the value of the chi square test statistic

8. “df” is the degrees of freedom

9. “Asymp. Sig. (2-sided) is the alpha (the probability value) of the test statistic. If it is smaller than .05, you can reject the null hypothesis. If it is greater than .05, you shold accept the null hypothesis.


Back to Inferential Statistics

 



References:

Patten, Mildred L. (2002). Understanding research methods: An Overview of the essentials (3rd ed.). Los Angeles: Pyrczak Publishing.

Pavkov, Thomas W., & Pierce, Kent A. (2003). Ready, set, go! A Student guide to SPSS(R) 11.0 for Windows. Boston: McGraw-Hill.

Pyrczak, Fred. (2002). Success at statistics: A Worktext with humor (2nd ed.). Los Angeles: Pyrczak Publishing.

Solso, Robert L., Johnson, Homer H., & Beal, M. Kimberly. (1998). Experimental psychology: a case approach (6th ed.). New York: Longman.

 

 

Box 571001
White-Gravenor Hall 306 Washington, DC 20057-1001
Phone (202) 687-4042
Fax (202) 687-6050
Georgetown College Nameplate