PDA

View Full Version : Computing Chi-square from a Contingency Table in SPSS


vicki
02-28-2009, 12:46 AM
The following table shows the number of good and defective parts produced by each work shift at a manufacturing plant. Use α = .05 to test the hypothesis that there is no significant difference between the percentage of defective parts produced by the three shifts.

1st shift 2nd shift 3rd shift
Good part 90 70 60
Defective part 10 20 20

1. First we formulate our null and alternative hypothesis.

Ho: The percentages of defective parts are independent of the shift which produced them.

(All shifts produce the same percentage of defective parts.)

Ha: The percentages are different.

2. Our selected alpha is .05.

3. Determine our rejection criteria.

We need to look up the value of χ2 in the table in the book to determine our rejection value of χ2. First we need the degrees of freedom. The degrees of freedom is the number of rows in our table(good parts and bad parts = 2) minus one, times the number of columns in our table (1st, 2nd, and 3rd shifts = 3).

df = (2 - 1)x(3 - 1) = 2

Looking in the χ2 table in the book for an alpha level of .05 and 2 degrees of freedom, we find

critical χ2 = 5.991

4. We will use SPSS to compute the test statistic (χ2) from our data. To do this we:

a. Open a new data sheet is SPSS.
b. Click on ‘variable view’.
c. Name the first variable ‘Shift’.
d. Name the second variable ‘Quality’.
e. For quality type, choose ‘String’ by clicking on the ‘Type’ column next to ‘Name’.
f. Name the third variable ‘Frequency’.
g. Click on ‘data view’.
h. In the ‘Shift’ column; enter 1 in row 1, 1 in row 2, 2 in row 3, 2 in row 4, 3 in row 5, and 3 in row 6.
i. In the ‘Quality’ column; enter good in row 1, bad in row 2, good in row 3, bad in row 4, good in row 5, and bad in row 6.
j. In the ‘Frequency’ column; enter 90 in row 1, 10 in row 2, 70 in row 3, 20 in row 4, 60 in row 5, and 20 in row 6.
Your sheet should look like:

Shift Quality Frequency
1 Good 90
1 Bad 10
2 Good 70
2 Bad 20
3 Good 60
3 bad 20

k. Okay, we are ready to start.
l. Click on ‘Data’
m. Click on ‘Weight Cases’ at the bottom of the list. You will now have a ‘Weight Cases’ dialogue box.
n. Click the button next to ‘Weight Cases by’
o. Click on your variable ‘Frequency’, then the arrow to move ‘Frequency’ to the ‘Frequency Variable’ box.
p. Click OK. You should now be back to your work sheet.
q. Click ‘Analyze’ then ‘Descriptive Statistics’, the ‘Crosstabs’.
r. You now have a ‘Crosstabs’ dialogue box.
s. Click on ‘Shift’ and move it to the ‘Rows’ box.
t. Click on ‘Quality’ and move it to the ‘Columns’ box.
u. Click on the ‘Statistics’ button and then the ‘Chi-Square’ box.
v. Click continue
w. Click the ‘Cells’ button.
x. Click in the boxes next to ‘Observed’, ‘Expected’, ‘Row’, ‘Column’, and ‘Total’.
y. Click continue and OK.

You now have the output from the chi-square test. Notice that in the bottom box ‘Chi-Square Test’, that we have a chi-square of 7.885. Our critical χ2 for this test is 5.991. Since our computed chi-square of 7.885 is greater than the critical value, we would reject Ho.