We are now going to learn to calculate a one-way chi-square in SPSS
For this example, we are going to assume that the observed values do not differ from randomness
or that there is no preference among the choices.
This is The House of Pigs Chi-Square.
We are using the data set BuildingPermit.sav and you need to open this data set in SPSS.
The data set contains the results of building permits for 70 little pigs.
A house inspector randomly samples building permits pulled by 70 little pigs who were building houses
to determine whether a pattern exists in the material that the little pigs chose for housing construction.
The permits are categorized based upon whether the little pigs apply to build their houses out of straw,
sticks, or brick and mortar. Our research question is: Are the building materials preferred equally?
Now, before we begin using SPSS. I would like to point out a few things about this data set. First, go to "Variable View."
Notice that we have one nominal and one scale variable. The scale variable is
actually a number of counts, so we will need to address that before we can run the chi-square in SPSS.
Go to "Data View"
You will notice that this is a very small data set.
The nominal variable called Material contains the values 1, 2, and 3.
And you can click on this icon to toggle those variable labels on and off.
The numbers represent the categories of building material where 1 = Straw,
2 = Sticks, and 3 = Brick and Mortar.
Now we cannot run any kind of test with these values because we do not have raw data.
There's nothing to add up or average. All that we have here are counts
So we have to let SPSS know how to handle these data.
What we will do is to weight these categories by their respective counts.
Go to "Data"
"Weight Cases"
We will weight the cases by the number of permits.
Click on "Weight cases by" and then move Permits into the "Frequency Variables" box,
and now click OK. From now on any analysis that we run will be weighted by the number of cases.
So now we are ready to conduct the chi-square. Now, there's actually more than one way to run a chi-square.
I'm going to show you the way it was originally done in SPSS because the menus will be more familiar
Go to "Analyze"
"Nonparametric Tests"
"Legacy Dialog"
"Chi-Square"
Begin by moving the variable Material into the "Test Variable List."
Under "Expected Values", notice that by default the expected values assume all
categories equal. This is exactly what we want.
Now click on "Options"
select "Descriptives" and now click "Continue" and OK.
The output window pops up.
Let me show you how to interpret these data.
Your goal here is to make sure that the data look right.
We thought that there would be 70 permits, and there were so that's okay.
The minimum was 1 and the maximum was 3, so we don't have any data entry errors.
The mean and standard deviation, however, are worthless because we are analyzing nominal data
The mean of the three categories doesn't tell us anything.
Here we see the observed values that we entered and
the expected values
Each expected value is the same because we assume that the occurrences are random, and there is no preference for any particular building material
The residual value here is the same as the O - E column that we saw when we did this test by hand
The largest residual value is 9.7 for Bricks and Mortar,
meaning that it differs the most from the expected.
Here in the "Test Statistics"
we see the chi-square value is 6.543
And the probability of getting that chi-square if the null hypothesis is true is .038,
which is >0.05,
so these data are different than random. There is a preference for one of the building materials, and
notice, too, that none of the cells have expected frequencies less than 5.
That's good news, and it meets the assumptions for the chi-square test
Here is a sample APA write-up for the one way chi-square goodness-of-fit test that we just conducted.
Notice that I included the observed values for each group, and I concluded
permits for brick and mortar construction differed statistically significantly from permits for sticks or straw.
Chi-square with two degrees of freedom. N = 70
= 6.54. p =.038
Cramer's V = .31
indicating that the pigs preferred brick and mortar construction, presumably for its resilience to lupus induced tempests.
The Cramer's V is an effect size which I cover in another video about effect sizes for chi-square
Now before we conclude let me show you one more technique for conducting this test.
This is the really easy way, although, not my favorite way. Let's go to the Analyze menu
Choose "Analyze"
"Nonparametric Tests"
"One-Sample"
Now here, you don't have to do anything. Just click "Run".
The dialog box pops up telling you that you are comparing equal probabilities. What we would call the no-preference-situation.
this is a one sample chi-square test. The significance level is .05 and the p-value is .038
and it even tells you the conclusion
reject the null hypothesis.
Now, personally, I don't care for this output because it does not give me all of the details that I need to do a write-up,
but this is an excellent tool when you're doing an
exploration in a data set, and you need a quick read on how these tests are going to end up.