Introduction
to SPSS for the PC: Sample Analyses
Part 2: Sample Analyses
Within SPSS, analyses are generated using either menu
selections or command syntax. Below is a description of how to run
some common statistical analyses using menu selections. Following
each description is the command syntax used to generate the same analyses
along with a brief explanation of the commands (For more help on using
syntax see: Tips
for SPSS Syntax). To generate the results utilized in these examples
you will need to enter the raw data set using information in Setting
up data files.
I. Frequencies
II. Graphing
Procedures
III. Descriptive
Statistics
IV. Regression
V. Correlation
VI. One-sample t-test
VII. Two-sample t-test
VIII. One-way ANOVA
IX. Two-way ANOVA
X. Chi-square
Rawdata
I. Frequencies
Use: Frequencies can be used for checking data
integrity and providing measures of central tendency and variability of
the mean. Both statistical and graphical output is provided.
-
Select Analyze > Descriptive Statistics > Frequencies
from the menu bar. This will open the Frequencies window. A list of all
your variables will appear on the left. Highlight the variables for which
you want frequencies and click on the arrow to move them into the box labeled
Variable(s).
For this exercise highlight gender and math and move them to the Variables
box.
-
Click on Statistics. Click on the box
in front of Mean, Median, Mode, Std. Deviation, Minimum, Maximum,
Skewness and Kurtosis (a check will now appear in the box).
Click Continue.
-
Click on Charts. Click on the box in
front of Histograms and With normal curve. Click Continue.
-
Click on OK to run the analysis. The results
are printed below. The first table provides descriptive statistics
for each variable. The next two tables provide a frequency distribution
of each variable. The two graphs represent a graphical representation
of the frequency count (i.e., a histogram) overlaid with a density curve.




Command Syntax for Frequencies:
FREQUENCIES
VARIABLES=gender math
/STATISTICS=STDDEV RANGE MINIMUM MAXIMUM MEAN MEDIAN MODE SKEWNESS
SESKEW
KURTOSIS SEKURT
/HISTOGRAM NORMAL .
FREQUENCIES - This line defines which analyses will run. In this
case, Frequencies is the command that will run the frequencies analysis.
VARIABLES=gender math - The "/variables=" subcommand identifies
which variables you would like to include in the analysis.
/STATISTICS=STDDEV RANGE MINIMUM MAXIMUM MEAN MEDIAN MODE SKEWNESS
SESKEW
KURTOSIS SEKURT - The "/statistics=" subcommand identifies
which statistics you would like to run. A full list of the possible
statistics can be found by referring to the help menu in SPSS (i.e., Select
Help > Topics on the menu bar which will open the Help Topics window.
Click on the Index tab. Type "frequencies" in the box.
Click on the Display button and a Topics Found window will appear.
Highlight Frequencies Command Syntax and click on the Display button.).
/HISTOGRAM NORMAL. - The addition of this line indicates
that you would like to generate a histogram for each variable with a
normal distribution curve. To generate a bar graph, pie chart, or
percentiles refer to the help files.
Back to Sample Analyses list
II. Graphing Procedures
Use: SPSS offers a variety of graphing procedures,
which allow you to visually inspect your data for errors/problems and provide
you with a visual snapshot of your results. Although several graphs
are available, only two common graphs will be outline below (scatter plots
and bar graphs).
1. Scatter Plots can be used to display the correlation
between variables. For example, we could graphically represent the
relationship between National Assessment of Educational Progress math and
writing scores.
-
Select Graph > Scatter from the menu bar. This
will open the Scatterplot window. Click Define.
-
Highlight write and click on the arrow in front
of the X axis box. The write variable should now appear
in the X axis box.
-
Highlight math and click on the arrow in front
of the Y axis box. The math variable should now appear
in the Y axis box. Note: It does not matter which variable
is placed into the X axis or Y axis box. The graphical
relationship will still be the same. However, your variables must
be numeric (or continuous).
-
Click on the Title button at the bottom of the Scatterplot
window. This will open up a Titles window. This will
allow you to type in a title for your graph. Type “Scatter Plot for
Math and Writing Scores.” Click on Continue.
-
Click on OK to run the analysis. The graph produced
is below.
Command Syntax for Scatter Plots:
GRAPH
/SCATTERPLOT(BIVAR)=math WITH write
/MISSING=LISTWISE
/TITLE= 'Scatter Plot for Math and Writing Scores'.
GRAPH
/SCATTERPLOT(BIVAR)=math WITH write - The "/scatterplot(bivar)="
subcommand provides a scatterplot for two variables (i.e., math With write).
/TITLE= 'Scatter Plot for Math and Writing Scores'. - The
"/title=" subcommand allows you to title your graph. Place your title
between apostrophes.
2. Bar Graphs allow you to show the distribution of
cases into particular categories. To demonstrate we will examine
the collapsed self-esteem score for men and women.
-
Select Graph > Bar from the menu bar. This will
open the Bar Charts window. Click on Clustered and
make sure the circle is highlighted in front of Summaries for groups
of cases. Click on Define.
-
Highlight esteem2 and click on the arrow in
front of the Category axis box. The esteem2 variable
should now appear in the Category axis box.
-
Highlight gender and click on the arrow in
front of the Define Clusters by: box. The gender variable
should now appear in the Define Clusters by: box. This procedure
instructs SPSS to define writing scores by gender.
-
If you would like to add a title, click on the Title
button at the bottom of the Bar Charts window. This will open
up a Titles window. This will allow you to type in a title
for your graph. Click on Continue. Click on OK
to run the analysis. The graph produced is below.
Command Syntax for Bar Graphs:
GRAPH
/BAR(GROUPED)=COUNT BY esteem2 BY gender
/TITLE= 'Self-Esteem Scores by Gender'.
GRAPH
/BAR(GROUPED)=COUNT BY esteem2 BY gender - The "/bar(grouped)="
subcommand generates a bar chart by a particular group (in this case gender).
For a complete list of subcommands for other graphical procedures refer
to the help menu in SPSS (i.e., Select Help > Topics on the menu bar which
will open the Help Topics window. Click on the Index
tab. Type "graph" in the box. Graph will appear in the second
box. Highlight the Command Syntax under graph. Click
on the Display button.).
/TITLE= 'Self-Esteem Scores by Gender'.
Back to Sample Analyses list
III. Descriptive statistics
Use: Descriptive statistics can be used for checking
data integrity and providing measures of central tendency and variability
of the mean.
-
Select Analyze > Descriptive Statistics > Descriptives
from the menu bar. This will open the Descriptives window. A list
of all your variables will appear on the left. Highlight the variables
for which you want descriptive statistics and click on the arrow
to move them into the box labeled Variable(s).
-
Click on Options to specify which descriptive statistics
you want. The default setting should give you the mean, standard deviation,
minimum, maximum, and number of cases. Click on OK to run the analysis.
The results are printed below.
Command Syntax for Descriptives:
DESCRIPTIVES
VARIABLES=gender school write math total esteem esteem2 conf
/STATISTICS=MEAN STDDEV MIN MAX.
Refer to the command syntax for frequencies for a description of these
commands.
Back to Sample Analyses list
IV. Regression
Sample question: Does confidence predict
student’s total score on the National Assessment of Educational Progress
test? To answer this question, you can run a simple linear regression.
-
Select Analyze > Regression > Linear from the menu
bar to open the Linear Regression window.
-
Highlight your dependent (or outcome) variable, total,
from the list of variables on the left, and click on the upper arrow
to move it into the Dependent box.
-
Highlight your independent (or predictor) variable, conf,
and move it into the Independents(s) box.
-
Click on OK to run the analysis. The results
are printed below.


-
The results of the analysis reveal that confidence does not
significantly predict the total NAEP score, F(1, 28) = .004, p
= .948, R2
= .000, B = -.328. Be sure that you can identify R, R2,
F, df, p (the p-level is in the column labeled
"Sig."), B, and t to explain why the results are not significant.
The Coefficients table also provides the necessary information to generate
the regression equation. For this example it is: total
= 592.488 - .328conf.
Command Syntax for Regression:
REGRESSION
/STATISTICS=COEFF OUTS R ANOVA
/DEPENDENT total
/METHOD=ENTER conf.
REGRESSION
/STATISTICS=COEFF OUTS R ANOVA - Refer to the command syntax
for frequencies for an explanation of this subcommand. To get a complete
list of the statistics offered for the regression analysis refer to the
help menu in SPSS (i.e., Select Help > Topics on the menu bar which will
open the Help Topics window. Click on the Index tab.
Type "regression" in the box. Regression will appear in the second
box. Highlight the Command Syntax under regression.
Click on the Display button.).
/DEPENDENT total - The "/dependent" subcommand identifies
your dependent variable.
/METHOD=ENTER conf. - The "/method=" subcommand identifies
the type of regression analysis (enter runs the general regression) as
well as identifies your independent or outcome variable(s).
Back to Sample Analyses list
V. Correlation
Sample question: Are there relationships between
students' scores on the National Assessment of Educational Progress for
math, their scores for writing, and their self-esteem? To answer this question,
you can run a correlation analysis.
-
Select Analyze > Correlate > Bivariate from the menu
bar. This will open the window Bivariate Correlations.
-
Highlight the three variables you want to correlate (write,
math, and esteem) and move them into the Variables box
by clicking on the arrow button. It does not matter which you move
first. Click on OK.
-
The results of a correlation analysis are printed out in
a matrix. To find the correlation between two variables, read the column
and row headings for a given cell. For example, the upper left cell is
the correlation of the variable math with itself--resulting in a
perfect correlation of 1.00. The upper right cell (r = .42) is the
correlation between math and write. The number below each
correlation is the p-value. The value of p tells you
if the correlation is significant. The last number (30), is
the sample size, n (i.e., the number of pairs of scores in the analysis).
Command Syntax for Correlation:
CORRELATIONS
/VARIABLES=math esteem write.
Refer to the command syntax for frequencies for a description of these
commands.
Back to Sample Analyses list
VI. One-sample t-test
Sample question: Is body mass index in a sample of Lewiston fourth-graders different than 25 (which is the lower limit of "obese")? To answer this question, you can run a one-sample t-test comparing the mean body mass index in your sample to the standard value (25, in this case).
- Select Analyze > Compare Means > One-Sample T test on the menu bar. This will open a window called One-Sample T Test.
- Body mass index is your Test Variable. Highlight bmi and use the arrow button to move it to the Test Variable(s) box.
- You want to compare to your standard BMI value of 25, so type "25" into the "test value" box.
- Click on OK to run the analysis.
- The first table of the printout contains descriptive statistics while the second table contains the results of a hypothesis test comparing your dependent variable to the standard value. Study the printout below and make sure you can identify n, M, and SD, as well as t, df, and p (p is in the column labeled "Sig. (2-tailed)").
Command Syntax for Two-sample t-test:
T-TEST
/TESTVAL=25
/MISSING=ANALYSIS
/VARIABLES=bmi
/CRITERIA=CIN (.95) .
T-TEST
/ TESTVAL=25 - The "/testval=" subcommand identifies the value to which you're comparing your sample. In this case we type 25 since this is the standard BMI number that we are interested in comparing the sample to.
/VARIABLES=bmi. - The "/variables=" subcommand identifies the dependent variable on which you would like to run a t-test.
Back to Sample Analyses list
VII. Two-sample independent t-test
Sample question: Are there differences between
males and females scores on the writing section of the National Assessment
of Educational Progress? To answer this question, you can run a two sample
independent t-test comparing the mean writing scores received by
women to the mean scores received by men.
-
Select Analyze > Compare Means > Independent-Samples T
test on the menu bar. This will open a window called Independent-Samples
T Test.
-
Writing score is your dependent variable, or Test Variable.
Highlight write and use the arrow button to move it to the
Test
Variable(s) box.
-
You want to look at differences in writing scores between
the two groups: females and males, so gender is your independent
or Grouping Variable. Highlight gender and click on the arrow
button to move it to the Grouping Variable box.
-
Finally, click on the button Define Groups. This opens
the box Define Groups which asks you to specify the possible values
of your grouping variable. Since you have coded gender to have the values
"1" and "2," you should enter these numbers for Group 1 and Group
2.
-
Click on Continue to return to the Independent-Samples
T Test window, and on OK to run the analysis.
-
The first table of the printout contains descriptive statistics
while the second table contains inferential statistics. Study the printout
below and make sure you can identify n, M, and SD for each
group, as well as t, df, and p (p is in the column
labeled "Sig. (2-tailed)"). In most cases you should use the row labeled
Equal
variances assumed to determine t, df, and p (see below).
-
When you run a t-test, SPSS includes a test called
"Levene's Test for Equality of Variances." You may recall that one of the
requirements of parametric statistical tests, such as the t-test,
is that the variances of the two groups being compared are approximately
equal. Levene's test checks this assumption. A significant value
of p indicates that the variances are significantly different from
one another. Violations of the assumption of homogeneity of variance do
not usually invalidate the t-test unless they are very large, but
if you get a significant Levene's test you should check with your teacher
and discuss the possibility of using a nonparametric test to analyze your
data. In this case the Levene's test was not significant, with p
= .701. Therefore, we use the Equal variances assumed row to determine
our t-test value: t(28) = 2.47, p = .02.

Command Syntax for Two-sample t-test:
T-TEST
GROUPS=gender(1 2)
/VARIABLES=write.
T-TEST
GROUPS=gender(1 2) - The "/groups=" subcommand identifies
the independent variable for your t-test. In this case we
type gender. The numbers within the parentheses represent the possible
values for the variable (in this case the possible values for gender are
1 and 2).
/VARIABLES=write. - The "/variables=" subcommand identifies
the dependent variables on which you would like to run a t-test.
Back to Sample Analyses list
VIII. One-way Analysis of Variance (ANOVA)
Sample question: Are there differences in students'
self-reported confidence to participate in class discussions based on the
type of high school attended? To answer this question you can run a one-way
ANOVA, with confidence to participate in class as the dependent variable
and high school type as the independent variable. Note that high school
type is not a true independent variable because it was not experimentally
manipulated.
-
Select Analyze > Compare Means > One-Way ANOVA from
the menu bar to open the One-Way ANOVA window.
-
Highlight your dependent variable, conf, from the
list of variables on the left, and click on the upper arrow button to move
it into the Dependent List box.
-
Highlight your independent variable, school, and click
on the lower arrow button to move it into the Factor box.
-
Click on the Options button and then on the square
next to the word Descriptive (a check will now appear in the box).
This will cause descriptive statistics for each group to print out along
with your ANOVA results. (If you don't do this, the printout will only
tell you if the overall ANOVA is significant, but it will not tell you
the means of each group.)
-
Click on Continue to return to the One-Way ANOVA
window.
-
Click on OK to run the analysis.
-
(Note that you can also run a one-way ANOVA by selecting
Analyze>
General Linear Models > Univariate. From here, you can do two-way
ANOVAs as well. See two-way ANOVA for details.)

-
Be sure you can identify n, M, SD, and range
for each of your three groups, as well as F, df, and p (the
p-level
is in the column labeled "F Prob."). In this case our F-test result
is: F(2, 27) = 7.58, p = .002.
-
Since the results of your one-way ANOVA are significant,
you will want to run post-hoc tests to determine between which groups your
significant differences are occurring. To do this, you need to go back
to the One-Way ANOVA window and click on the Post Hoc...
button at the bottom of the screen. This opens a window in which you can
select which post hoc test(s) you want to run. Select a test, then click
on Continue to return to the One-Way ANOVA window and on
OK
to run the analysis. Note that SPSS prints out the entire analysis
again, including ANOVA results and descriptive statistics. In the
future you can choose to run the post hoc tests when you run the initial
one-way ANOVA. However, remember that the post-hoc tests
cannot
be interpreted unless the F-value is significant. The printout
below resulted from selecting Tukey's honestly significant difference (repeat
of the ANOVA results and descriptive statistics are omitted).

-
The Multiple Comparisons table provides detailed information
concerning the post-hoc results. This table shows all possible comparisons
between the three groups. In the first row, the all female schools
are compared to the all male schools. The mean difference for this
comparison is -.2000 (i.e., the average confidence level for the all female
schools, 7.0000, is subtracted from the average confidence level for the
all male schools, 7.2000). To determine whether this mean difference
is statistically significant examine the Sig. Column which represents the
p-value.
The p-value is .93 suggesting that the groups are not different
from one another. This is also supported by the 95% confidence interval
which indicates that zero is within the lower and upper bounds. Following
this comparison, a comparison is made between the all female schools and
coed schools which shows a significant difference between these two groups,
p
= .01. You will notice that SPSS places a star next to mean difference
scores that differ significantly. The remaining rows provide the
results for the other two groups, i.e., all male schools and coed schools.
One deficit of SPSS is that it only tells you between which groups you
have significant differences and the p-levels, but it does not give
you the exact values of the post-hoc tests.
-
The second table is a summary table noting all differences
between groups. This table is set up to allow you to quickly note
group differences. The first column provides the three groups followed
by the n for each group. Following these two columns are the
subset columns. Groups that are significantly different from one
another will appear in different subset columns. This post hoc analysis
indicates that Group 3 differs significantly from Groups 1 and 2.
All other comparisons are non-significant. It is often beneficial
to examine this table first to determine group differences and then refer
to the Multiple Comparisons table for additional information.
Command Syntax for One-way ANOVA:
ONEWAY
conf BY school
/STATISTICS=DESCRIPTIVES
/POSTHOC = TUKEY .
ONEWAY
conf BY school - This statement indicates the independent
and dependent variable to be utilized when conducting the One-way ANOVA.
The dependent variable is listed first followed by the independent variable
with "By" separating the two.
/STATISTICS=DESCRIPTIVES - Refer to the command syntax for
frequencies for an explanation of this subcommand. To get a complete
list of the statistics offered for the One-way ANOVA refer to the help
menu in SPSS (i.e., Select Help > Topics on the menu bar which will open
the Help Topics window. Click on the Index tab.
Type "Oneway" in the box. Oneway will appear in the second box.
Highlight the Command Syntax under Oneway. Click on the Display
button.).
/POSTHOC = TUKEY. - The "/posthoc=" subcommand will generate
the post hoc test listed after the equal sign (in this case Tukey's).
For a complete list of post hoc tests refer to the One-way ANOVA Command
Syntax in the SPSS help files.
Back to Sample Analyses list
IX. Two-way ANOVA
Sample question: Are there differences in students'
writing scores based on their gender and levels of self-esteem? To answer
this question you can run a two-way ANOVA, with writing scores as the dependent
variable and gender and self-esteem as the independent variables.
-
Select Analyze> General Linear Models > Univariate
from the menu bar. This will open a window called Univariate.
-
Highlight your dependent variable, write, from the
list of variables on the left, and click on the upper arrow
to move
it into the Dependent Variable box.
-
Highlight your first independent variable, gender,
and move it into the Fixed Factor(s) box.
-
Repeat above step for your second independent variable, esteem2.
-
Click on the Options button on the left of the table
and then on the square next to Descriptive statistics.
Click on Continue.
-
Click on OK to run the analysis. The results
are printed below.

-
Descriptive statistics and the test of equality of variance
are provided in the first two tables. The two-way ANOVA table (i.e.,
the table entitled, “Tests of Between-Subjects Effects”) provides results
of both the main and interaction effects. The interaction effect examines
whether there are differences in writing scores based on both gender and
level of self-esteem (e.g., females with high self-esteem having a higher
writing score than males with high self-esteem while both males and females
with low self-esteem have lower writing scores). Be sure you can identify
n,
M, and SD for each of your independent variables along with
your interaction effect, as well as F, df, and p (the
p-value
is in the column labeled "Sig.").
-
The interaction effect should be examined first to determine
if it is significant. In this case, the interaction effect is not
significant, F(1, 26) = 1.06, p = .31. Following the
examination of the interaction effect, inspect the main effect results.
Examination of the main effect analyses reveals no significant differences
related to gender or level of self-esteem.
Command Syntax for Two-way ANOVA:
UNIANOVA
write BY gender esteem2
/PRINT = DESCRIPTIVE
/DESIGN = gender esteem2 gender*esteem2.
UNIANOVA
write BY gender esteem2 - This statement indicates
the independent and dependent variable to be utilized when conducting the
Two-way ANOVA. The dependent variable is listed first followed by
the independent variable(s) with "By" separating the two.
/PRINT = DESCRIPTIVE - The "/print=" subcommand operates
similar to the "/statistic=" subcommand in the One-Way ANOVA. To
get a complete list of the statistics offered for the Two-way ANOVA refer
to the help menu in SPSS (i.e., Select Help > Topics on the menu bar which
will open the Help Topics window. Click on the Index
tab. Type "UNIANOVA" in the box. UNIANOVA will appear in the
second box. Highlight the Command Syntax under UNIANOVA.
Click on the Display button.).
/DESIGN = gender esteem2 gender*esteem2. - The "/design="
subcommand identifies the main and interaction effects to be analyzed.
To examine main effects you just need to list the variable name (e.g.,
gender or esteem2). To examine interaction effects you list the variables
you want to interact with a "*" between the variables (e.g., gender*esteem2).
If you are interested in running post hoc tests the following subcommand
could be entered between the "/print=" and "/design=" subcommands: /POSTHOC
= gender (TUKEY). This differs slightly from the One-way ANOVA
in that the independent variable for which you would like post hoc tests
needs to be indicated. Please note that this is just an example.
Post hoc test are not generated when the independent variable has only
two levels.
Back to Sample Analyses
list
X. Chi-square
Sample question: Do males and females choose specific
responses to the statement "On the whole, I am satisfied with myself" with
the same frequency? To answer this question, you can run a Chi-square test.
There are two different ways to do chi-square analyses on SPSS. If you
select Analyze > Non-Parametric Tests > Chi-Square, you will only
be able to do a one-way chi-square. Use the following procedure for a two-way:
-
Select Analyze > Descriptive Statistics > Crosstabs
from the menu bar to open the Crosstabs window.
-
Highlight the factor you want to appear in rows of your chi-square
matrix (we will use esteem). Use the arrow button to move
this to the Row(s) box. It does not matter which factor you put
in rows and which in columns.
-
Highlight the factor you want to appear in columns (gender)
and move it to the Column(s) box. If you click OK now, you will
get cell frequencies, but you will not get the Chi-square analysis.
-
To run the chi-square analysis, click on the Statistics
button in the Crosstabs window to open the Crosstabs: Statistics
window.
Click on the box next to Chi-square. Click on Continue.
-
If you would like expected cell frequencies and percentages,
click on the Cells button in the Crosstabs window to open
the Crosstabs: Cell Display window. Click on the box
next to Expected in the Counts table and on the box next
to Row and Column in the Percentages table. Click on Continue.
-
Click on OK to run the analysis. The results
are printed below.

-
The first table provides a frequency count of the data broken
down by gender and esteem response. Be sure you understand the numbers
in the matrix. The chi-square you learned in 218 is in the row labeled
"Pearson Chi-Square." The p-level is in the column labeled "Asymp.
Sig." In this case the Chi-Square result is: X2
(3, N = 30) = 8.25, p = .04. This suggests that differences
exist in the cells. Visual inspection of the data show that females
have a greater likelihood of responding “somewhat agree” to the self-esteem
question while males have a greater likelihood of responding “strongly
agree” to the self-esteem question.
-
Note: The Likelihood Ratio and Linear-by-Linear Association
test are other non-parametric tests for differences between proportions.
Command Syntax for Chi-Square:
CROSSTABS
/TABLES=esteem BY gender
/STATISTIC=CHISQ
/CELLS= COUNT EXPECTED ROW COLUMN .
CROSSTABS
/TABLES=esteem BY gender - The "/tables=" subcommand
generates a table which contains a frequency count between two or more
variables. The order in which the variables are inputted does not
matter.
/STATISTIC=CHISQ - Refer to the command syntax for frequencies
for an explanation of this subcommand. To get a complete list of
the statistics offered for the Chi-Square refer to the help menu in SPSS
(i.e., Select Help > Topics on the menu bar which will open the Help
Topics window. Click on the Index tab. Type "Crosstabs"
in the box. Crosstabs will appear in the second box. Highlight
the Command Syntax under Crosstabs. Click on the Display button.).
/CELLS= COUNT EXPECTED ROW COLUMN . - The "/cells=" subcommand
allows you to include not only the frequency count (i.e., COUNT) but also
other observed or expected values. In this case expected frequency
counts (EXPECTED), row percentages (ROW), and column percentages (COLUMN)
are generated. A full list of the observed and expected values can
be found in the Crosstabs Command Syntax in the SPSS help files.
Back to Sample Analyses list
© 2004 Bates College. All rights reserved.
Maintained by Brian Pfohl