Example for calculating chi square

From Practical Statistics for Educators
Jump to: navigation, search

Let us assume that 200 residents of a college dormitory major in business, liberal arts, or engineering. Is the variable, major, related to the number of hours spent studying per week on the average for a three-week period? The null hypothesis would state that major is not related to the number of hours studying. This is a situation in which the theoretical or expected frequencies must be computed from the distribution.


Number of hours spent studying: Observed


Major None 1-15 More than 15 Total
Business 6 60 14 80
Liberal Arts 14 58 8 80
Engineering 10 22 8 40
Total 30 140 30 200


Step One: Computing the Expected Frequencies

For each cell in the table, the expected frequency must be calculated.

 The expected frequency for a given column is the column total divided by n, the sample size.

 The expected frequency for a given row is the row total divided by n.

 The expected frequency for a cell is the column expectation times the row expectation times n.

 This formula reduces to the expected frequency for a given cell equaling its row total times its column total, divided by n.

Number of hours spent studying per week: Calculating Expected


Major None 1-15 More than 15 Business (30)(80) / 200 (140)(80) / 200 (30)(80) / 200 Liberal Arts (30)(80) / 200 (140)(80) / 200 (30)(80) / 200 Engineering (30)(40) / 200 (140)(40) / 200 (30)(40) / 200



Number of hours spent studying per week: Observed (Expected)


Major None 1-15 More than 15 Total Business 6 (12) 60 (56) 14 (12) 80 Liberal Arts 14 (12) 58 (56) 8 (12) 80 Engineering 10 (6) 22 (28) 8 (6) 40 Total 30 140 30 200



Step Two: Application of the Chi-Square Formula

 Let O be the observed value of each cell in a table.

 Let E be the expected value calculated in the previous step.

 For each cell, subtract E from O, then square the result and then divide by E.

 Do this for every cell and sum all the results. This is the chi-square value for the table.


Number of hours spent studying per week: Calculating X2


Major None 1-15 More than 15 Business (6-12)2 / 12 = 3 (60-56)2 / 56 = .29 (14-12)2 / 12 = .33 Liberal Arts (14-12)2 / 12 = .33 (58-56)2 / 56 = .07 (8-12)2 / 12 = 1.33 Engineering (10-6)2 / 6 = 2.67 (22-28)2 / 28 = 1.29 (8-6)2 / 6 = .67


X2 = 3 + .29 + .33 + .33 + .07 + 1.33 + 2.67 + 1.29 + .67 X2 = 9.98


Step Three: Calculate the Degrees of Freedom

The chi-square value is not interpretable directly but must be compared to a table of the chi-square distribution.

 The columns of the table of the chi-square distribution are alternative significance levels (.001, .01, .05) and the rows are degrees of freedom (df).

 For a table, df = (r - 1)(c - 1), where r is the number of rows and c is the number of columns.

 That is, if you know the column and row totals, when all cells are filled in except one row and one column, these may be calculated from the information already given.

df = (rows - 1)(columns - 1) df = (3-1)(3-1) = (2)(2) = 4


Step Four: Using the Chi-Square Table

A chi-square table, which in effect is built into statistical software packages, gives a critical value.

 The calculated chi-square value must be greater than the critical value to reject the null hypothesis that the row variable is unrelated to the column variable, at the level of significance selected by reading down the appropriate column in the chi-square table (ex., the .05 significance column).

X2 critical values for 4 degrees of freedom

p < .01 critical value is 13.28

p < .05 critical value is 9.49

X2 = 9.98


The test indicates that there is a significant relationship between major and number of cigarettes smoked at the .05 but not at the .01 level of significance.

 In practice, computer programs (SPSS) are used in place of chi-square tables, and computer printout shows the significance level (often labeled p) directly, but the interpretation is the same.


contributed by Karen Burke, EdD; modified by Frank LaBanca, EdD