Chapter4
Chapter4
Chapter4
PEARSON’S R, CHI-SQUARE,
T-TEST, AND ANOVA
OUTLINE OF CHAPTER
119
120 PRACTICAL STATISTICS
Introduction
Pearson’s r: Theory
This equation requires us to first calculate the sum of the product of all
our data pairs, the means of both variables, and the sum of the squared val-
ues of both variables.
So first,
∑xy = (8 × 12) + (12 × 15) + (8 × 8) + (14 × 20) + (12 × 18) + (16 × 45)
+ (20 × 65) + (24 × 85) + (24 × 100) + (24 × 90)
= 96 + 180 + 64 + 280 + 216 + 720 + 1,300 + 2,040 + 2,400 + 2,160
= 9,456
8 þ 12 þ 8 þ 14 þ 12 þ 16 þ 20 þ 24 þ 24 þ 24 162
x ¼ ¼ ¼ 16:2
10 10
12 þ 15 þ 8 þ 20 þ 18 þ 45 þ 65 þ 85 þ 100 þ 90 458
y ¼ ¼ ¼ 45:8
10 10
I will use this same example in the sections on IBM SPSS and Stata—in
those sections, you will be able to see that the result for Pearson’s r using
either of these programs is identical to the value we have calculated by hand.
Now, we can see that our correlation, .9743, is very high as it is very close
to +1, the maximum possible value for Pearson’s r. But we still need to cal-
culate the p value in order to determine whether this correlation is statisti-
cally significant or not.
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 123
Now, plugging our values into the equation, we get the following:
pffiffiffiffiffiffiffiffiffiffiffiffiffi pffiffiffiffiffiffiffiffiffiffiffiffiffi pffiffiffi
r N ÿ 2 :9743 10 ÿ 2 :9743 8 2:7557
t ¼ pffiffiffiffiffiffiffiffiffiffiffiffi ¼ pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ¼ pffiffiffiffiffiffiffiffiffiffiffi ¼ ¼ 12:2386
1 ÿ r2 1 ÿ :97432 :0507 :2251
Also, we will need to know our degrees of freedom (df). This is equal to
the number of pairs of data minus 2:
df = N – 2 = 10 – 2 = 8
the dependent variable). In this example, it would make sense that we would
use years of education to predict the respondent’s income and not vice versa.
What’s interesting is that we simply need to square the value we arrived at
after calculating Pearson’s r to attain the R-squared. Thus,
R2 = r2 = .97432 = .9493
Later on, in the Stata section, I will replicate this result. We can interpret
this by stating that level of education explains 94.93% of the variance in
income. Here, I simply moved the decimal point two places to the right to
arrive at this value.
Finally, it is important to state again that Pearson’s r is only used for continu-
ous variables. To determine the correlation between variables that are ordered and
categorical or dichotomous, there are a number of special options, including
Kendall’s tau, Spearman’s rank correlation coefficient or Spearman’s rho, the
polyserial correlation, the polychoric correlation, phi, the tetrachoric correla-
tion, and others. Many of these tests require specialized software programs or cer-
tain specific add-ons to IBM SPSS or Stata. These additional measures of correlation
are described in more detail in Appendix C, Section 4, Part F.
Chi-Square: Theory
X
n
ðOi ÿ Ei Þ2
χ2 ¼
i¼1
Ei
Here,
χ2 = the chi-square statistic
Oi = the observed frequency
Ei = the expected frequency
i = the number of the cell (cell 1, cell 2, etc.)
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 125
Here, the summation is simple. We simply calculate the square of the dif-
ference between the observed and expected frequency and divide that by the
expected frequency for each cell. Then, we simply sum all these quotients
together. The concept of a “cell” is also easy to understand. If we are testing
whether a number of outcomes are occurring in equal frequencies or not,
such as in the example of the die, we would count each outcome as a cell. If
we were testing a relationship between two variables, say between degree
and political affiliation, the data would look like this:
Political Affiliation
Degree Republican Democrat
None 23 45
HS 17 42
BA 28 35
MA 32 32
Above MA 42 28
Outcome Frequency
1 95
2 72
3 103
4 105
5 97
6 128
X
n
ðOi ÿ Ei Þ2
χ2 ¼
i¼1
Ei
ð95 ÿ 100Þ2 ð72 ÿ 100Þ2 ð103 ÿ 100Þ2 ð105 ÿ 100Þ2
¼ þ þ þ
100 100 100 100
ð97 ÿ 100Þ2 ð128 ÿ 100Þ2
þ þ
100 100
25 784 9 25 9 784
¼ þ þ þ þ þ ¼ 16:36
100 100 100 100 100 100
So 16.36 is our chi-square statistic for this example, but we still do not
know whether or not this value is significant (i.e., if the probability level is
below .05 or not). To do this next step, you need to calculate the degrees
of freedom. In this example, and in all examples in which we are simply
looking at the frequencies of the different responses for single variable,
degrees of freedom simply equals the number of different responses minus
one. So we get,
Now that we know both the chi-square value and the degrees of free-
dom, we simply need to look at a chi-square table to find the critical chi-
square value for our degrees of freedom using the .05 probability level.
Probability Level
Degrees of Freedom .05 .01 .001
1 3.84 6.64 10.83
2 5.99 9.21 13.82
3 7.82 11.34 16.27
4 9.49 13.28 18.47
5 11.07 15.09 20.52
…
the .05 probability level, our results are statistically significant. This
means that the die appears to be not being rolled fairly, that some out-
comes occur more frequently than others, and that this difference is sta-
tistically significant at the .05 level. Looking again at our chi-square
table, we can see that our calculated value is also greater than the criti-
cal chi-square value at the .01 probability level at 5 degrees of freedom.
This means that our results are also significant at the more stringent .01
probability level (meaning that there is a less than 1% chance that these
differences between outcomes are not actually significantly different
and are instead due to error or chance).
Next, we will calculate the chi-square statistic using the example
of political affiliation and the highest degree completed. Here, the
equation for the chi-square statistic remains the same. However,
degrees of freedom are calculated differently than before. In the case
where there are two variables, degrees of freedom are calculated
using this equation:
Political Affiliation
Degree Republican Democrat Total
None 23 45 68
HS 17 42 59
BA 28 35 63
MA 32 32 64
Above MA 42 28 70
Total 142 182 324
For example, this is how you would calculate the expected value for the
first cell in the top left corner (individuals with no degree who are Republican):
So after calculating the expected value for each cell, we would plug all
our numbers into the equation for the chi-square statistic:
X
n
ðOi ÿ Ei Þ2 ð23 ÿ 29:80Þ2 ð17 ÿ 25:86Þ2 ð28 ÿ 27:61Þ2
χ2 ¼ ¼ þ þ
i¼1
Ei 29:80 25:86 27:61
ð32 ÿ 28:05Þ2 ð42 ÿ 30:68Þ2
þ þ
28:05 30:68
2
ð45 ÿ 38:20Þ ð42 ÿ 33:14Þ2 ð35 ÿ 35:39Þ2
þ þ þ
38:20 33:14 35:39
2 2
ð32 ÿ 35:95Þ ð27 ÿ 39:32Þ
þ þ
35:95 39:32
46:24 78:50 0:15 15:60 128:14 46:24
¼ þ þ þ þ þ
29:80 25:86 27:61 28:05 30:68 38:20
78:50 0:15 15:60 151:78
þ þ þ þ ¼ 17:20
33:14 35:39 35:95 39:32
Now, we need to calculate the degrees of freedom. In cases where we are
calculating the chi-square statistic between two variables, this is the equation
that we use:
df ¼ ð5 ÿ 1Þð2 ÿ 1Þ ¼ 4
So now we know that our chi-square value is 17.20 and our degrees of free-
dom is 4. Looking at our chi-square table, we see that the critical chi-square
value for 4 degrees of freedom at the .05 probability level is 9.49. Since our cal-
culated chi-square value is greater than the critical chi-square value, our results
are significant at the .05 probability level. We can also see that our results are
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 129
also significant at the .01 probability level, but not at the .001 probability level.
Therefore, there is a statistically significant relationship between highest degree
completed and political affiliation using either .05 or .01 as our standard.
t-Test: Theory
x ÿ µ
t¼ pffiffi
s= n
where
t = the t statistic
x– = the mean of the sample
µ = the comparison mean
s = the sample standard deviation
n = the sample size
calculate the mean of the sample and the sample standard deviation, both of
which were covered in the previous chapter. Say that the mean of scores for
these 10 individuals is 107.8, and the standard deviation is 5.35. To calculate
the t statistic, we would simply plug these values into the equation:
x ÿ µ 107:8 ÿ 100
t¼ pffiffi ¼ pffiffiffiffiffi ¼ 4:61
s= n 5:35 10
In this example, we have selected 100 as the value for the comparison
mean as we want to test whether the scores in our sample significantly differ
from 100. If we wanted to, we could test whether the scores were signifi-
cantly different from another value, such as 110, by simply plugging this
value in for the comparison mean.
Next, we need to calculate the degrees of freedom. Here, the degrees of
freedom is simply the sample size minus one. Therefore,
Degrees of freedom = n – 1 = 10 – 1 = 9
X1 ÿ X2 X1 ÿ X2
h ih i¼v
t ¼ rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
u
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
2 P 2 P 23
SS1 þSS2 1 1 u P 2 ð x1 Þ P 2 ð x2 Þ h i
n1 þn2 ÿ2 n1 þ n2 u4 x1 ÿ n1 þ x2 ÿ n2 5 1 1
t n1 þn2 ÿ2 n1 þ n2
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 131
Here,
Say we had two classes, one with five students and the other with seven
students.
These were their scores:
Group
Case 1 2
1 78 87
2 82 92
3 87 86
4 65 95
5 75 73
6 82
7 71
First we would calculate the means of each group. The mean (average)
of Group 1 is 77.14, and the mean for Group 2 is 86.60.
Next, we calculate the sum of squares (SS) for each group. As you can see
from the above equation,
X P
2 ð x Þ2
SS ¼ x ÿ
n
So for Group 1,
X P
x 1 Þ2 ÿ 2
ð
SS1 ¼ x21 ÿ ¼ 78 þ 822 þ 872 þ 652 þ 752 þ 822 þ 712
n1
ð78 þ 82 þ 87 þ 65 þ 75 þ 82 þ 71Þ2
ÿ
7
5402
¼ 41992 ÿ ¼ 334:86
7
132 PRACTICAL STATISTICS
X P
ð x 2 Þ2 ÿ 2
SS2 ¼ ÿ x22 ¼ 87 þ 922 þ 862 þ 952 þ 732
n2
ð87 þ 92 þ 86 þ 95 þ 73Þ2
ÿ
5
4332
¼ 37783 ÿ ¼ 285:20
5
Finally, plugging all these values into the t-test equation, we get the
following:
X 1 ÿ X 2 77:14 ÿ 86:60
ih i ¼ rhffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
t ¼ rhffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi i
SS1 þ SS2 1 1 334:86 þ 285:20 1 1
n1 þ n2 ÿ2 n1 þ n2 7þ5ÿ2 7þ5
ÿ9:46 ÿ9:46
¼ qÿffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
ÿ ¼ pffiffiffiffiffiffiffiffiffiffiffi ¼ ÿ0:44
620:06 12 21:26
10 35
df ¼ n1 þ n2 ÿ 2
And the top of this table I mention that these critical t scores are for
the two-tailed t-test. The two-tailed t-test is used when you are not hypoth-
esizing a direction in the relationship between your two groups and the
dependent variable. For example, if you’re testing the relationship between
gender and religious attendance, and do not have a hypothesis, you would
use the critical t scores from a two-tailed t-test table or column. The one-
tailed t-test can be used if you are hypothesizing a directional relationship,
for example, if you are hypothesizing that males will have higher incomes
than females or that females will have greater religious attendance than
males. However, the two-tailed t-test is a more stringent test and tends to
be preferred over the one-tailed t-test, regardless of whether or not you
have a directional hypothesis. This is true not only in regard to t-tests
specifically but in general.
So in this example, we calculated a t score of -0.44. Before making the
comparison with our critical t score table, we can first take the absolute value
of this, which is 0.44 (i.e., simply make this number positive if it is a negative
number). Now, for the .05 probability level with 10 degrees of freedom, we
see from our table that the critical t score is 2.228 for a two-tailed test. Since
our calculated t score is lower than the critical t score, our results are not sig-
nificant at the .05 probability level. So the differences in the means of the
scores that we saw between the two groups cannot be statistically attributed
to any meaningful difference between these two groups. Here, if we wanted
to report this result, we could simply say the following: The differences in
test scores between our two groups were not statistically significant at the .05
probability level.
When we are performing an independent samples t-test (between sub-
jects) for two groups having equal sample sizes (n), our equation can be sim-
plified like this:
X 1 ÿ X 2 X 1 ÿ X 2 X 1 ÿ X 2
h ih i ¼ qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
t ¼ rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi SS þ SS 2ffi ¼ qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi
SS1 þ SS2 1 2 2ðSS1 þ SS2 Þ
1 1
n1 þ n2 ÿ2 n1 þ n2 2n ÿ 2 n 2
2n ÿ 2n
X 1 ÿ X 2 X 1 ÿ X 2
¼ qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ¼ qffiffiffiffiffiffiffiffiffiffiffiffiffiffi
2ðSS1 þ SS2 Þ SS1 þ SS2
2ðn2 ÿ nÞ n2 ÿ n
X 1 ÿ X 2 51:6 ÿ 90:6
t ¼ rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
h ih i ¼ rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
h i
SS1 þ SS2 1 1 357:2 þ 153:2 1 1
n1 þ n2 ÿ 2 n1 þ n2 5þ5ÿ2 5þ5
ÿ39 ÿ39
¼ qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
ÿ510:4ÿ2ffi ¼ pffiffiffiffiffiffiffiffiffiffi
ffi ¼ ÿ7:72
25:52
8 5
So it works.
Also,
df ¼ n1 þ n2 ÿ 2 ¼ 10 ÿ 2 ¼ 8
Here,
n = sample size
D = difference in scores for the respondent between Time 1 and Time 2,
or between the matched pair
Say we had a class of five students, and they took the SAT (Scholastic
Aptitude Test) before and after an extensive training course, and these were
their scores:
Difference
Case Score at Time 1 Score at Time 2 Difference Squared
1 1250 1375 −125 15625
2 1170 1450 −280 78400
3 890 1250 −360 129600
4 1350 1495 −145 21025
5 750 1220 −470 220900
Sum — — −1380 465550
ANOVA: Theory
The ANOVA, which stands for analysis of variance, is like a generalized ver-
sion of the t-test that can be used to test the difference in a continuous depen-
dent variable between three or more groups or to test the level of a
continuous dependent variable in a single group of respondents who were
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 137
tested at three or more points in time. The t-test was published by William
Sealy Gosset in 1908 under the pen name Student, which is why the t-test is
sometimes referred to as the Student’s t-test. The ANOVA was developed sev-
eral decades later by Sir Ronald Fisher, which is why the ANOVA is sometimes
called Fisher’s ANOVA.
While the t-test relies on the t statistic, the ANOVA uses what is called the
F statistic or F-test. When comparing two groups, either the t-test or the
ANOVA may be used as they will both give you the same results. For example,
below are the results from Stata for both the t-test and an ANOVA on years of
education by gender for cases from the year 2004. You can see that the prob-
ability levels for both analyses are the same.
------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
1 | 1279 13.81939 .0842611 3.013439 13.65408 13.9847
2 | 1531 13.597 .0710005 2.778106 13.45773 13.73626
---------+--------------------------------------------------------------------
combined | 2810 13.69822 .0545035 2.889202 13.59135 13.80509
---------+--------------------------------------------------------------------
diff | .2223947 .1093871 .0079075 .4368819
------------------------------------------------------------------------------
diff = mean(1) - mean(2) t = 2.0331
Ho: diff = 0 degrees of freedom = 2808
Analysis of Variance
Source SS df MS F Prob > F
------------------------------------------------------------------------
Between groups 34.4657999 1 34.4657999 4.13 0.0421
Within groups 23413.6253 2808 8.33818565
------------------------------------------------------------------------
Total 23448.0911 2809 8.34748704
Next, we will calculate these values for the entire set of cases:
152
x ¼ ¼ 15:2
10
Xÿ
x2 ¼ 142 þ 122 þ 162 þ 202 þ 122 þ 122 þ 162 þ 162 þ 142 þ 202 ¼ 2392
Doing the same computations for the other two groups would give you
the following values:
Then,
X X
x ¼ 152 þ 122 þ 116 ¼ 390
X X ÿ
x2 ¼ 2392 þ 1580 þ 1408 ¼ 5380
Now, we need to calculate three different sum of squares values: the sum
of squares total, the sum of squares between, and the sum of squares within.
Then, we will compute the mean squares for between groups and within
groups. Finally, we will compute the F statistic by dividing the mean squares
between by the mean squares within.
So to begin,
X X ÿ ½P ðP xÞ2 3902
SS total ¼ x2 ÿ ¼ 5380 ÿ
N 30
152100
¼ 5380 ÿ ¼ 5380 ÿ 5070 ¼ 310
30
X ðP xÞ2 ½P ðP xÞ2 1522 1222 1162
SS between ¼ ÿ ¼ þ þ
n N 10 10 10
2
390
ÿ ¼ 5144:4 ÿ 5070 ¼ 74:4
30
As a check,
Next,
Finally,
MS between 37:2
F¼ ¼ ¼ 4:263
MS within 8:726
Done.
Now, we need to consult an F table containing critical F values to see
whether our results are significant or not. In our example, we had 2
degrees of freedom in the numerator (MS between) and 27 degrees of
freedom in the denominator (MS within). Looking at an F table, this would
give us a critical F value of approximately 3.38 at the .05 probability level.
As you can see, our results were significant at the .05 probability level as
our calculated F value, 4.263, was greater than the critical F value for the
.05 probability level, 3.38. Here, we could say the following: There is a sig-
nificant difference in the level of education between whites, blacks, and
Hispanics (F(2, 27) = 4.26, p < .05). The first value for our degrees of free-
dom, 2, is equal to the number of groups minus one. The second value,
27, is equal to the total sample size or number of respondents, 30, minus
the number of groups, 3.
If you wanted to combine all these steps into one, you would get the fol-
lowing equation for the F statistic:
SS between SS between
MS between df between df between
F¼ ¼ SS within ¼ SS totalÿSS between
MS within df within df within
0 P P P 1
P ð x Þ2 ½ ð x Þ 2
ÿ
@ n N A
nðgroupsÞÿ1
¼ 0 P P P P P 1
P P 2 ½ ð x Þ 2 P ð xÞ2 ½ ð xÞ2
B ð ðx ÞÞÿ N ÿ n ÿ N C
B C
@ NÿnðgroupsÞ A
There are several versions of the ANOVA that will be covered in the SPSS
and Stata sections of this chapter. The first, which was just presented, is
called a one-way ANOVA. A one-way ANOVA is used when you have only one
categorical independent or predictor variable. A factorial ANOVA is used
when you have two or more categorical independent or predictor variables.
Finally, a repeated measures ANOVA is used when you are looking at scores
on a dependent variable across two or more points in time.
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 141
Next, we will move our two variables over to the Variables box, like so:
144 PRACTICAL STATISTICS
We can leave all the other options as they are. Finally, clicking the OK but-
ton will give us the following results:
CORRELATIONS
/VARIABLES=educ inc
/PRINT=TWOTAIL NOSIG
/MISSING=PAIRWISE.
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 145
Calculating the chi-square statistic in IBM SPSS is very quick and easy,
and it is obviously preferred to calculating it by hand. In our examples here,
we will look at the relationship between highest degree completed and polit-
ical affiliation, using actual data from the General Social Survey (GSS).
First, navigate to the following menu selection:
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ
/CELLS=COUNT
/COUNT ROUND CELL.
And if you wanted to omit the crosstabulation table, you would use this
syntax:
CROSSTABS
/TABLES=PARTYIDR BY DEGREE
/FORMAT=NOTABLES
/STATISTICS=CHISQ
/COUNT ROUND CELL.
As you can see, I have taken the liberty of adding the respondents’ yearly
income, realrinc, into the Test Variable(s) box, and adding female (a con-
structed dummy variable, where female = 1 and male = 0) into the
Grouping Variable box. Right now, inside the parentheses next to the sex
variable, there are two question marks. Before we can run the t-test within
IBM SPSS, we click on the Define Groups button. Clicking on the button will
reveal this dialog box:
150 PRACTICAL STATISTICS
Here, we specify the values for the two different groups (males and
females). Since females are coded 1 and males are coded 0, I simply specified
Group 1 as equal to 1 (females), and Group 2 as equal to 0 (males), like this:
Now, you can see that our two groups are defined correctly:
First, we see that Levene’s test for equality of variances was significant at the
.05 probability level. This means that the variances between groups are signifi-
cantly different, and therefore when looking up the t values and significance, we
should use the second row labeled “Equal variances not assumed.” Here, we see
that we obtained a t score of –50.752 with 22324.9 degrees of freedom, which was
significant at the .001 probability level. In IBM SPSS, if the probability level or level
of significance is ever listed as “.000,” this means that it is less than .001—this is an
IBM SPSS bug. The results also show us the mean for the two different groups:
the mean income for males is approximately $26,983 per year, while the mean
income for females is approximately $14,811 per year. These results could be
stated as follows: Males were found to have a significantly higher income as com-
pared with female respondents (t = –50.75, df = 22324.90, p < .001). Keep in mind
that this analysis includes all data, starting in the year 1972. If we include only cases
from the year 2004, we get the following results:
152 PRACTICAL STATISTICS
T-TEST GROUPS=female(1 0)
/MISSING=ANALYSIS
/VARIABLES=realrinc
/CRITERIA=CI(.95).
Now, let’s use IBM SPSS to run a dependent samples t-test. Because the
GSS does not contain any variables that would be appropriate to use in a
dependent samples t-test, I simply created a new file within IBM SPSS and
created two new variables: test1 and test2. Then, I typed in the following data
as an example:
Simply input the same data values if you want to follow along in IBM
SPSS. Next, you will navigate to the following menu selection:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 153
In this dialog box, I’ve simply selected the variables test1 and test2 and
moved them to the Paired Variables box on the right, like this:
154 PRACTICAL STATISTICS
significant at the p < .01 level: you will only use .05, .01, or .001 as standards.
For example, you could report this result in the following way: Scores on
Test 2 were found to be significantly higher as compared with scores on
Test 1 (t = –4.24, df = 9, p < .01).
This is the corresponding syntax:
Here, I will simply add the dependent variable educ, representing the
highest year of education completed, in the Dependent List and race into the
Factor box, like this:
Next, you’ll want to click on the Post Hoc button. This dialog box will pop up:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 157
In this window, I will simply select two post hoc tests, the LSD (least sig-
nificant difference) and the Games-Howell post hoc tests:
158 PRACTICAL STATISTICS
If you do not run a post hoc test, you will not know
between which specific groups there is a statistically signifi-
cant difference. For example, even if the F test for the
ANOVA is significant, we will not know whether all three
groups differ from each other significantly in their scores, if
there is only a significant difference between whites and
blacks, and so on. To ascertain between which specific
groups there is a significant difference, we need to run a
post hoc analysis in addition to the ANOVA. If you do addi-
tional reading into the different post hoc analyses that are
available when conducting an ANOVA, you will find that
they differ in particular ways, especially in terms of how
conservative they are. Some are also more appropriate for
particular types of situations: for example, when your
ANOVA includes a small number of groups or a large num-
ber of groups.
The LSD post hoc test is less conservative, while the
Games-Howell post hoc test is more conservative. As you
can see, SPSS includes two categories, a large set of tests
under “Equal Variances Assumed,” and a smaller set under
“Equal Variances Not Assumed.” In our example, if the vari-
ance in years of education is significantly different between
whites, blacks, and members of other races, we should
choose one of the four post hoc tests under “Equal
Variances Not Assumed.” We can test whether the variances
are significantly different in the following way: first, click
Continue to close out this dialog box. Next, click Options.
This reveals the dialog box to the left.
Here, I will select Homogeneity of variance test, which
will test whether the variance of level of education is signif-
icantly different across race. I have also selected
Descriptive, which will give the mean years of education for
whites, blacks, and members of other races separately.
After clicking Continue and OK, you will see the following results:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 159
In the first table, labeled “Descriptives,” we see the mean of years of edu-
cation for whites, blacks, members of other races, and all groups combined.
While the differences are not huge, it does appear that whites and members of
other races tend to have more education as compared with blacks.
The second table, labeled “Test of Homogeneity of Variances,” reports
Levene’s test for the equality of variances. Our probability level, which is cir-
cled, was found to be less than .05, which means that the variances in the
160 PRACTICAL STATISTICS
level of education are significantly different across race. This also means that
we will select as a post hoc test an option that does not assume equal vari-
ances. In this example, I selected the Games-Howell post hoc test, which
does not assume equal variances.
Before moving to the results of the post hoc test, let’s first discuss the
results of the ANOVA itself. We see that the F statistic was calculated by IBM
SPSS to be 349.095, with 2 degrees of freedom between groups and 46366
degrees of freedom within groups. This was significant at the p < .001 level.
As the F test in this ANOVA was found to be significant, this means that level
of education differs significantly based on race. However, to ascertain
between which groups specifically there is a significant difference in educa-
tion, we need to look at the results of our post hoc test. In regard to the
degrees of freedom, which will be reported when writing up the results of an
ANOVA, the between-groups degrees of freedom, calculated here to be 2, is
simply the total number of groups minus one. In this example, we had three
categories of race, so the between-groups degrees of freedom is simply 3
minus 1. The within-groups degrees of freedom is calculated as the total sam-
ple size minus the number of groups. The total sample size for this ANOVA,
reported in the final row of the “Descriptives” table under N, was 46369. As
we had three groups, the within-groups degrees of freedom is simply 46369
minus 3.
Finally, let’s look at the results of our post hoc analysis, which are dis-
played under the “Post Hoc Tests” table. As you may notice, the results of our
two post hoc analyses are quite similar, despite the fact that the LSD test
assumes the equality of variances, while the Games-Howell test does not.
This is not rare, as different tests commonly result in similar or identical
results.
However, let’s focus on the results of the Games-Howell test, as we
found that the variances of level of education based on race significantly
vary. Here, two results that were significant at the .05 probability level,
denoted by asterisks, were found. First, whites were found to have signifi-
cantly higher levels of education as compared with blacks. Specifically,
whites were found, on average, to have 1.112 greater years of education as
compared with blacks. Looking under the Sig. column, we can see that this
was significant at the p < .001 level. As you may notice, the results of each
comparison are actually reported twice in this table. Moving down two
rows, the opposite comparison, blacks as compared with whites, is dis-
played. If you preferred, you could instead report this result, stating that
blacks were found, on average, to have 1.112 fewer years of education as
compared with whites. Just make sure to choose only one of these two
results to report so you are not in effect reporting the same result twice.
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 161
Finally, we can see in the final row of the table that members of other races
were found, on average, to have 1.260 greater years of education as com-
pared with blacks. Looking under the Sig. column, we can see that this was
significant at the p < .001 level. Our results highlight the importance of
running a post hoc test whenever we are conducting an ANOVA on more
than two groups: While a significant difference was found between whites
and blacks and between members of other races and blacks, no significant
difference was found between whites and members of other races in
regard to years of education.
Our results can be stated in the following way: A significant difference in
years of education between whites, blacks, and members of other races was
found, F(2, 46366) = 349.10, p < .001. Specifically, a Games-Howell post hoc
test found the mean level of education for both whites and members of other
races to be significantly greater than that of blacks, p < .001.
Next, click Post Hoc. This will open the following dialog box:
Here, I will move one of our independent variables, race, into the “Post
Hoc Tests for” box:
164 PRACTICAL STATISTICS
As there are only two categories for sex, male and female, a post hoc test
is not necessary. As in the previous example, I will select both the LSD as well
as the Games-Howell post hoc tests. The LSD post hoc test is less conserva-
tive, while the Games-Howell post hoc test is more conservative. More con-
servative tests are sometimes preferred, as you are less likely to get a “false
positive,” or a significant result, in situations where there actually is no real
difference. As explained in the previous section, most post hoc tests assume
that the variances in the dependent variable are not significantly different
across categories of the independent variables. As we do not yet know
whether this is the case, I will select one test from each category. After mak-
ing these selections, our dialog box will look like the following:
Next, click Continue. Then, click Options to reveal the following dialog
box:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 165
The first table here gives us the results of Levene’s test of the equality of
variances. This result was found to be significant at the p < .001 level, which
means that the variance in income significantly varies across the categories of
our independent variables and also means that we will select a post hoc test
that does not assume equal variances.
The second table, titled “Tests of Between-Subjects Effects,” presents
the main results of the ANOVA. The first row, titled Corrected Model, gives
us the results of the F test for the overall model. Here, the calculated F sta-
tistic was 573.719 and was significant at the p < .001 level. The three other
results that are circled in this table give us the effects of race on income,
sex on income, and the interaction between race and sex on income. First,
the F statistic for race was 117.926. This was significant at the p < .001
level, which means that respondent’s income was found to significantly
vary based on race. Next, the F statistic for sex was 383.954. This result was
also significant at the p < .001 level, meaning that respondent’s income
significantly varies based on sex. Finally, the interaction between race and
sex, denoted as race * sex, had a calculated F statistic of 55.086 and was
also significant at the p < .001 level. This means that the effect of race on
income significantly varies by sex. Alternatively, you could state that the
168 PRACTICAL STATISTICS
effect of sex on income varies significantly by race. For example, this would
be the case if race were an important predictor of income for males but not
for females. Likewise, this would be the case if males have higher incomes
than females for whites but if females had higher incomes than males for
blacks. In essence, the significant interaction effect in this example means
that the effect of one of the independent variables on the dependent vari-
able varies significantly depending on the level of the second independent
variable. Interaction effects can clearly be trickier to deal with and can take
some additional time to fully understand. The degrees of freedom, which
you will report, come from the df column in the table just presented. For
example, the F test for the full model would be reported as the following:
F(5, 27157) = 573.72. The first value, 5, comes from the first row, while the
second value, 27157, comes from the Error row. As you can see in the
results write-up presented at the end of this section, this second value will
always be equal to the value presented in the Error row.
Finally, I’ll present the table which included the results of the post hoc
tests we conducted.
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 169
As mentioned previously, a post hoc test for sex was not necessary as
there are only two groups, males and females. The results of the ANOVA, pre-
sented previously, found that respondent’s income varied significantly based
on sex. Looking at the “Descriptive Statistics” table, presented previously, we
see that the average income for males is $26983.16, while the average income
for females is $14811.22. Using this information, we can state that the aver-
age income for males is significantly higher than that of females.
Now, to look at the results presented in this table. First, as the variance
in income was found to significantly differ across categories of our indepen-
dent variables, we will focus only on the second post hoc test presented in
this table, the Games-Howell post hoc test, as it does not assume equal vari-
ances, while the LSD test does. As you may notice, the results for these two
tests are similar. However, we should focus on and report the results from
the Games-Howell test as it does not assume equal variances. In this post hoc
test, three significant comparisons were found, which means that there are
significant differences in income between all three of our racial categories. As
mentioned in the previous section, all comparisons are made twice, so all
results are repeated. For example, the white versus black comparison had a
mean difference of 6170.21, while the black versus white comparison had a
mean difference of –6170.21. In essence, this is the same result, simply
flipped, so when looking at this table, we can simply focus on positive mean
differences, which are circled.
The first circled mean difference, which looks at the mean difference
between whites and blacks, is 6170.21. This means that the average income
for whites is $6170.21 greater than the average income for blacks. This result
was significant at the p < .001 level. Next, the difference in income between
whites and those of other race was found to be significant at the p < .001
level. Here, the mean income for whites was, on average, $2522.61 greater
than that of members of other races. Finally, the difference in income
between members of other races and blacks was found to be significant at the
p < .001 level. In this case, the mean income for members of other races was,
on average, $3647.60 greater than the average income for blacks.
Our results can be stated in the following way: A factorial ANOVA found
a significant difference in income based on both race and gender, F(5, 27157) =
573.72, p < .001. Specifically, males were found to have significantly higher
incomes than females, F(1, 27157) = 383.95, p < .001. Also, income was
found to vary significantly based on race, F(2, 27157) = 117.93, p < .001. A
Games-Howell post hoc test found that income for whites was significantly
higher than that of blacks and those of other race, while the mean income for
members of other races was significantly greater than the average income for
blacks. Finally, a significant interaction between race and gender was found,
F(2, 27157) = 55.09, p < .001.
170 PRACTICAL STATISTICS
Repeated measures ANOVAs are used when your dependent variable con-
sists of a measure that was recorded or measured at several points in time. For
example, if you had a set of two or more exam grades for a set of respondents,
these data, along with one or more independent predictor variables, could be
analyzed using a repeated measures ANOVA. This is the example that I’ll be
using in this section. A repeated
measures ANOVA could also be
used in other situations, for
example, if you had a measure
for respondents that was taken
before and after some medical
treatment. Using a repeated
measures ANOVA, you can also
include predictor variables such
as sex and age.
To run a repeated mea-
sures ANOVA, first make the
following menu selection:
The data that I am using in this example consist of three exam scores in
a sample of 37 students. The dependent variable consists of the three exam
scores, while I will include year in college, categorized as Freshman,
Sophomore, Junior, and Senior, as the independent variable. In the dialog
box just presented, I will rename the Within-Subject Factor Name as simply
time. Next, I will specify it as having three levels, as we have three separate
exam scores. Finally, I will click Add under Number of Levels. When finished,
the dialog box will look as follows:
Next, we can click Define. This will reveal the following dialog box:
172 PRACTICAL STATISTICS
Here, we will begin by selecting the three exam scores, named Exam_1,
Exam_2, and Exam_3 and move them to the Within-Subjects Variables
(time) box. After this step, the dialog box will look as follows:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 173
Next, let’s click on the Post Hoc option, so we can specify post hoc tests
for this ANOVA. This will allow us to see whether there are differences in
exam scores between each category of year at college. For example, it will tell
us whether Seniors have higher exam scores compared with Freshman. A
post hoc test is needed here as the ANOVA will only tell you whether there
are significant differences overall. The initial dialog box that you’ll see when
you first select this option is presented here:
174 PRACTICAL STATISTICS
Next, we will simply select our level variable and move it to the right.
Then, we will select the post hoc tests desired. Here, I will select both the
LSD post hoc test as well as the Games-Howell post hoc test. The LSD post
hoc test is less conservative while the Games-Howell post hoc test is more
conservative. With more conservative tests, you are less likely to find a sig-
nificant result, while their stricter standards mean that you’re less likely to
find a “false positive,” or a result that is reported to be significant by SPSS,
which in actuality is not. The LSD test incorporates the assumption that the
variance in your dependent variable is approximately equal across the differ-
ent categories of your independent variable, while the Games-Howell test
does not. In this example, it would be assumed that variances in test scores
are relatively the same regardless of the respondent’s year of college. We will
be testing this assumption which will determine which of these two post hoc
tests we end up using in our analysis. After making our selections, our dialog
box will appear as follows:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 175
Next, click Continue. Then click Options. This opens the following dialog box:
176 PRACTICAL STATISTICS
The first table presented here, titled “Box’s Test of Equality of Covariance
Matrices” includes a calculation of Box’s M statistic and its significance. The
statistic is used to test the assumptions of the multivariate model, which will
be explained shortly. If the significance of the statistic is less than .05, it
means that the assumptions of the multivariate model have been violated,
and therefore, the multivariate model should not be used. Here, you can see
that the probability level is less than .001, which means that the assumptions
of the multivariate model have been violated.
The next table, titled “Multivariate Tests,” presents the results of the
repeated measures ANOVA. In short, “multivariate” means that you are incor-
porating more than one predictor variable, while “univariate” means that you
are incorporating only one predictor. In this example, both level (year at col-
lege) and time are included, making this a multivariate model. You can see
that for each variable or interaction effect included, SPSS gives you four dif-
ferent versions of the F test. Wilks’s Lambda is very commonly used, so I’ll
focus on that version here. As mentioned in the previous paragraph, as the
assumptions of the multivariate model have been violated, you would prefer
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 179
not to focus on the multivariate model. However, I will explain the results for
your understanding. We can see that the Wilks’s Lambda F test calculated an
F statistic for time of 1.941 with a p value of .160. This means that in this mul-
tivariate model, test scores were not found to significantly vary based on
time. In regard to the time * level interaction effect, the calculated F statistic
using the Wilks’s Lambda F test was .615 with a p level of .717. This means
that in this multivariate model, the effect of year at college on test scores did
not vary significantly based on time. Alternatively, you could state that the
effect of time on test scores did not vary significantly based on year at college.
The next two tables are presented here:
The first table, titled “Mauchly’s Test of Sphericity” presents a test of the
assumptions of the univariate model, the results of which are presented in
the second table. The probability level, which is circled, is below .05, which
means that the assumption of sphericity has been violated. However, this
does not prevent us from using the results of the univariate model. The final
three columns of the table present three corrections to the calculated F sta-
tistic. The Huynh-Feldt correction is somewhat less conservative than the
others and is what I will focus on here.
180 PRACTICAL STATISTICS
The first table, titled “Levene’s Test of Equality of Error Variances,” tests
the assumption that the variances in test scores are equal across the cate-
gories of the independent variable, which is year at college in this example.
This is important for the post hoc test that will be presented shortly, as a
number of post hoc tests assume that these variances are equal. As you can
see, the probability levels, which are circled, are not significant at the .05
level, which means that this assumption has not been violated and that we
can use post hoc tests that assume the equality of variances.
The second table, titled “Tests of Between-Subjects Effects,” tests the
effect of our independent variable, level or year at college, on exam scores.
As you can see, this effect approaches significance with an F value of 2.841
and a probability level of .053.
The final table, presenting the results of our post hoc tests, is presented here:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 181
One-Way ANOVA
ONEWAY educ BY race
/STATISTICS DESCRIPTIVES HOMOGENEITY
/MISSING ANALYSIS
/POSTHOC=LSD GH ALPHA(.05).
The general format being as follows:
ONEWAY [Dependent variable] BY [Independent
variable]
/STATISTICS [Options]
/MISSING ANALYSIS
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 183
Factorial ANOVA
UNIANOVA realrinc BY race sex
/METHOD=SSTYPE(3)
/INTERCEPT=INCLUDE
/POSTHOC=race(LSD GH)
/PRINT=HOMOGENEITY DESCRIPTIVE
/CRITERIA=ALPHA(.05)
/DESIGN=race sex race*sex.
/METHOD=SSTYPE(3)
/POSTHOC=[Independent variables to include in
the post hoc test] ([Post hoc tests])
/PRINT=[Options]
/CRITERIA=ALPHA([Alpha or probability level])
/WSDESIGN=[Repeated measures “factor” name]
/DESIGN=[Design of model].
SECTION 3: STATA
Pearson’s r: Stata
gen inc=.
gen educ=.
Specifying the sig option tells Stata to include the significance level of the
correlation coefficient in the results. Here, our p level is listed as “0.0000,”
which simply means that our true p level is less than .0001. Stata incorrectly
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 187
rounded our p level down to zero, while it can never be zero in actuality.
Here, we could say the following: There is a statistically significant positive
correlation between years of education and income (r = .97, p < .001).
Chi-Square: Stata
Using the same example from the IBM SPSS section, I have selected
degree under Row variable and the recoded partyid variable, which I have
renamed partyidr, under Column variable. Clicking OK will give you the fol-
lowing output:
As you can see, both IBM SPSS and Stata calculated a Pearson chi-
square value of 834.007 in this particular example. As you may notice,
Stata puts the degrees of freedom on the last line right next to chi2, in
parentheses. As you may remember, in this example, the degrees of free-
dom was 8. Stata also calculates the probability level as being less than
.001. Here, we could say the following: There was a statistically significant
relationship between highest degree completed and political party affilia-
tion (χ2 = 834.01, df = 8, p < .001).
Finally, this is the corresponding Stata syntax for this particular example:
t-Test: Stata
To run an independent samples t-test within Stata, we must first test whether
our dependent variable has equal variances across groups. We will do this using
Levene’s test for the equality of variances as was reported in the previous section
on running t-tests within IBM SPSS. In this example, we are testing differences in
respondents’ income based on sex. To test whether the variances in scores are
equal across sex, we will use the following syntax command:
Typing this command into the command window and hitting enter
would give you the following results:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 189
As you can see, I have specified sex under Group variable name (which
will always contain the variable that you have two groups of) and realrinc
under Variable name (the dependent, continuous variable). Because we
know that the variances between groups are significantly different, I have also
specified Unequal variances in this dialog box. Clicking OK will give us the
following output:
We can see that the calculated t score is 50.7516 with 22324.9 degrees of
freedom. For the probability level, we can look at the second entry at the bot-
tom. Here, we can see that our results are significant at the p < .0001 prob-
ability level under the “Pr(|T| > |t|)” entry, which represents the p level for
the two-tailed t-test. Stata’s output also gives us the means of the two differ-
ent groups, along with the number of observations and several other statis-
tics. These results could be stated as follows: Males were found to have a
significantly higher income as compared with female respondents (t = 50.75,
df = 22324.9, p < .001).
This is the corresponding syntax:
Now, let’s use Stata to run a paired samples or dependent t-test. I will use
the same example as used in the previous IBM SPSS example in which we had
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 191
10 respondents who took an exam at two different periods of time. I will also
use the identical values that were used previously. First, navigate to the fol-
lowing menu selection:
Here, we see that for this paired samples t-test, Stata has calculated a t
value of –4.2365 with 9 degrees of freedom. By again looking at the middle
entry at the bottom of the output, which is used for a two-tailed t-test, we see
that this is significant at the .0022 probability level. You could report this
result in the following way: “Scores on Test 2 were found to be significantly
different from scores on Test 1 (t = –4.24, df = 9, p < .01). Specifically, the
mean of Test 2 scores was 10.7 points higher than the mean of Test 1 scores.”
This second sentence is constructed using the values under the Mean col-
umn as well as the value under the diff row, which represents the difference
between our two variables (test1 and test2).
Finally, the equivalent syntax is simply this:
Using the same example as used previously, I have specified educ as the
Response variable and race as the Factor variable. I also specified that the
Sidak post hoc analysis (here referred to as “Multiple-comparison tests”) be run.
As you can see, Stata is much more limited than SPSS in regard to the number
of post hoc tests it supports. Clicking OK will give you the following results:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 195
As you can see, Stata has calculated the F statistic to be 349.10 with the
degrees of freedom of 2 and 46,366, significant at the p < .001 probability
level. In the Sidak post hoc table shown below the ANOVA results, we see that
only Groups 1 and 2 and Groups 2 and 3 are significantly different from each
other at the .05 probability level, just as we found within IBM SPSS. We can
tell this from the significance levels. Here, there are only two comparisons in
which the probability level is below .05: the comparison between Groups 1
and 2 (whites and blacks, respectively) and between Groups 2 and 3 (blacks
and those of other race, respectively). Our results can be stated in the fol-
lowing way:
Our value of –1.11 at the top of the table represents the mean of blacks’
education (coded 2) minus the mean of whites’ education (coded 1), where
education was coded in years. This value of –1.11 means that the mean of
years of education for blacks is less than that of whites, as it is negative. The
value of 1.2596 in the lower right-hand cell of the table represents the mean
of education for those of other race (coded 3) minus the mean of blacks’
education (coded 2). The values will always represent the mean for the row
(in this case, 3) minus the mean for the column (in this case, 2).
We could check this using the following syntax:
race | mean
---------+----------
1 | 12.75507
2 | 11.64261
3 | 12.90221
---------+----------
Total | 12.60765
--------------------
196 PRACTICAL STATISTICS
Here, we see that the mean years of education for blacks, coded 2, is less
than that of whites, coded 1.
This is the corresponding syntax for the ANOVA:
As you can see, I have specified the variable realrinc, a measure of the
respondent’s annual income, as the dependent variable. I have also specified
the model to include two independent variables, the respondents’ race and
sex. Also, I have included as a term race#sex, which is the interaction
between these two variables. It is possible that the effect of race on income
varies by gender or likewise that the effect of gender on income varies by
race. The inclusion of this interaction effect will test whether this is the case.
After clicking OK, you will see the following results:
198 PRACTICAL STATISTICS
As you can see under the “Model” row, this ANOVA had a calculated F sta-
tistic of 573.72, with a probability level of less than .001. The effect of race, sex,
and the interaction between race and sex were all found to be significant. First,
the effect of race on income was found to be significant, having an F statistic
of 117.93 with a p level of less than .001. Next, the effect of sex on income was
also found to be significant, having an F statistic of 383.95 with a p level of less
than .001. Finally, the interaction between race and sex was found to be sig-
nificant, having an F statistic of 55.09 with a p level of less than .001. This
means that the effect of race on income significantly varies by sex.
Alternatively, you could state that the effect of sex on income varies signifi-
cantly by race. For example, this would be the case if race was an important
predictor of income for males but not for females. Likewise, this would be the
case if males have higher incomes than females for whites but if females had
higher incomes than males for blacks. In essence, the significant interaction
effect in this example means that the effect of one of the independent vari-
ables on the dependent variable varies significantly depending on the level of
the second independent variable. Interaction effects can clearly be trickier to
deal with and can take some additional time to fully understand.
The degrees of freedom, which you will report, come from the df column
in the table just presented. For example, the F test for the full model would be
reported as F(5, 27157) = 573.72. The first value, 5, comes from the first
“Model” row, while the second value, 27157, comes from the “Residual” row.
Our results can be stated in the following way: A factorial ANOVA found
a significant difference in income based on both race and gender, F(5, 27157) =
573.72, p < .001. Specifically, males were found to have significantly higher
incomes than females, F(1, 27157) = 383.95, p < .001. Also, income was
found to vary significantly based on race, F(2, 27157) = 117.93, p < .001.
Finally, a significant interaction between race and gender was found, F(2,
27157) = 55.09, p < .001.
where each respondent has his or her own single row. We need to get the
data into this format:
Where each respondent has three rows, one for each exam score. To do
this, we need to first create a new variable to identify respondents by num-
ber, such as case. Here, I have simply used “1” for the first respondent and
have continued from there:
200 PRACTICAL STATISTICS
gen case=.
This transforms the data into the necessary “long” format using the
exam variable. The variable case will identify the respondent, and exnum
will identify the exam number. The new exam variable will be simply exam_.
This will transform the data into the necessary format:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 201
As you can see, I have specified the new exam grade variable, exam_,
as the dependent variable in this model. I have included year (year at col-
lege), exnum (exam number), and case (respondent number) as inde-
pendent variables in this
model. I have also included
exnum#year, which is the
interaction between exam
number and year at college.
This tests whether the
effect of time (exam num-
ber) on exam scores varies
significantly by year at col-
lege. Also, I have specified
that exnum is the repeated
measures variable. Next,
I will click on the Adv.
model tab:
CHAPTER 4 PEARSON’S R, CHI-SQUARE, T-TEST, AND ANOVA 203
SECTION 4: SUMMARY
This chapter covered Pearson’s r, chi-square, the t-test, and the ANOVA.
Pearson’s r, a correlation coefficient, is used to determine the strength and
direction of the relationship between two continuous variables. Chi-square is
used to show whether or not there is a relationship between two categorical
variables. It can also be used to test whether or not a number of outcomes
are occurring in equal frequencies or not, or conform to a certain distribu-
tion. Both the t-test and the ANOVA are used to test differences in scores
between groups. While the t-test can only be used to test the differences
between two groups on some continuous variable, the ANOVA can be used
to test the differences between two or more groups on a continuous variable.
When conducting an ANOVA on more than two groups, it is necessary to
select a post hoc comparison test in order to determine between which spe-
cific groups there is a significant difference. A one-way ANOVA includes only
one independent, predictor variable, while factorial ANOVAs include two or
more. Also, repeated measures ANOVAs are used to look at a dependent vari-
able that is measured at multiple points in time. The next chapter will cover
linear regression, which is a particular form of regression that is used when
your dependent variable is continuous. Regression is a powerful statistical
tool as it allows you to determine the effect of one independent variable on
your dependent variable while holding any number of other independent
variables constant. Starting with the following chapter, we will begin con-
structing and analyzing models that include more than one independent
variable, moving on from bivariate (two variables) statistics and beginning
our journey into what is called multivariate statistics.
RESOURCES
You can find more information about IBM SPSS and how to purchase it
by navigating to the following Web site: www.spss.com/software/statistics/
You can find more information about Stata and how to purchase it by
navigating to the following Web site: www.stata.com
This book’s Web site can be found at the following location: www.sage
pub.com/kremelstudy