Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 34

What's in this guide?

Our written step-by-step tutorials are organized into sections. Users can work through the tutorials in order or skip through to
topics of interest.
Section 1: Intro to the SPSS Environment is intended for new users of SPSS. In this section, you'll learn how to:
 Navigate the SPSS interface using the drop-down menus or syntax.
 Create a new dataset or import data from a file.
Section 2: Working with Data covers data manipulation and cleaning of all kinds. In this section, you'll learn how to:
 Create, modify, or compute new variables.
 Manipulate a dataset by splitting, merging, or transposing techniques.
Section 3: Exploring the Data is intended for users who have mastered the skills in Section 1 and are ready to begin data
analysis. In this section, you'll learn how to:
 Generate descriptive statistics for numeric variables.
 Create frequency tables and cross-tabulations of categorical variables.
 Graph the distributions or relationships of variables.
 Interpret these measures.
Section 4: Analyzing the Data is intended for users who are ready to begin data analysis that incorporates hypothesis testing.
In this section, you'll learn how to conduct and interpret various analyses, including:
 Associations (Chi-Square, Pearson's Correlation)
 Comparing means (One Sample t Test, Independent Samples t Test, Paired Samples t Test, One-Way ANOVA)
 Predictive models (Multiple Regression, Logistic Regression, Ordinal Regression)

GETTING STARTED WITH SPSS


Part 1: The SPSS Environment
SPSS is a user-friendly program that facilitates data management and statistical analyses. The first section of this tutorial will
provide a basic introduction to navigating the SPSS program.
 Interacting with SPSS
This tutorial covers the various screens of SPSS, and discusses the two ways of interacting with SPSS: through the
drop-down menus, or through syntax.
 The Data View Window
Variables are observable and measurable traits of interest. Cases are records of information on one or more variables.
This tutorial discusses how Cases and Variables are oriented in the Data View window.
 Using SPSS Syntax
SPSS syntax is a programming language unique to the SPSS environment. It allows you to fine-tune statistical analysis
and data manipulation in ways that would be tedious, difficult, or impossible to do through the drop-down menus. This
tutorial covers the basics of understanding SPSS syntax.
Part 2: Data Creation and Import
In order to use SPSS, you need data. You can either create data in SPSS or import data into SPSS from a file. Creating data
means that you will enter the variables and values manually into SPSS to create a new dataset. Importing data means that you
will use an existing data file that someone has already prepared and simply load it into SPSS. We cover both data creation and
data importation in the following sections.
 Data Creation in SPSS
This tutorial covers how to create a new dataset in SPSS by manually entering data. Also covered is the difference
between row numbers (which are a part of the spreadsheet) and ID variables (which are a part of the dataset and act
as case identifiers).
 Importing Data into SPSS
This tutorial describes how to import data stored in an external file into SPSS.
Part 3: Variables in SPSS
Variables are a key part of all datasets. They signify how your research was conducted, and dictate what types of analysis
methods are appropriate. For this reason, it is important to know what variables are; how to define, compute, and recode
them; and how to work with special types of variables, such as dates. This section of the tutorial will cover each of these
topics.
 Variable Types
A variable's type determines if a variable numeric or character; quantitative or qualitative. It also dictates what type of
statistical analysis methods are appropriate for that data. This tutorial covers the variable types that SPSS recognizes.
 Date-Time Variables
Date-Time variables in SPSS are handled differently than other types of variables. This tutorial covers how SPSS treats
Date-Time variables, and also covers the Date and Time Wizard .
 Defining Variables
Variable definitions include a variable's name, type, label, formatting, role, and other attributes. This tutorial covers
two different ways to define variable properties in SPSS, especially custom missing values and value labels for
categorical variables.
 Creating a Codebook
A codebook summarizes key information about the variables in a research project. This tutorial shows how to create a
codebook from an existing SPSS data file.

WORKING WITH DATA


Part 1: Working with Variables
Most of the time, you'll need to make modifications to your variables before you can analyze your data. These types of
modifications can include changing a variable's type from numeric to string (or vice versa), merging the categories of a nominal
or ordinal variable, dichotomizing a continuous variable at a cut point, or computing a new summary variable from existing
variables. This section will focus on transformations applied to individual variables, particularly recoding and computing new
variables.
 Computing Variables
The "Compute Variable" command allows you to create new variables from existing variables by applying formulas.
This tutorial shows how the "Compute Variable" command can compute a variable using an equation, a built-in
function, or conditional logic.
 Recoding (Transforming) Variables
Recoding a variable can be used to transform an existing variable into a different form based on certain criteria. This
tutorial covers the "Recode into Different Variable" and "Recode into Same Variable" commands.
 Automatic Recode
If you have a string variable and have used blanks to indicate missing values, you may notice that SPSS does not
automatically recognize the blank observations as missing. To fix this, you'll need to use Automatic Recode. More
broadly, Automatic Recode is also used to quickly convert a string categorical variable into a numeric categorical
variable.
 Rank Cases
In its simplest form, a rank transform converts a set of data values by ordering them from smallest to largest, and then
assigning a rank to each value. In SPSS, the Rank Cases procedure can be used to compute the rank transform of a
variable.
Part 2: Data Management
Managing a dataset often includes tasks such as sorting data, subsetting data into separate samples, merging multiple sources
of data, aggregating of data based on some key indicator, or restructuring a dataset. These types of data management tasks
are sometimes called data cleaning, data munging, or data  wrangling. This section covers these types of "cleaning" tasks.
 Sorting Data
Sorting a dataset rearranges the rows with respect to one or more variables. Sorting makes it convenient for reading
the data; additionally, several SPSS procedures require the data to be sorted in a certain way before the procedure can
run. This tutorial discusses how to sort data using the drop-down menus in SPSS.
 Splitting Data
In SPSS, the "Split File" command can be used to organize statistical results into groups for comparison. Split File is
used when you want to run statistical analyses with respect to different groups, but don't necessarily want to separate
your data into two different files. This tutorial shows you how to use the Split File command in SPSS and what
situations it is useful in.
 Weighting Cases
Sometimes, you don't have raw data available to you -- you may only have a frequency table indicating the types of
responses and how many times they occurred. Alternatively, you may be working with a dataset that contains
a weighting variable. This tutorial shows how to use the Weighting Cases command in SPSS to handle both of these
situations.
 Partitioning Data
(Coming soon) The Select Cases procedure is used when you want to create a new dataset by extracting cases from
an existing dataset. Unlike the Split File option, Select Cases affects the data itself, rather than the output. This tutorial
covers several applications of Select Cases.

EXPLORING DATA
Introduction
Before doing any kind of statistical testing or model building, you should always examine your data using summary statistics
and graphs. This process is called exploratory data analysis, and it's a crucial part of every research project. Exploratory data
analysis is about "getting to know" your data: which values are typical, which values are unusual; where is it centered, how
spread out is it; what are its extremes. More importantly, it's an opportunity to identify and correct any problems in your data
that would affect the conclusions you draw from your analysis.
How do we "get to know" our data? The answer is different depending on whether our variables are numeric or categorical. In
this section, we'll demonstrate which statistics and SPSS procedures to use for both types of data.
Part 1: Descriptive Statistics for Continuous Variables
When summarizing a quantitative (continuous/interval/ratio) variable, we are typically interested in things like:
 How many observations were there? How many cases had missing values? (N valid; N missing)
 Where is the "center" of the data? (Mean, median)
 Where are the "benchmarks" of the data? (Quartiles, percentiles)
 How spread out is the data? (Standard deviation/variance)
 What are the extremes of the data? (Minimum, maximum; Outliers)
 What is the "shape" of the distribution? Is it symmetric or asymmetric? Are the values mostly clustered about the
mean, or are there many values in the "tails" of the distribution? (Skewness, kurtosis)
In Part 1, we discuss how to explore quantitative (continuous/interval/ratio scale) data using the Descriptives, Compare
Means, Explore, and Frequencies procedures. Each of these procedures offers different strengths for summarizing continuous
variables. The Descriptives and Frequencies commands provide summary statistics for an entire sample, while the Explore and
Compare Means commands can produce descriptive statistics for subsets of the sample.
 Descriptives
Descriptives (Analyze > Descriptive Statistics > Descriptives) is best to obtain quick summaries of numeric variables, or
to compare several numeric variables side-by-side.
 Compare Means
Compare Means (Analyze > Descriptive Statistics > Descriptives) is best used when you want to summarize several
numeric variables across the categories of a nominal or ordinal variable. It is especially useful for summarizing numeric
variables simultaneously across multiple factors.
 Explore
Explore (Analyze > Descriptive Statistics > Explore) is best used to deeply investigate a single numeric variable, with or
without a categorical grouping variable. It can produce a large number of descriptive statistics, as well as confidence
intervals, normality tests, and plots.
 Frequencies Part I (Continuous Variables)
Frequencies (Analyze > Descriptive Statistics > Frequencies) is typically used to analyze categorical variables, but can
also be used to obtain percentile statistics that aren't otherwise included in the Descriptives, Compare Means, or
Explore procedures.
Part 2: Descriptive Statistics for Categorical Variables
When summarizing qualitative (nominal or ordinal) variables, we are typically interested in things like:
 How many cases were in each category? (Counts)
 What proportion of the cases were in each category? (Percentage, valid percent, cumulative percent)
 What was the most frequently occurring category (i.e., the category with the most observations)? (Mode)
In Part 2, we describe how to obtain descriptive statistics for categorical variables using
the Frequencies and Crosstabs procedures.
 Frequencies Part II (Categorical Variables)
Frequencies (Analyze > Descriptive Statistics > Frequencies) is primarily used to create frequency tables, bar charts,
and pie charts for a single categorical variable.
 Crosstabs
The Crosstabs procedure (Analyze > Descriptive Statistics > Crosstabs) is used to create contingency tables, which
describe the interaction between two categorical variables. This tutorial covers the descriptive statistics aspects of the
Crosstabs procedure, including and row, column, and total percents.
 Multiple Response Sets / Working with "Check All That Apply" Survey Data
Check-all-that-apply questions on surveys are recorded as a set of binary indicator variables for each checkbox option.
Frequency tables and crosstabs alone don't capture the dependent nature of this data -- and that's where Multiple
Response Sets come in.

ANALYZING DATA
Part 1: Inferential Statistics for Association
In Part I, we cover common inferential statistics for testing the relationship or association between variables.
 Pearson Correlation
Pearson correlation (Analyze > Correlate > Bivariate) is used to assess the strength of a linear relationship between
two continuous numeric variables.
 Chi-square Test of Independence
The Chi-Square Test of Independence is used to test if two categorical variables are independent of each other.
Part 2: Inferential Statistics for Comparing Means
In Part 2, we cover common inferential statistics for testing and comparing means.
 One Sample t Test
One sample t tests (Analyze > Compare Means > One Sample T Test) are used to test if the mean of a continuous
numeric variable is equal to a hypothesized value of the population mean.
 Paired-Samples T Test
Paired t tests (Analyze > Compare Means > Paired-Samples T Test) are used to test if the means of two paired
measurements, such as pretest/posttest scores, are significantly different.
 Independent Samples T Test
Independent samples t tests (Analyze > Compare Means > Independent-Samples T Test) are used to test if the means
of two independent groups are significantly different.
 One-Way ANOVA
One-Way ANOVA (Analyze > Compare Means > One-Way ANOVA) is used to test if the means of two or more groups
are significantly different.

SPSS TUTORIALS: Pearson Correlation


The bivariate Pearson Correlation measures the strength and direction of linear relationships between pairs of continuous
variable.

PEARSON CORRELATION
The bivariate Pearson Correlation produces a sample correlation coefficient, r, which measures the strength and
direction of linear relationships between pairs of continuous variable. By extension, the Pearson Correlation evaluates whether
there is statistical evidence for a linear relationship among the same pairs of variables in the population correlation coefficient,
p a(“rho”). The Pearson Correlation is a parametric measure.
This measure is also known as:
1. Pearson’s Correlation
2. Pearson Product-Moment Correlation (PPMC)

COMMON USES
The bivariate Pearson Correlation is commonly used to measure the following:
1. Whether a statistically significant linear relationship exist between two continuous variables.
2. The strength of a linear relationship (i.e., how close the relationship is to being a perfectly straight line)
3. The direction of a linear relationship (increasing or decreasing)
Note: The bivariate Pearson Correlation cannot address non-linear relationship or relationship among categorical variables. If
you wish to understand relationship that involve categorical variables and/or non-linear relationships, you will need to choose
another measure of association.
Note: The bivariate Pearson Correlation only reveals associations among continuous variables. The bivariate Pearson
Correlation does not provide any inferences about causation, no matter how large the correlation coefficient is.

DATA REQUIREMENTS
To use Pearson Correlation, your data must meet the following requirements:
1. Two or more continuous variables (i.e., interval or ration level)
2. Cases must have non-missing values on both variables.
3. Linear relationship between variables.
4. Independent cases (i.e., independence of observations)
 There is no relationship between the values of variables between cases.
This means that:
a. The values for all variables across cases are related.
b. For any case, the value for any variable cannot influence the value of any variable for other cases.
c. No case can influence another case on any variable.
 The bivariate Pearson Correlation coefficient and corresponding significance test are not robust when
independence is violated.
5. Bivariate normality
 Each pair of variables is bivariately normally distributed.
 Each pair of variables is bivariately normally distributed at all levels of the other variable(s).
 This assumption ensures that the variables are linearly related; violations of this assumption may indicate
that non-linear relationships among variables exist. Linearity can be assessed visually using a scatter plot
of the data.
6. Random sample of data from the population.
7. No outliers.

HYPOTHESES
The null hypothesis (Ho) and the alternative hypothesis (H1) of the significance test for correlation can be expressed in
the following ways, depending on whether a one-tailed or two-tailed test is requested:

Two-tailed significance test:


Ho: p = 0 (“the population correlation coefficient is 0, there is no association”)
H1: p ≠ 0 (“the population correlation coefficient is not 0, a non-zero correlation could exist”)

One-tailed significance test:


Ho: p = 0 (“the population correlation coefficient is 0, there is no association”)
H1: p > 0 (“the population correlation coefficient is greater than 0, a positive correlation could exist”)
H1: p ˂ 0 (“the population correlation coefficient is less than 0, a negative correlation could exist”)

Where p is the population correlation coefficient.

Test Statistics
The sample correlation coefficient between two variables x and y is denoted r or rxy, and can be computed as :
cov ( x , y )
r xy =
√ var ( x ) √ var ( y )
Where cov(x,y) is the sample covariance of x and y, var (x) is the sample variance of x, and var (y) is the sample variance of
y.

Correlation can take on any value in the range [1,-1]. The sign of the correlation coefficient indicates the direction of the
relationship, while the magnitude of the correlation (how close it is to -1 or +1) indicates the strength of the relationship.
 -1: perfectly negative linear relationship
 0: no relationship
 +1: perfectly positive linear relationship
Note: The direction and strength of a correlation are two distinct properties. The scatterplots below show correlations that are
r = +0.90, r = 0.00, and r = -0.90, respectively. The strength of the non-zero correlations are the same; 0.90. But the
direction of the correlations is different: a negative correlation corresponds to a decreasing relationship, while and a positive
correlation corresponds to an increasing relationship.

Figure 1
Note that the r = 0.00 correlation has no discernable increasing or decreasing linear pattern in this particular graph. However,
keep in mind that Pearson Correlation is only capable of detecting linear associations, so it possible to have a pair of variables
with a strong nonlinear relationship and a small Pearson Correlation coefficient. It is good practice to create scatterplots of
your variables to corroborate your correlation coefficients.

DATA SET UP
Your dataset should include two or more continuous numeric variables, each defined as scale, which will be used in the
analysis.
Each row in the dataset should represent one unique subject, person, or unit. All of the measurements taken on that
person or unit should appear on multiple rows—for example, if you have measurements from different time points on separate
rows—you should reshape your data to “wide” format before you compute the correlations.

RUN A BIVARIATE CORRELATION


To run a bivariate Pearson Correlation in SPSS, Click Analyze>Correlate>Bivariate

Figure 2

The Bivariate Correlations window opens, where you will specify the variables to be used in the analysis. All of the variables in
your dataset appear in the list on the left side. To select variables for the analysis, select the variables in the list on the left and
click the blue arrow button to move them to the right, in the Variables field.

Figure 3
A Variables: The variables to be used in the bivariate Pearson Correlation. You must select at least two continuous variables,
but may select more than two. The test will produce correlation coefficients for each pair of variables in the list.
B Correlation Coefficients: There are multiple types of correlation coefficients. By default, Pearson is selected. Selecting
Pearson will produce the test statistics for a bivariate Pearson Correlation.
C Test of Significance: Click Two-tailed or One-tailed, depending on your desired significance test. SPSS uses a two tailed
test by default.
D Flag significant correlations: Checking this option will include asterisks (**) next to statistically significant correlations in
the output. By default, SPSS marks statistically significance at the alpha = 0.05 and alpha = 0.01 levels, but not at the alpha =
0.001 level (which is treated as alpha = 0.01)
E Options: Clicking Options will open a window where you can specify which statistics to include (i.e., Means and
standard deviations, Cross-product deviations and covariances) and how to address Missing Values (i.e., Exclude
cases pairwise or exclude cases listwise). Note that the pairwise/listwise setting does not affect your computations if you
are only entering two variable, but can make a very large difference if you are entering three or more variables into the
correlation procedure.

Figure 4

Example: Understanding the linear association between weight and height

PROBLEM STATEMENT
Perhaps you would like to test whether there is a statistically significant linear relationship between two continuous
variables, weight and height (and by extension, infer whether the association is significant in the population). You can use a
bivariate Pearson Correlation to test whether there is a statistically significant linear relationship between height and weight,
and to determine the strength and direction of the association.

BEFORE THE TEST


In the sample data, we will use two variables: “Height and Weight.” The variable “Height” is a continuous measure of
height in inches and exhibits a range of values from 55.00 to 84.41 (Analyze>Descriptive Statistics>Descriptive). The
variable “Weight” is a continuous measure of weight in pounds and exhibits a range of values from 101.71 to 350.07.
Before we look at the Pearson Correlations, we should look at the scatterplots of our variables to get an idea of what
to expect. In particular, we need to determine if it’s reasonable to assume that our variables have linear relationships. Click
Graphs>Legacy Dialogs>Scatter/Dot. In the Scatter/Dot window, click Simple Scatter, then click Define. Move variable
Height to the X axis box, and move variable Weight to the Y axis box. When finished, click OK.

Figure 5

To add a linear fit like one depicted, double click on the plot in the Output Viewer to open the Chart Editor. Click
Elements>Fit Line at Total. In the Properties window, make sure the Fit Method is set to Linear, then click Apply. (Notice
that adding the linear regression trend line will also add the R-squared value in the margin of the plot. If we take the square
root of this number, it should match the value of the Pearson correlation we obtain.
From the scatterplot, we can see that as the Height increases, Weight also tends to increase. There does appear to be
some linear relationship.

RUNNING THE TEST


To run the bivariate Pearson Correlation, click Analyze>Correlate>Bivariate. Select the variables Height and
Weight and move them to the Variables box. In the Correlation Coefficients area, select Pearson. In the Test of
Significance area, select your desired significance test, two-tailed or One-tailed. We will select a two-tailed significance test
in this example. Check the box next to Flag significant correlations.
Click OK to run the bivariate Pearson Correlation. Output for the analysis will display in the Output Viewer.

OUTPUT
Tables
The results will display the correlations in a table, labeled Correlations.

Figure 6

A Correlation of Height with itself (r =1), and the number of nonmissing observations for height (n=408).
B Correlation of height and weight (r =0.513), based on n=354 observations with pairwise nonmissinfg values.
C Correlation of height and weight (r =0.513), based on n=354 observations with pairwise nonmissinfg values.
D Correlation of Weight with itself (r =1), and the number of nonmissing observations for weight (n=376).

The important cells we want to look at either B or C. (Cells B and C are identical, because they include information
about the same pair of variables.) Cells B and C contain the correlation coefficient for the correlation between height and
weight, its p-value, and the number of complete pairwise observations that the calculation was based on.
The correlations in the main diagonal (cells A and D) are equal to 1. This is because a variable is always perfectly
correlated with itself. Notice, however, that the sample sizes are different in cell A (n=408) versus cell D (n=376). This is
because of missing data—there are more missing observations for variable weight than there are for variable height.
If you have opted to flag significant correlations, SPSS will mark a 0.05 significance level with one asterisks (*) and a
0.01 significance level with two asterisks (**). In cell B (repeated in cell C), we can see that the Pearson Correlation coefficient
for height and weight is 0.513, which is significant (p˂0.001 for a two-tailed test), based on 354 complete observations (i.e.,
cases with nonmissing values for both the height and weight).

DECISION AND CONCLUSION


Based on the results, we can state the following:
 Weight and height have a statistically significant linear relationship ( r=0.513,p˂0.001)
 The direction of relationship is positive (i.e., height and weight are positively correlated), meaning that
these variables tend to increase together (i.e., greater height is associated with greater weight).
 The magnitude, or strength, of the association is approximately moderate (.3˂|r| ˂.5)

SPSS TUTORIALS: Chi-Square Test of Independence


Chi-Square Test of Independence
The Chi-Square Test of Independence determines whether there is an association between categorical variables (i.e., whether
the variables are independent or related). It is a nonparametric test.
This test is also known as:
 Chi-Square Test of Association.
This test utilizes a contingency table to analyze the data. A contingency table (also known as a cross-tabulation, crosstab,
or two-way table) is an arrangement in which data is classified according to two categorical variables. The categories for one
variable appear in the rows, and the categories for the other variable appear in columns. Each variable must have two or more
categories. Each cell reflects the total count of cases for a specific pair of categories.
There are several tests that go by the name "chi-square test" in addition to the Chi-Square Test of Independence. Look for
context clues in the data and research question to make sure what form of the chi-square test is being used.
Common Uses
The Chi-Square Test of Independence is commonly used to test the following:
 Statistical independence or association between two or more categorical variables.
The Chi-Square Test of Independence can only compare categorical variables. It cannot make comparisons between
continuous variables or between categorical and continuous variables. Additionally, the Chi-Square Test of Independence only
assesses associations between categorical variables, and can not provide any inferences about causation.
If your categorical variables represent "pre-test" and "post-test" observations, then the chi-square test of independence is not
appropriate. This is because the assumption of the independence of observations is violated. In this situation, McNemar's
Test is appropriate.
Data Requirements
Your data must meet the following requirements:
1. Two categorical variables.
2. Two or more categories (groups) for each variable.
3. Independence of observations.
 There is no relationship between the subjects in each group.
 The categorical variables are not "paired" in any way (e.g. pre-test/post-test observations).
4. Relatively large sample size.
 Expected frequencies for each cell are at least 1.
 Expected frequencies should be at least 5 for the majority (80%) of the cells.
Hypotheses
The null hypothesis (H0) and alternative hypothesis (H1) of the Chi-Square Test of Independence can be expressed in two
different but equivalent ways:
H0: "[Variable 1] is independent of [Variable 2]"
H1: "[Variable 1] is not independent of [Variable 2]"
OR
H0: "[Variable 1] is not associated with [Variable 2]"
H1:  "[Variable 1] is associated with [Variable 2]"
Test Statistic
The test statistic for the Chi-Square Test of Independence is denoted Χ2, and is computed as:
χ2=∑i=1R∑j=1C(oij−eij)2eijχ2=∑i=1R∑j=1C(oij−eij)2eij
where
oijoij is the observed cell count in the ith row and jth column of the table
eijeij is the expected cell count in the ith row and jth column of the table, computed as
eij=row i total∗col j totalgrand totaleij=row i total∗col j totalgrand total
The quantity (oij - eij) is sometimes referred to as the residual of cell (i, j), denoted rijrij.
The calculated Χ2 value is then compared to the critical value from the Χ2 distribution table with degrees of freedom df = (R -
1)(C - 1) and chosen confidence level. If the calculated Χ2 value > critical Χ2 value, then we reject the null hypothesis.
Data Set-Up
There are two different ways in which your data may be set up initially. The format of the data will determine how to proceed
with running the Chi-Square Test of Independence. At minimum, your data should include two categorical variables
(represented in columns) that will be used in the analysis. The categorical variables must include at least two groups. Your
data may be formatted in either of the following ways:
IF YOU HAVE THE RAW DATA (EACH ROW IS A SUBJECT):

 Cases represent subjects, and each subject appears once in the dataset. That is, each row represents an observation
from a unique subject.
 The dataset contains at least two nominal categorical variables (string or numeric). The categorical variables used in
the test must have two or more categories.
IF YOU HAVE FREQUENCIES (EACH ROW IS A COMBINATION OF FACTORS):
An example of using the chi-square test for this type of data can be found in the Weighting Cases tutorial.

 Cases represent the combinations of categories for the variables.


 Each row in the dataset represents a distinct combination of the categories.
 The value in the "frequency" column for a given row is the number of unique subjects with that combination of
categories.
 You should have three variables: one representing each category, and a third representing the number of occurrences
of that particular combination of factors.
 Before running the test, you must activate Weight Cases, and set the frequency variable as the weight.
Run a Chi-Square Test of Independence
In SPSS, the Chi-Square Test of Independence is an option within the Crosstabs procedure. Recall that the Crosstabs
procedure creates a contingency table or two-way table, which summarizes the distribution of two categorical variables.
To create a crosstab and perform a chi-square test of independence, click Analyze > Descriptive Statistics > Crosstabs.
A  Row(s): One or more variables to use in the rows of the crosstab(s). You must enter at least one Row variable.

B  Column(s): One or more variables to use in the columns of the crosstab(s). You must enter at least one Column variable.
Also note that if you specify one row variable and two or more column variables, SPSS will print crosstabs for each pairing of
the row variable with the column variables. The same is true if you have one column variable and two or more row variables,
or if you have multiple row and column variables. A chi-square test will be produced for each table. Additionally, if you include
a layer variable, chi-square tests will be run for each pair of row and column variables within each level of the layer variable.
C  Layer: An optional "stratification" variable. If you have turned on the chi-square test results and have specified a layer
variable, SPSS will subset the data with respect to the categories of the layer variable, then run chi-square tests between the
row and column variables. (This is not equivalent to testing for a three-way association, or testing for an association between
the row and column variable after controlling for the layer variable.)

D  Statistics: Opens the Crosstabs: Statistics window, which contains fifteen different inferential statistics for comparing
categorical variables. To run the Chi-Square Test of Independence, make sure that the Chi-square box is checked off.
E  Cells: Opens the Crosstabs: Cell Display window, which controls which output is displayed in each cell of the crosstab.
(Note: in a crosstab, the cells  are the inner sections of the table. They show the number of observations for a given
combination of the row and column categories.) There are three options in this window that are useful (but optional) when
performing a Chi-Square Test of Independence:

1 Observed: The actual number of observations for a given cell. This option is enabled by default.

2 Expected: The expected number of observations for that cell (see the test statistic formula).

3 Unstandardized Residuals: The "residual" value, computed as observed minus expected.

F  Format: Opens the Crosstabs: Table Format window, which specifies how the rows of the table are sorted.

Example: Chi-square Test for 3x2 Table


PROBLEM STATEMENT
In the sample dataset, respondents were asked their gender and whether or not they were a cigarette smoker. There were
three answer choices: Nonsmoker, Past smoker, and Current smoker. Suppose we want to test for an association between
smoking behavior (nonsmoker, current smoker, or past smoker) and gender (male or female) using a Chi-Square Test of
Independence (we'll use α  = 0.05).
BEFORE THE TEST
Before we test for "association", it is helpful to understand what an "association" and a "lack of association" between two
categorical variables looks like. One way to visualize this is using clustered bar charts. Let's look at the clustered bar chart
produced by the Crosstabs procedure.
This is the chart that is produced if you use Smoking as the row variable and Gender as the column variable (running the
syntax later in this example):
The "clusters" in a clustered bar chart are determined by the row variable (in this case, the smoking categories). The color of
the bars is determined by the column variable (in this case, gender). The height of each bar represents the total number of
observations in that particular combination of categories.
This type of chart emphasizes the differences within the categories of the row variable. Notice how within each smoking
category, the heights of the bars (i.e., the number of males and females) are very similar. That is, there are an approximately
equal number of male and female nonsmokers; approximately equal number of male and female past smokers; approximately
equal number of male and female current smokers. If there were an association between gender and smoking, we would
expect these counts to differ between groups in some way.
RUNNING THE TEST
1. Open the Crosstabs dialog (Analyze > Descriptive Statistics > Crosstabs).
2. Select Smoking as the row variable, and Gender as the column variable.
3. Click Statistics. Check Chi-square, then click Continue.
4. (Optional) Check the box for Display clustered bar charts.
5. Click OK.
Syntax

CROSSTABS
/TABLES=Smoking BY Gender
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ
/CELLS=COUNT
/COUNT ROUND CELL
/BARCHART.

OUTPUT
Tables
The first table is the Case Processing summary, which tells us the number of valid cases used for analysis. Only cases with
non-missing values for both smoking behavior and gender can be used in the test.

The next tables are the cross-tabulation and chi-square test results.
The key result in the Chi-Square Tests table is the Pearson Chi-Square.
 The value of the test statistic is 3.171.
 The footnote for this statistic pertains to the expected cell count assumption (i.e., expected cell counts are all greater
than 5): no cells had an expected count less than 5, so this assumption was met.
 Because the test statistic is based on a 3x2 cross-tabulation table, the degrees of freedom (df) for the test statistic is
df=(R−1)∗(C−1)=(3−1)∗(2−1)=2∗1=2df=(R−1)∗(C−1)=(3−1)∗(2−1)=2∗1=2
.
 The corresponding p-value of the test statistic is p = 0.205.
DECISION AND CONCLUSIONS
Since the p-value is greater than our chosen significance level ( α  = 0.05), we do not reject the null hypothesis. Rather, we
conclude that there is not enough evidence to suggest an association between gender and smoking.
Based on the results, we can state the following:
 No association was found between gender and smoking behavior (Χ2(2)> = 3.171, p = 0.205).
Example: Chi-square Test for 2x2 Table
PROBLEM STATEMENT
Let's continue the row and column percentage example from the Crosstabs tutorial, which described the relationship between
the variables RankUpperUnder  (upperclassman/underclassman) and LivesOnCampus  (lives on campus/lives off-campus).
Recall that the column percentages of the crosstab appeared to indicate that upperclassmen were less likely than
underclassmen to live on campus:
 The proportion of underclassmen who live off campus is 34.8%, or 79/227.
 The proportion of underclassmen who live on campus is 65.2%, or 148/227.
 The proportion of upperclassmen who live off campus is 94.4%, or 152/161.
 The proportion of upperclassmen who live on campus is 5.6%, or 9/161.
Suppose that we want to test the association between class rank and living on campus using a Chi-Square Test of
Independence (using α  = 0.05).
BEFORE THE TEST
The clustered bar chart from the Crosstabs procedure can act as a complement to the column percentages above. Let's look at
the chart produced by the Crosstabs procedure for this example:

The height of each bar represents the total number of observations in that particular combination of categories. The "clusters"
are formed by the row variable (in this case, class rank). This type of chart emphasizes the differences within the
underclassmen and upperclassmen groups. Here, the differences in number of students living on campus versus living off-
campus is much starker within the class rank groups.
RUNNING THE TEST
1. Open the Crosstabs dialog (Analyze > Descriptive Statistics > Crosstabs).
2. Select RankUpperUnder as the row variable, and LiveOnCampus as the column variable.
3. Click Statistics. Check Chi-square, then click Continue.
4. (Optional) Click Cells. Under Counts, check the boxes for Observed and Expected, and under Residuals,
click Unstandardized. Then click Continue.
5. (Optional) Check the box for Display clustered bar charts.
6. Click OK.
OUTPUT
Syntax

CROSSTABS
/TABLES=RankUpperUnder BY LiveOnCampus
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ
/CELLS=COUNT EXPECTED RESID
/COUNT ROUND CELL
/BARCHART.

Tables
The first table is the Case Processing summary, which tells us the number of valid cases used for analysis. Only cases with
nonmissing values for both class rank and living on campus can be used in the test.

The next table is the cross-tabulation. If you elected to check off the boxes for Observed Count, Expected Count, and
Unstandardized Residuals, you should see the following table:

With the Expected Count values shown, we can confirm that all cells have an expected value greater than 5.
Computation of the expected cell counts and residuals (observed minus expected) for the cross-tabulation of class rank by living on
campus.

  Off-Campus On-Campus

Underclassma Row 1, column 1 Row 1, column 2


n o11=79o11=79 o12=148o12=148
e11=227∗231388=135.147e11=227∗231388=135.14 e12=227∗157388=91.853e12=227∗157388=91.85
7 3
r11=79−135.147=−56.147r11=79−135.147=−56.14 r12=148−91.853=56.147r12=148−91.853=56.147
7

Upperclassme Row 2, column 1 Row 2, column 2


n o21=152o21=152 o22=9o22=9
e21=161∗231388=95.853e21=161∗231388=95.853 e22=161∗157388=65.147e22=161∗157388=65.14
r21=152−95.853=56.147r21=152−95.853=56.147 7
r22=9−65.147=−56.147r22=9−65.147=−56.147

Total col 1 total = 231 col 2 total = 157


These numbers can be plugged into the chi-square test statistic formula:
χ2=∑i=1R∑j=1C(oij−eij)2eij=(−56.147)2135.147+(56.147)291.853+(56.147)295.853+
(−56.147)265.147=138.926χ2=∑i=1R∑j=1C(oij−eij)2eij=(−56.147)2135.147+(56.147)291.853+(56.147)295.853+
(−56.147)265.147=138.926
We can confirm this computation with the results in the Chi-Square Tests table:

The row of interest here is Pearson Chi-Square and its footnote.


 The value of the test statistic is 138.926.
 The footnote for this statistic pertains to the expected cell count assumption (i.e., expected cell counts are all greater
than 5): no cells had an expected count less than 5, so this assumption was met.
 Because the cross-tabulation is a 2x2 table, the degrees of freedom (df) for the test statistic is
df=(R−1)∗(C−1)=(2−1)∗(2−1)=1df=(R−1)∗(C−1)=(2−1)∗(2−1)=1
.
 The corresponding p-value of the test statistic is so small that it is cut off from display. Instead of writing "p = 0.000",
we instead write the mathematically correct statement p < 0.001.

DECISION AND CONCLUSIONS


Since the p-value is less than our chosen significance level α  = 0.05, we can reject the null hypothesis, and conclude that there
is an association between class rank and whether or not students live on-campus.
Based on the results, we can state the following:
 There was a significant association between class rank and living on campus ( Χ2(1) = 138.9, p < .001).

SPSS TUTORIALS: One Sample t -Test


The One Sample t -Test compares a sample mean to a hypothesized value for the population mean to determine
whether the two means are significantly different.
One Sample t -Test
The One Sample t -Test examines whether the mean of a population is statistically different from a known or
hypothesized value. The One Sample t -Test is a parametric test.
This t -Test is also known as: Single Sample t -Test
The variable used in this test is known as: Test variable
In One Sample t -Test, the test variable’s mean is compared against a “test value”, which is known or hypothesized
value of the mean in the population. Test values may come from a literature review, a trusted research organization, legal
requirements, or industry standards. For example:
1. A particular factory’s machines are supposed to fill bottles with 150 mm of product. A plant manager wants
to test a random sample of bottles to ensure that the machines are not under- or over- filling the bottles.
2. The United States Environmental Protection Agency sets clearance levels for the amount of lead present in
homes: no more than 10 micrograms per square feet on floors and no more than 100 micrograms per
square feet on window sills. An inspector wants to test if samples taken from units in an apartment
building exceed the clearance level.

COMMON USES
The One Sample t -Test is common used to test the following:
1. Statistical Difference between a mean and a known or hypothesized value of the mean in the population.
2. Statistical Difference between a change score and zero.
This approach involved creating a change score from two variables, and then comparing the mean
change score to zero, which will indicate whether any change occurred between the two time points for the
original measures. If the mean change score is not the significantly different from zero, no significant change
occurred.
Note: The One Sample t -Test can only compare a simple mean to a specified constant. In cannot compare sample
means between two or more groups. If you wish to compare the means of multiple groups to each other, you will likely
want to run an Independent Samples t -Test (to compare the means of two groups) or a One-Way ANOVA (to compare
the means of two or more groups).

DATA REQUIREMENTS
Your data must meet the following requirements:
1. Test variable that is continuous (i.e. interval or ratio)
2. Scores on the test variable are independent (i.e. independence of observations)
 There is no relationship between scores on the teat variable
 Violation of this assumption will yield an inaccurate p value
3. Random sample of data from the population.
4. Normal Distribution (approximately) of the sample and population on the test variable.
 Non-normal population distributions, especially those that are thick-tailed or heavily skewed,
considerably reduce the power of the test.
 Among moderate or large samples, a violation of normality may still yield accurate p values.
5. Homogeneity of variances (i.e. variances approximately equal in both the sample and population)
6. No outliers

HYPOTHESES
The Null hypothesis (Ho) and (two-tailed) Alternative Hypothesis (H1) of the one sample t -Test can be expressed as:
Ho: µ1 = µ2 ( The population mean is equal to the proposed population mean)
H1: µ1 ≠ µ2 ( The population mean is not equal to the proposed population mean)
Where µ is the true population mean and µo is the proposed value of the population mean.

TEST STATISTIC
The test statistic for a One Sample t -Test is denoted by t, which is calculated using the following formula:
x−µ o s
t= where sx=
sx √n
Where µo= the test value – the proposed constant for the population mean
x = sample mean
n = sample size (i.e. number of observations)
s = sample standard deviation
s
s x = estimated standard error of the mean =
√n
The calculated t value is then compared to the critical t-values from the t distributions table with the degrees of
freedom df= n-1 and chosen confidence level. If the calculated t-value ¿critical t-value, then we reject the null hypothesis.

DATA SET-UP
Your data should include one continuous, numeric variable (represented in a column) that will be used in the analysis.
The variable’s measurement level should be defined as scales in the variable view window.
RUN A ONE SAMPLE t-Test
To run a One sample t-Test in SPSS, click ANALYZE¿COMPARE MEANS¿ONE SAMPLE t-Test
One Sample t-Test window opens where you will specify the variables to be used in the analysis. All the variables in your data
set appear in the list on the left side. Move variables to the Test variable(s) area by selecting them in the list and clicking the
arrow button.

Figure 1

A Test variable(s): The variable whose mean will be compared to the hypothesized population mean (i.e. Test value). You may
run multiple One sample t-Test simultaneously by selecting more than one Test variable. Each variable will be compared to the
same Test value.
B Test Value: The hypothesized population mean against which your test variables will be compared.
C Options: clicking Options will open a window where you can specify the Confidence Interval percentage and how the
analysis will address missing values (i.e. Exclude cases analysis by analysis or Exclude cases list wise). Click Continue when
you are finished making specifications.

Figure 2
Click OK to run the One Sample t-Test
EXAMPLE
PROBLEM STATEMENT
According to CDC, the mean height of US adults ages 20 and older is about 66.5 inches. (69.3 inches for males, 63.8
inches for females).
In our sample data, we have a sample of 435 college students from a single college. Let’s test if the mean height of
students at this college is significantly different than 66.5 inches using a One Sample t-Test.
The Null Hypothesis and Alternative Hypothesis of this test will be:
Ho: µheight = 66.5 inches (The mean height is equal to 66.5”)
H1: µheight ≠ 66.5 inches (The mean height is not equal to 66.5”)

BEFORE THE TEST


In the sample data, we will use the variable Height, which is continuous variable representing each respondent’s height
in inches. The height exhibit a range values of 55.00 to 88.41 inches.
(ANALYZE¿DESCRIPTIVE STATISTICS¿DESCRIPTIVE)
Let’s create a histogram of the data to get an idea of the distribution and see if our hypothesized mean is near our
sample mean. Click GRAPHS¿LEGACY OPTIONS¿HISTOGRAM. Move variable height to the variable box, then click OK.

Figure 3

To add vertical reference lines at the mean (or another location) double click on the plot to open the chart editor, then
click Options¿ X-Axis Reference Line. In the properties window, you can enter a specific location on the x-axis for the
vertical line, or you can choose to have the reference line at the mean, median of the sample data (using the sample data).
Click Apply to make sure your new line is added to the chart. Here, we have added two reference lines: One at the sample
mean (solid black) and the other at the 66.5 (dashed red)

RUNNING THE TEST


To run the One Sample t-Test, Click ANALYZE¿COMPARE MEANS¿One Sample t-Test. Move the variable Height
to the Test Variable(s) area. In the Test value field, enter 66.5.

Figure 4

Click OK to run the One Sample t-Test.

TABLES
Two section (Boxes) appear in the output: One Sample Statistics and One Sample t-Test. The first section, One Sample
Statistics provides basic information about the selected variable, Height including their valid (non-missing) sample size ( n),
mean, standard deviation, and standard error. In this example, the mean height of the sample is 68.03 inches which is based
on 408 n0n-missing observations.
Figure 5

The second section: One Sample Test, displays the results most relevant to the One Sample t-Test.

Figure 6

A Test Value: The number we entered as the test value in the One-Sample t-Test window.
B t Statistic: The test statistic of the One sample t-Test, denoted by t. In this example, t= 5.810. Note that t is calculated by
dividing the mean difference (E) by the standard error mean (from the One Sample Statistics box)
C df: The degrees of freedom for the test. For a One Sample t-Test, df = n-1, so here, df = 408-1 =407
D Sig. (2 –tailed): The two-tailed p-value corresponding to the test statistic.
E Mean Difference: The difference between the “observed” sample mean (from the One Sample Statistics box) and the
“expected” mean ( the specified test value (A)). The sign of the mean difference corresponds to the sign of the t value (B). The
positive t value in this example indicates that the mean height of the sample is greater than the hypothesized value (66.5).
F Confidence Interval for the difference: The confidence interval for the difference between the specified test value and
the sample mean.

DECISIONS AND CONCLUSIONS


Recall that our hypothesized population value was 66.5 inches, the (approximate) average height of the overall adult
population in the US, since p¿0.001, we reject the null hypothesis that the mean height of the students at this college is equal
to the hypothesized population mean of 66.5 inches and conclude that the mean height is significantly different than 66.5
inches.
Based on the results, we can state the following:
1. There is a significant difference in the mean height of the students at this college and the overall adult population
in the US (p¿0.001).
2. The average height of students at this college is about 1.5 inches taller than the US adult population average.
(95% CI)

SPSS TUTORIALS: Paired Sample t-Test


Paired t-Test are used to test if the means of two paired measurements, such as Pretest/Posttest scores , are
significantly different.
Paired Sample t-Test
The Paired Samples t-Test compares the means of two measurements taken from the same individual, object, or
related units. These “paired” measurement can represent things like:
1. A measurement taken at two different times. (e.g. pretest and posttest scores with an intervention administered
between the two time points).
2. A measurement taken under two different conditions. (e.g. completing a test under a “control” and an
“experimental” condition).
3. Measurements taken from two halves or sides of a subject or experimental unit. (e.g. measuring hearing loss in a
subject’s left and right ears).
The purpose of the test is to determine whether there is statistical evidence that the mean difference between paired
observations is significantly different from zero. The Paired Samples t-Test is a parametric test.
This test is also known as:
1. Dependent t-Test
2. Paired t-Test
3. Repeated Measures t-Test
The variable used in this test is known as:
Dependent variable, or test variable (continuous), measured at two different times or for two related
conditions or units

COMMON USES
The Paired Samples t-Test is commonly used to test the following:
1. Statistical difference between two time points.
2. Statistical difference between two conditions.
3. Statistical difference between two measurements.
4. Statistical difference between a matched pair.
Note: The Paired Samples t-Test can only compare the means for two (and only two) related (paired) units on a
continuous outcome that is normally distributed.

Paired Samples t-Test is not appropriate for analyses involving the following:
1. Unpaired data
2. Comparison between more than two units/groups
3. A continuous outcome that is not normally distributed
4. An ordinal/ ranked outcome
 To compare unpaired means between two independent groups on a continuous outcome that is normally distributed,
choose Independent Sample t-Test.
 To compare unpaired means between more than two groups on a continuous outcome that is normally distributed,
choose ANOVA.
 To compare paired means for continuous data that are not normally distributed, choose the Non-parametric Wilcoxon
Signed-Ranks Test.
 To compare paired means for ranked data, choose the Non-parametric Wilcoxon Signed-Ranks Test.

DATA REQUIREMENTS
Your data must meet the following requirements:
1. Dependent variable that is continuous. (i.e. interval or ratio level)
Note: The paired measurements must be recorded in two separate variables.
2. Related samples/ groups. (i.e. dependent observations)
The subject in each sample, or group, are the same. This means that the subjects in the first group are also in
the second group.
3. Random sample of data from the population.
4. Normal distribution (approximately) of the difference between the paired values.
5. No outliers in the difference between the two related groups.

Note: When testing assumptions related to normality and outliers, you must use variables that represents the difference
between the paired values. – not the original variables themselves.
Note: When one or more of the assumptions for the Paired Samples t-Test are not met, you may want to run the non-
parametric Wilcoxon Signed-Ranks Test instead.

HYPOTHESES
The hypotheses can be expressed in two different ways that express the idea and are mathematically equivalent.
Ho: µ1=µ2 (The paired population means are equal)
H1: µ1 ≠ µ 2 (The paired population means are not equal)
or
Ho: µ1−µ2=0 (The difference between the paired population means is equal to 0)
H1: µ1−µ2 ≠ 0 (The difference between the paired population means is not 0)
Where
µ1 is the population mean of variable 1 and
µ2 is the population mean of variable 2

TEST STATISTIC
The test statistic for the Paired Samples t-Test, denoted by t, follows the same formula as the One Sample t-Test.
x diff −0 s diff
t= sx=
sx √n
Where
x diff =¿ sample mean of the differences
n = sample size (i.e. number of observations)
sdiff =¿ sample standard deviation of the differences
s
s x =¿ estimated standard of error of the mean ( diff )
√n
The calculated t value is then compared to the critical t value with df = n-1 from the t distribution table for a chosen
confidence level. If calculated t value is greater than the critical t value, then we reject the null hypothesis. (and conclude that
the means are significantly different)

DATA SET-UP
Your data should include two continuous numeric variables (represented in columns) that will be used in the analysis.
The two variables should represent the paired variables for each subject (row). If your data are arranged differently (e.g. cases
represent repeated units/subjects), simply restructure the data to reflect this format.

RUN A PAIRED SAMPLES T-TEST


To run a Paired Samples t-Test in SPSS, click ANALYZE¿COMPARE MEANS¿PAIRED SAMPLES T-TEST

Figure 1

The Paired Samples t-Test window opens where you will specify the variables to be used in the analysis. All the
variables in your data set appear in the list on the left side. Move variables to the right by selecting them in the list and clicking
the blue arrow buttons. You will specify the paired variables in the Paired Variables area.

Figure 2

A Pair: The “pair” column represent the number of Paired Samples t-Test to run. You may choose to run Multiple Paired
Samples t-Test simultaneously by selecting multiple sets of matched variables. Each new pair will appear on a new line.
B Variable1: The first variable, representing the first group of matched values. Move the variable that represents the first
group to the right where it will be listed beneath the “Variable 1” column.

C Variable 2: The second variable, representing the second group of matched values. Move the variable that represents the
second group to the right where it will be listed beneath the “Variable 2” column.
D Options: Clicking Options will open a window where you can specify the Confidence Interval Percentage and how the
analysis will address Missing Values (i.e. Exclude cases analysis by analysis or Exclude case listwise). Click Continue
when you are finished making specifications.

Figure 3

 Setting the confidence interval percentage does not have any impact on the calculation of the p value.
 If you are only running one Paired Sample t-Test, the two “missing values” settings will produce the same results.
There will only be differences if you are running two or more Paired Samples t-Test. (This would look like having two
or more rows in the main Paired Samples t-Test dialog window)

EXAMPLE
Problem Statement
The sample dataset has placement test scores (out of 100 points) for four subject areas: English, Reading, Math and
Writing. Students in the sample completed all 4 placement test when they enrolled in the University. Suppose we are
particularly interested in the English and Math sections, and want to determine whether students tended to score higher on
their English or Math test, on average. We could use a Paired t-Test to test if there was a significant difference of the two
tests.
Before the Test
Variable English has a high of 101.95 and a low of 59.83, while Variable Math has a high of 93.78 and a low of 35.32.
(ANALYZE¿DESCRIPTIVE STATISTICS¿DESCRIPTIVES). The mean English score is much higher than the mean Math
score. (82.79 vs 65.47). Additionally, there were 409 cases with non-missing English scores and 422 cases with non-missing
Math scores, but only 398 cases with non-missing observations for both variables. (Recall that the sample data set has 435
cases in all).
Let’s create a comparative box plot of these variables to help visualize those numbers. Click ANALYZE¿
DESCRIPTIVE STATISTICS¿EXPLORE. Add English and Math to the dependent box, then change display Option to Plots.
We’ll also need to tell SPSS to put these two variables on the same chart. Click the Plots button, and in the boxplot area,
change the selection to Dependents Together. You can also uncheck stem and leaf. Click Continue. Then Click OK to run
the procedure.

Figure 4

We can see from the box plot that the center of the English scores is much higher than the center of the Math
scores, and that there is slightly more spread in the Math scores than in the English scores. Both variables appear to be
symmetrically distributed. It’s quite possible that the Paired Samples t-Test could come back significant.
RUNNING THE TEST
1. Click ANALYZE¿COMPARE MEANS¿PAIRED SAMPLES t-TEST
2. Select the variable English and move it to the variable 1 slot in the Paired Variable box. Then select the variable
Math and move it to the Variable 2 slot in the Paired Variable box
3. Click OK

OUTPUT
TABLES
There are three tables: Paired Samples Statistics, Paired Samples Correlations and Paired Samples t-Test. Paired
Samples Statistics gives univariate descriptive statistics (mean, sample size, standard deviation and standard error) for each
variable entered. Notice that the sample size here is 398; this is because paired t-test can only use cases that have non-
missing values for both variables. Paired Samples Correlations shows the bivariate Pearson Correlation Coefficient (with two
tailed test of significance) for each pair of variables entered. Paired Samples t-Test gives the hypothesis test results.

Figure 5

The Paired Samples Statistics output repeats what we examined before we can run the test. The Paired Samples
Correlation table adds the information that English and Math scores are significantly positively correlated (r=0.243)
TIP
Why does SPSS report the correlation between the two variables when you run a Paired t-Test? Although our primary
interest when we run a Paired t-Test is finding out if the means of the two variables are significantly different, it’s also
important to consider how strongly the two variables are associated with one another, especially when the variables being
compared are pretest/posttest measures. For more information about correlation, check out the Pearson Correlation Test.

Figure 6

Reading from Left to Right


 First column: The pair of variables being tested, and the order the subtraction was carried out. (If you have specified
more than one variable pair, this table will have multiple rows.)
 Mean: The average difference between the two variables.
 Standard deviation: The standard deviation of the difference scores.
 Standard error mean: The standard error (standard deviation divided by the square root of the sample size). Used in
computing both the test statistic and the upper and lower bounds of the confidence interval.
 t: The test statistic (denoted t) for the paired T test
 df: The degrees of freedom for this test.
 Sig. (2-tailed): The p-value corresponding to the given test statistic t with degrees of freedom df.

DECISION AND DISCUSSION


From the result we can say that:
1. English and Math scores were weakly and positively correlated. (r=0.243, p¿0.001)
2. There was a significant average difference between English and Math scores. ( t=36.13, p¿0.001)
3. On average, English scores were 17.3 points higher than Math scores. (95% C.I.)

SPSS TUTORIALS: Independent Samples t-Test


The Independent Samples t-Test compares two samples means to determine whether the population means are
significantly different.

INDEPENDENT SAMPLES T-TEST


The Independent Samples t-Test compares the means of two independent groups in order to determine whether there
is statistical evidence that the associated population means are significantly different. The Independent Samples t-Test is a
parametric test.
This test is also known as:
1. Independent t-Test
2. Independent Measures t-Test
3. Independent Two-Sample t-Test
4. Student t-Test
5. Two-Sample t-Test
6. Uncorrelated t-Test
7. Unpaired t-Test
8. Unrelated t-Test
The variables used in this test are known as:
1. Dependent variable, or test variable
2. Independent variable, or grouping variable

COMMON USES
The Independent Samples t-Test is commonly used to test the following:
1. Statistical difference between the means of two groups.
2. Statistical difference between the means of two interventions.
3. Statistical difference between the means of two change scores.
Note: The Independent Samples t-Test can only compare the means of two (and only two) groups. It cannot make
comparisons among more than two groups. If you wish to compare the means across more than two group, you will likely
want to run an ANOVA.

DATA REQUIREMENTS
Your data must meet the following requirements:
1. Dependent variable that is continuous. (i.e. interval or ratio)
2. Independent variable that is categorical. (i.e. two or more groups)
3. Cases that have values on both the dependent and independent variables.
4. Independent Samples/groups. (i.e. Independent observations)
 There is no relationship between the subject in each sample. This means that:
a. Subjects in the first group cannot also be in the second group.
b. No subject in either group can influence subjects in the other group.
c. No group can influence the other group.
 Violation of this assumption will yield an inaccurate p-value.
5. Random sample of data from the population.
6. Normal distribution (approximately) of the dependent variable for each group.
 Non-normal population distributions, specially those that are thick-tailed or heavily skewed,
considerably reduce the power of the test.
 Among moderate or large samples, a violation of normality may still yield accurate p-values.
7. Homogeneity of variances (i.e. variances approximately equal across groups)
 When assumptions is violated and the sample scores for each group differ p-value is not
trustworthy. However, the Independent Samples t-Test output also includes an approximate t
statistic that is not based on assuming equal variances. This alternative statistic, called Welch t Test
statistic may be used when equal variances among population cannot be assumed. The Welch t-Test is
also known as Unequal Variance t-Test or Separate Variances t-Test.
8. No outliers
Note: When one or more of the assumptions for the Independent Samples t-Test are not met, you may want to run the non-
parametric Mann-Whitney U Test instead.

Researchers often follow several rules of thumb.


1. Each group should have at least 6 subjects, ideally more. Inferences for the population will be more tenuous
with too few subjects.
2. A balanced design. (i.e. same number of subject in each group) is ideal. Extremely unbalanced design increase
the possibility that violating any of the requirements/assumptions will threaten the validity of the Independent
Samples t-Test.

HYPOTHESES
The null hypothesis (Ho) and the alternative hypothesis (H1) of the Independent Samples t-Test can be expressed in
two different but equivalent ways:
Ho: µ1¿ µ2 (the two population means are equal)
H1: µ1≠ µ2 (the two population means are not equal)
or
Ho: µ1−¿ µ2 ¿ 0 (The difference between the two population means is equal to 0)
H1: µ1−¿µ2 ≠ 0 (The difference between the two population means is not equal to 0)
Where µ1 and µ2 are the population means for the group1 and group2, respectively. Notice that the second set of hypotheses
can be derived from the first set by simply subtracting µ 2 from both side of the equation.

Levene’s Test for Equality of Variances


Recall that the Independent Samples t-Test requires the assumptions of homogeneity of variance—i.e. both groups
have the same variance. SPSS conveniently includes a test for homogeneity of variance called Levene’s Test, whenever you run
an Independent Samples t-Test.
Test hypotheses for Levene’s Test are:
H0: 𝞼1−¿ 𝞼2¿0 (the population variances of group 1 and group 2 are equal)
H1: 𝞼1−¿ 𝞼2≠ 0 (the population variances of group 1 and group 2 are not equal)
This implies that if we reject the null hypothesis of Levene’s Test, it suggests that the variances of the two groups are not
equal. i.e. that the homogeneity of variances assumption is violated.
The output of the Independent Samples t-Test table includes two rows:
Equal variances assumed and Equal variances not assumed. If Levene’s test indicates that the variances are
equal across the two groups. (i.e. p-value large), you will rely on the first row of output. Equal variances assumed, when you
look at the results for the actual Independent Samples t-Test (under the heading t-Test for equality of means). If Levene’s test
indicates that the variances are not equal across the groups (i.e. p-value small), you will need to rely on the second row of our
output, Equal variances not assumed, when you look at the Independent Samples t-Test (under the heading t-Test for equality
means).
The difference between those two rows of output lies in the way Independent Samples t-Test statistic is
calculated. When equal variances are assumed, the calculation uses pooled variance; when equal variances cannot be
assumed, the calculation utilizes un-pooled variances and a correction to the degrees of freedom.

TEST STATISTIC
The test statistic for an Independent Sample t-Test is denoted by t. These are actually two forms of the test statistic
for this test, depending on whether or not equal variances are assumed. SPSS produces both forms of the test, so both forms
of the test are described here.
Note that the null and alternative hypothesis are identical for both forms of the test statistic.

EQUAL VARIANCES ASSUMED


When the two independent samples are assumed to be drawn from population with the identical population variances
(i.e. 𝞼12−¿ 𝞼22), the test statistic t is computed as:

x 1−x 2

Where:
t=
sp
√ 1 1
+
n1 n2
with s p=
√ ( n1 −1 ) s12 + ( n 2−1 ) s 22
n 1+ n2−2

x1 = mean of the first sample


x2 = mean of the second sample
n1 = sample size of the first sample
n2 = sample size of the second sample
s1 = standard deviation of the first sample
s2 = standard deviation of the second sample
The calculated t-value is the compared to the critical t-value from the t-distribution table with degrees of freedom.

( )
2 2 2
s1 s2
+
n1 n2
df =

( ) ( )
2 2 2 2❑
1 s1 1 s2
+
n1−1 n1 n 2−1 n2

and the chosen confidence level. If the calculated t-value ¿critical t-value, then we reject the null hypothesis. Note that this
form of the Independent Samples t-Test statistic does not assume equal variances. This is why both the denominator of the
test statistic and the degrees of freedom of the critical value of t are different from the equal variances form of the test
statistic.

DATA SET UP
Your data should include two variables (represented in columns) that will be used in the analysis. The Independent
variable should be categorical and include exactly two groups. (Note that this SPSS restricts categorical indicators to numeric or
short string values only. The dependent variable should be continuous. (i.e. interval or ratio) SPSS can only make use of cases
that have non-missing values for the Independent and the dependent variables. So if a case has missing value for either
variable, it cannot be included in the test.
The number of rows in the data set should correspond to the number of subjects of the study. Each row of the data
set should represent a unique subject, person or unit and all the measurements taken on that person or units should appear in
that row.

RUN AN INDEPENDENT SAMPLES T-TEST


To run an Independent Samples t-Test in SPSS, Click ANALYZE¿COMPARE MEANS¿INDEPENDENT SAMPLES T-
TEST
The Independent Samples t-Test window opens where you will specify the variables to be used in the analysis. All of the
variables in your dataset appear in the list on the left side. Move variables to the right by selecting them in the list and clicking
the blue arrow buttons. You can move a variable(s) to either of the two areas: Grouping Variable or Test Variable(s)

Figure 1
A Test Variable(s): The dependent variable(s). This is the continuous variable whose means will be compare between the
two groups. You may run multiple t test simultaneously by selecting more than one test variable.
B Grouping Variable: The independent variable. The categories (or groups) of the independent variable will define which
samples will be compared in the t test. The grouping variable must have at least two categories (groups); it may have more
than two categories but a t-test can only compare two groups, so you will need to specify which two groups to compare. You
can also use a continuous variable by specifying a cut point to create two groups (i.e. values at or above the cut point and
values below the cut point).
C Define Groups: Click Define Groups to define the category indicators (groups) to use in the t-test. If the button is not
active, make sure that you have already moved your independent variable to the right in the Grouping Variable field. You
must define the categories of your grouping variable before you can run the Independent Samples t-Test procedure.
D Options: The option section is where you can set your desired confidence level for the confidence interval for the mean
difference, and specify how SPSS should handle the missing values.

When finished, Click OK to run the Independent Samples t-Test, or click Paste to have the syntax corresponding to your
specified settings written to an open syntax window (If you do not have syntax window open, a new window will open for you)

DEFINE GROUPS
Clicking the Define Groups button C opens the Define Groups window

Figure 2

1 Use specified values: f your grouping variable is categorical, select Use specified values. Enter the values for
the categories you wish to compare in the Group 1 and Group 2 fields. If your categories are numerically coded, you will
enter the numeric codes. If your group variable is string, you will enter the exact text strings representing the two categories.
If your grouping variable has more than two categories (e.g. takes on values of 1, 2, 3, 4), you can specify two of the
categories to be compared (SPSS will disregard the other categories in this case)
Note that when computing the test statistic, SPSS will subtract the mean of the Group 2 from the mean of Group 1.
Changing the order of the subtraction affects the sign of the result, but does not affect the magnitude of the results.
2 Cut Point: If your grouping variable is numeric and continuous, you can designate a cut point for dichotomizing the
variable. This will separate the cases into two categories based on the cut point. Specifically, for a given cut point x, the new
categories will be:
 Group 1: All cases where grouping variable ≥ X
 Group 2: All cases where grouping variable ¿ X
Note that this implies that cases where the grouping variable is equal to the cut point itself will be included in the “greater than
or equal to” category. (If you want your cut point to be included in a “less than or equal to” group, then you will need to use
Recode into Different Variables or use DO IF syntax to create this grouping variable yourself.) Also note that while you can use
cut points on any variable that has a numeric type, it may not make practical sense depending on the actual measurement
level of the variable (e.g. nominal categorical variables coded numerically). Additionally, using a dichotomized variable created
via a cut point generally reduces the power of the test compared to using a non-dichotomized variable.

OPTIONS
Clicking the Options button D opens the Options window
Figure 3

The Confidence Interval Percentage box allows you to specify the confidence level for a confidence interval. Note that this
setting does NOT affect the test statistic or p-value or standard error; it only affects the computed upper and lower bounds of
the confidence interval. You can enter any value between 1 and 99 in this box (although in practice, it only makes sense to
enter numbers between 90 and 99).
Missing Values section allows you to choose if cases should be excluded “analysis by analysis” (i.e. pairwise deletion) or
excluded listwise. This setting is not relevant if you have only specified one dependent variable; it only matters if you are
entering more than one dependent (continuous numeric) variable. In that case, excluding “analysis by analysis” will use all
nonmissing values for a given variable. If you exclude “listwise”, it will only use the case with nonmissing values for all of the
variables entered. Depending on the amount of missing data you have, listwise deletion could greatly reduce your sample size.

Example: Independent Samples T-Test when variance are not equal.


PROBLEM STATEMENT
In our sample data set, students reported their typical time to run a mile and whether or not they were an athlete.
Suppose we want to know if the average time to run a mile is different for athletes versus non-athletes. This involves testing
whether the sample means for mile time among athletes and non-athletes in your sample are statistically different (and by
extension, inferring whether the means for mile times in the population are significantly different between these two groups).
You can use an Independent Samples t-Test to compare the mean mile time for athletes and non-athletes.
The Hypothesis for this example can be expressed as:
Ho: µnon-athlete −¿µathlete¿ 0 (the difference of the means is equal to zero)
H1: µnon-athlete −¿µathlete≠ 0 (the difference of the means is not equal to zero)
Where µnon-athlete and µathlete are the population means for non-athletes and athletes respectively.

In the sample data, we will use two variables: Athlete and MileMinDur. The variable Athlete has values of either
“0”(non-athlete) or “1” (athlete). It will function as the independent variable in this T-Test. The varable MileMinDur is a
numeric duration variable (h:mm:ss), and it will function as the dependent variable in SPSS.
The first few rows of the data looks like this:

Figure 4

BEFORE THE TEST


Before running the Independent Samples t-Test, it is a good idea to look at descriptive statistics and graphs to get an
idea of what to expect. Running Compare Means (ANALYZE¿ COMPARE MEANS¿MEANS) to get descriptive statistics by
group tells us that the standard deviation in mile time for non-athletes is about 2 minutes; for athletes, it is about 49 seconds.
This corresponds to a variance of 14803 seconds for non-athletes, and a variance of 2447 seconds for athletes. Running the
Explore procedure (ANALYZE¿DESCRIPTIVES¿ EXPLORE) to obtain a comparative boxplot yields the following graph:
Figure 5

If the variances were indeed equal, we would expect the total length of the boxplots to be the same for both groups.
However, from this boxplot, it is clear that the spread of observations for non-athletes is much greater than the spread of
observations for athletes. Already, we can estimate that the variances for these two groups are quite different. It should not
come as a surprise if we run the Independent Samples t-Test and see that Levene’s Test is significant.
Additionally, we should also decide on a significance level (typically denoted by using the Greek letter alpha, a). before
we perform our hypothesis tests. The significance level is the threshold we use to decide whether a test result is significant.
For this example, let’s use a = 0.05.

RUNNING THE TEST


To run the Independent Samples t-Test:
1. Click ANALYZE¿COMPARE MEANS¿Independent Samples t-Test
2. Move the variable Athletes to the Grouping Variable field and move the variable MileMinDur to the Test
Variable(s) area. Now Athlete is defined as the Independent variable and MileMinDur is defined as the dependent
variable.
3. Click Define Groups which opens a new window. Use specified values is selected by default. Since our
grouping variable is numerically coded. (0 = non-athlete, 1 = athlete) type “0” in the first text box and “1” in the
second text box. This indicates that we will compare groups 0 and 1 which correspond to non-athletes and athletes
respectively. Click Continue when finished.
4. Click OK to run the Independent Samples t-Test. Output for the analysis will display in the Output Viewer window.

OUTPUT
Tables
Two sections(boxes) appear in the output. Group Statistics and Independent Samples Test. The first section,
Group Statistics, provides basic information about the group comparisons, including the sample size (n), mean, standard
deviation and standard error for mile times by group. In this example, there are 166 athletes, and 226 non-athletes. The mean
mile time for athletes is 6 minutes 51 seconds, and the mean mile time for non-athletes is 9 minute 6 seconds.

Figure 6

The second section, Independent Samples Test displays the result most relevant to the Independent Samples t-
Test. There are two parts that provide different pieces of information: (A) Leven’s Test for Equality of Variances and (B) t-Test
for Equality Means.

Figure 7

A Levene’s Test for Equality of Variances: This section has the test results for Levene’s Test. From left to right:
 F is the test statistic of Levene’s test
 Sig. is the p-value corresponding to this test statistic.
The p-value of Levene’s test is printed as “.000” (but should be read as p¿ 0.001—i.e. p very small)., so we reject the
null Levene’s test and conclude that the variance in mile time of athletes is significantly different than that of non-
athletes. This tells us that we should look at the “Equal variances not assumed” row for the t-test (and
corresponding confidence interval) result. (If this test result had not been significant – that is , if we had
observed p¿ a -- then we would have used the “Equal variances assumed” output.)
B t-test for Equality of Means provides the results for the actual Independent Samples t-Test. From left to right:
 T is the computed test statistic
 df is the degrees of freedom
 Sig. (2 tailed) is the p-value corresponding to the given test statistic and degrees of freedom.
 Mean Difference is the difference between the sample means; it also corresponds to the numerator of
the test statistic.
 Standard Error Difference is the standard error; it also corresponds to the denominator of the test
statistic
Note that the mean difference is calculated by subtracting the mean of the second group from the mean of the first group. In
this example the mean mile time for athletes was subtracted from the mean mile time for non-athletes (9:06-6:51=2:14) The
sign of the mean difference corresponds to the sign of the t-value. The positive t-value in this example indicates that the mean
mile time for the first group, non-athlete, is significantly greater than the mean for the second group, athletes.

The associated p-value is printed as “0.000”; double-clicking on the p-value will reveal the un-rounded number. SPSS
Rounds p-values to three decimal places, so any p-value too small to round up to 0.001 will print as 0.000. (In this particular
example, the p-values are on the order of 10−40.)
C Confidence Interval of the Difference: This part of the t-Test output compliments the significance test results.
Typically, if the CI for the mean difference contains 0 within the interval—i.e. if the lower boundary of the CI is negative
number and the upper boundary of the CI is a positive number – the results are not significant at the chosen significance level.
In this example, the 95% CI is [01:57, 02:32], which does not contain zero; this agrees with the small p-value of the
significance test.

DECISION AND CONCLUSIONS


Since p¿0.001 is less than our chosen significance level a = 0.05, we can reject the null hypothesis and conclude that the mean
mile time for athletes and non-athletes is significantly different.

Based on the result, we can state the following:


 There was a significant difference in mean mile time between non-athletes and athletes (
t 315846=15.047 , p <0.001 ¿ .
 The average mile time for athletes was 2 minutes and 14 seconds faster than the average mean mile time for
non- athletes.

SPSS TUTORIALS: One Way ANOVA


One-Way ANOVA is used to test if the means of two or more groups are significantly different.

One-Way ANOVA
One-Way ANOVA (“Analysis of Variance”) compares the means of two or more independent groups in order to
determine whether there is statistical evidence that the associated population means are significantly different. One-Way
ANOVA is a parametric test.

This test is also known as:


 One-Factor ANOVA
 One-Way Analysis of Variance
 Between Subjects ANOVA
The variables used in this test are known as:
 Dependent variable
 Independent variable (also known as the grouping variable, or factor)
This variable divides cases into two or more mutually exclusive levels or groups.

COMMON USES
The One-Way ANOVA is often used to analyze data from the following types of studies:
 Field Studies
 Experiments
 Quasi-experiments
The One-Way ANOVA is commonly used to test the following:
 Statistical differences among the means of two or more groups.
 Statistical differences among the means of two or more interventions.
 Statistical differences among the means of two or more change scores.
Note: Both the One-Way ANOVA and the Independent Samples t-Test can compare the means for two groups. However, only
the One-Way ANOVA can compare mean across three or more groups.
Note: If the grouping variable has only two groups, then the result of One-Way ANOVA and the Independent Samples t-Test
will be equivalent. In fact, if you run both an Independent Samples t-Test and One-Way ANOVA in this situation, you should be
able to confirm that t2=F.

DATA REQUIREMENTS
Your data must meet the following requirements:
1. Dependent variable that is continuous (i.e. interval or ratio level)
2. Independent variable that is categorical (i.e. two or more groups)
3. Cases that have values on both the dependent and independent variables.
4. Independent samples/groups (i.e. Independence observations)
a. There is no relationship between the subjects in each sample. This means that:
i. Subjects in the first group cannot also be in the second group.
ii. No subject in either group can influence subjects in the other group.
iii. No group can influence the other group.

5. Random sample of data from the population.


6. Normal distribution (approximately) of the dependent variable for each group (i.e. for each level of the
factor)
a. Non-normal population distributions, especially those that are thick-tailed or heavily skewed,
considerably reduce the power of the test.
b. Among moderate or large samples, a violation of normality may yield fairly accurate p-values.
7. Homogeneity of variances (i.e. variances approximately equal across groups)
a. When this assumption is violated and the sample sizes differ among groups, the p-value for the
overall F test is not trustworthy. These conditions warrant using alternative statistics, such as the
Browne-Forsythe or Welch statistic (available via Options in the One-Way ANOVA dialog box).
b. When this assumption is violated, regardless of whether the group sample sizes are fairly equal,
the results may not be trustworthy for post hoc tests. When variances are unequal, post hoc test
that do not assume equal variances should be used (e.g. Dunnett’s C.)
8. No outliers.

Note: When the normality, homogeneity of variances, or outliers assumptions for One-Way ANOVA are not met, you may want
to run the non-parametric Kruskal-Wallis test instead.

Researchers often follow several rules of thumb for One-Way ANOVA:


 Each group should have at least 6 subjects (ideally more; inferences for the population will be more tenuous
with too few subjects)
 Balanced designs (i.e. same number of subjects in each group) are ideal; extremely unbalanced designs
increase the possibility that violating any of the requirements/ assumptions will threaten the validity of the
ANOVA F test.

HYPOTHESES
The Null and Alternative hypotheses of One-Way ANOVA can be expressed as:
Ho: µ1 = µ2 = µ3 =…= µk (“all k population means are equal”)
H1: at least one µi different (“at least one of the k population means is not equal to the others”) .
Where
µi is the population mean of the ith group (i= 1,2,…,k)
Note: The One-Way ANOVA is considered an omnibus (Latin for “all”) test because the F test indicates whether the model is
significant overall—i.e. whether or not there are any significant differences in the means between any of the groups. (Stated
another way, this says that at least one of the means is different from the others.) However, it does not indicate which mean is
different. Determining which specific pairs of means are significantly different requires either contrast or post hoc (Latin for
“after this”) tests.

TEST STATISTIC
Test statistic for One-Way ANOVA is denoted as F. For an independent variable with k groups, the F statistic evaluates
whether the group means are significantly different. Because the computation of the F statistic is slightly more involved than
computing the paired or independent samples t test statistics, it’s extremely common for all of the F statistic components to be
depicted in a table like the following:

Sum of Squares df Mean Square F


Treatment SSR dfr MSR MSR/MSE
Error SSE dfe MSE
Total SST dft

Where:
SSR = the regression sum of squares
SSE = the error sum of squares
SST = the total sum of squares (SST=SSR+SSE)
dfr = the model degrees of freedom (equal to dfr = k-1)
dfe = the error degrees of freedom (equal to dfe = n-k-1)
k = the total number of groups (levels of the independent variable)
n = the total number of valid observations
dft = the total degrees of freedom (equal to dft = dfr + dfe = n-1)
MSR = SSR / dfr = the regression mean square
MSE = SSE / dfe = the mean square error

Then the F statistic itself is computed as:


MSR
F=
MSE

Note: In some texts you may see the notation df1 or v1 for the regression degrees of freedom, and df2 or v2 for the error
degrees of freedom. The latter notation uses the Greek letter nu (v) for the degrees of freedom.
Some texts may use “SSTr” (Tr=”treatment”) instead of SSR (R=”regression”), and may use SSTo (To =”total”)
instead of SST.
The terms Treatment (or Model) and Error are the terms most commonly used in natural sciences and in traditional
experiment design texts. In the social sciences, it is more common to see the terms Between groups instead of “Treatment”,
and Within groups instead of “Error”. The between/within terminology is what SPSS uses in the One-Way ANOVA procedure.

DATA SET UP
Your data should include at least two variables (represented in columns) that will be used in the analysis. The
independent variable should be categorical (nominal or ordinal) an d include at least two groups, and the dependent variable
should be continuous (i.e. interval or ratio). Each row of the data set should represent a unique subject or experimental unit.
Note: SPSS restricts categorical indicators to numeric or short string values only.

RUN A ONE-WAY ANOVA


The following steps reflect SPSS’s dedicated One-Way ANOVA procedure. However, since the One-Way ANOVA is
also a part of the General Linear Model (GLM) family of statistical tests, it can also be conducted via Univariate GLM procedure.
(“Univariate” refers to one dependent variable). This latter method may be beneficial if your analysis goes beyond simple One-
Way ANOVA and involves multiple independent variable, fixed and random factors, and or weighing variables and covariates
(e.g. One-Way ANOVA using SPSS’s dedicated procedure.
To run a One-Way ANOVA in SPSS, Click ANALYZE>¿ COMPARE MEANS¿ONE-WAY ANOVA.

Figure 1
The One Way ANOVA window opens, where you will specify the variables to be used in the analysis. All of the variables
in your data set appear in the list on the left side. Move variables to the right by selecting them in the list and clicking the blue
arrow buttons. You can move a variable(s) to either of the two areas: Dependent List or Factor.

Figure 2

A Dependent List: The dependent variable(s). This is the variable whose means will be compared between the samples
(groups). You may run multiple means comparison simultaneously by selecting more than one dependent variable.
B Factor: The independent variable. The categories (or groups) of the independent variable will define which samples will be
compared. The independent variable must have at least two categories (groups), but usually has three or more groups when
used in a One-Way ANOVA.
C Contrasts: (Optional) Specify contrasts, or planned comparisons, to be conducted after the overall ANOVA test.

Figure 3
When initial F test indicates that significant differences exists between group means, contrasts are useful for determining which
specific means are significantly different when you have specific hypotheses that you wish to test.
Contrasts are decided before analyzing the data (i.e. a priori). Contrasts break down the variance into component parts. They
may involve using weights, non-orthogonal comparisons, standard contrasts, and polynomial contrasts (trend analysis).
Many online and print resources detail the distinctions among these options and will help users select appropriate contrasts.
For more information about contrasts, you can open the IBM SPSS help manual from within SPSS by clicking the “Help” button
at the bottom of the One-Way ANOVA dialog window.
D Post Hoc: (Optional) Request post hoc (also known as multiple comparisons) tests. Specific post hoc tests can be selected
by checking the associated boxes.

Figure 4

1 Equal variances assumed: Multiple comparisons options that assume homogeneity of variance (each group has
equal variance). For detailed information about the specific comparison methods, click the Help button in this window.
2 Test: By default, a 2-sided hypothesis test is selected. Alternatively, a directional, one-sided hypothesis test can be
specified if you choose to use a Dunnett post hoc test. Click the box next to Dunnett and then specify whether the Control
Category is the Last or First Group, numerically, of your grouping variable. In the Test area, click either¿<¿ Control or¿
Control. The one-tailed options require that you specify whether you predict that the mean for the specified control group will
be less than ¿ Control) or greater than ( ¿Control) another group.
3 Equal variance not assumed: Multiple comparisons options that do not assume equal variances. For detailed
information about the specific comparison methods, click the Help button in this window.
4 Significance level: The desired cutoff for statistical significance. By default, significance level is set at 0.05.
When the initial F test indicates that significant differences exists between group means, post hoc tests are useful for
determining which specific means are significantly different when you do not have specific hypotheses that you wish to test.
Post hoc test compare each pair of means (like t-tests), but unlike t-tests, they correct the significance estimate to account for
the multiple comparisons.

E Options: Clicking Options will produce a window where you can specify which statistics to include in the output
(Descriptive, Fixed and random effects, homogeneity of variance test, Brown-Forsythe, Welch), whether to include a Means
plot, and how the analysis will address Missing Values (i.e., Exclude cases analysis by analysis or Exclude cases
Listwise). Click Continue when you are finished making specifications.

Figure 5

Click OK to run the One-Way ANOVA.

Example
To introduce One-Way ANOVA, let’s use an example with relatively obvious conclusion. The goal here is to show the
thought process behind a One-Way ANOVA.

PROBLEM STATEMENT
In the sample data set, the variable Sprint is the respondent’s time (in seconds) to sprint a given distance, and
Smoking is an indicator about whether or not the respondent smokes ( 0= nonsmoker, 1= Past smoker, 2 = Current smoker).
Let’s use ANOVA to test if there is a statistically significant difference in sprint time with respect to smoking status. Sprint time
will serve as the dependent variable, and smoking status will act as the independent variable.

BEFORE THE TEST


Just like we did with the paired t-test and the independent samples t-test, we’ll want to look at descriptive statistics
and graphs to get picture of the data before we run any inferential statistics.

The sprint times are a continuous measure of time to sprint a given distance in seconds. From the Descriptive
procedure (Analyze¿Descriptive Statistics¿Descriptives), we see that the times exhibit a range of 4.5 to 9.6 seconds,
with a mean of 6.6 seconds (based on n=374 valid cases). From the Compare Means procedure (Analyze¿Compare Means¿
Means), we see these statistics with respect to the groups of interest.

N Mean Standard Deviation


Nonsmoker 261 6.411 1.252
Past smoker 33 6.835 1.024
Current smoker 59 7.121 1.084
Total 353 6.569 1.234

Notice that, according to the Compare Means procedure, the valid sample size is actually n=353. This is because Compare
Means (and additionally, the one-way ANOVA procedure itself) requires there to be nonmissing values for both the sprint time
and the smoking indicator.
Lastly, we’ll also want to look at a comparative box plot to get an idea of the distribution of the data with respect to the
groups:

Figure 6
From the box plots, we see that there are no outliers; that the distributions are roughly symmetric; and that the center of the
distribution don’t appear to be hugely different. The median sprint time of the past and current smokers.

RUNNING THE PROCEDURE


1. Click Analyze¿Compare Means¿One-Way ANOVA
2. Add the variable Sprint to the Dependent List box, and add the variable Smoking to the Factor box.
3. Click Options. Check the box for Means plot, then click Continue.
4. Click OK when finished.
Output for the analysis will display in the Output Viewer window.

OUTPUT
The output displays a table entitled ANOVA

Figure 7

After any table output, the Means plot displayed.

Figure 8

The Means plot is a visual representation of what we saw in the Compare Means Output. The points on the chart are the
average of each group. It’s much easier to see from this graph that the current smokers had the slowest mean sprint time,
while the nonsmokers had the fastest mean sprint time.
DISCUSSION AND CONCLUSION
We conclude that the mean sprint time is significantly different for at least one of the smoking groups ( F2,350=9.209, p˂0.001).
Note that the ANOVA alone does not tell us specifically which means were different from one another. To determine that, we
would need to follow up with multiple comparisons (or post hoc) tests.

You might also like