You are on page 1of 15

SPSS

Statistical Package for


Social Sciences.
For
MSc & High diploma
Dr. Salema Sultan Salman

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:
 Independent t Test
 Independent Measures t Test
 Independent Two-sample t Test
The variables used in this test are known as:
 Dependent variable, or test variable
 Independent variable, or grouping variable
Common Uses
The Independent Samples t Test is commonly used to test the following:
 Statistical differences between the means of two groups
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)
Hypotheses
The null hypothesis (H0) and alternative hypothesis (H1) of the Independent Samples t Test
can be expressed in two different but equivalent ways:
H0: µ1 = µ2 ("the two population means are equal")
H1: µ1 ≠ µ2 ("the two population means are not equal")
Levene’s Test for Equality of Variances
Recall that the Independent Samples t Test requires the assumption of homogeneity of
variance -- i.e., both groups have the same variance.
The hypotheses for Levene’s test are: 
H0: σ12 - σ22 = 0 ("the population variances of group 1 and 2 are equal")
H1: σ12 - σ22 ≠ 0 ("the population variances of group 1 and 2 are not equal")
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 :-
A-Test Variable(s): The dependent variable(s). This is the continuous variable whose means
will be compared between the two groups.
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 two categories (groups); it may have more than two categories.
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 Options section is where you can set your desired confidence level for the confidence
interval for the mean difference, and specify how SPSS should handle missing values.
Define Groups
Clicking the Define Groups button (C) opens the Define Groups window:

1- Use specified values: If 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
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
Options
Clicking the Options button (D) opens the Options 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.

The second section, Independent Samples Test, displays the results most relevant to the
Independent Samples t Test. There are two parts that provide different pieces of information: (A)
Levene’s Test for Equality of Variances and (B) t-test for Equality of Means.
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 of Levene's test and conclude that the variance is significantly
different betweengroup. This tells us that we should look at the "Equal variances not
assumed" row for the t test (and corresponding confidence interval) results. (If this test
result had not been significant -- that is, if we had observed p > α -- 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
 Std. Error Difference is the standard error; it also corresponds to the denominator of the
test statistic

C - Confidence Interval of the Difference: This part of the t-test output complements the
significance test results. Typically, if the CI for the mean difference contains 0, 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 < .001 is less than our chosen significance level α = 0.05, we can reject the null
hypothesis, and conclude that the that the mean mile time for athletes and non-athletes is
significantly different.Based on the results, we can state the following:

 There was a significant difference in mean between groups.


One-Way ANOVA
The 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)
o This variable divides cases into two or more mutually exclusive levels, or groups.
Hypotheses
The null and alternative hypotheses of one-way ANOVA can be expressed as:
H0: µ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)
Test Statistic
The test statistic for a 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:

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
F=MSR/MSE
Run a One-Way ANOVA
To run a One-Way ANOVA in SPSS, click Analyze > Compare Means > One-Way ANOVA.

The One-Way ANOVA 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 two areas: Dependent List or Factor.

A- Dependent List: The dependent variable(s). This is the variable whose means will be
compared between the samples (groups).
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.
When the initial F test indicates that significant differences exist 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).

Post Hoc: (Optional) Request post hoc (also known as multiple comparisons) tests. Specific post
hoc tests can be selected by checking the associated boxes.
1-Equal Variances Assumed: Multiple comparisons options that assume homogeneity of
variance (each group has equal variance).
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 Variances Not Assumed: Multiple comparisons options that do not assume equal
variances.
4 -Significance level: The desired cutoff for statistical significance. By default, significance is
set to 0.05.

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 list wise). Click
Continue when you are finished making specifications.
Click OK to run the One-Way ANOVA.
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.

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.
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.
o There is no relationship between the subjects in each group.
o The categorical variables are not "paired" in any way (e.g. pre-test/post-test
observations).
4. Relatively large sample size.
o Expected frequencies for each cell are at least 1.
o 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]"
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.

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.
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.
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:

1Observed: The actual number of observations for a given cell. This option is enabled by
default.
2Expected: The expected number of observations for that cell (see the test statistic formula).
3Unstandardized Residuals: The "residual" value, computed as observed minus expected.
Example: Chi-square Test for 3x2 Table
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).
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.
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.
How to Use SPSS for Contingency Table, Relative Risk, Odds Ratio and Chi-Square
Test
Example: Suppose we conducted a prospective cohort study to investigate the effect of aspirin
on heart disease. A group of patients who are at risk for a heart attack are randomly assigned to
either a placebo or aspirin. At the end of one year, the number of patients suffering a heart attack
is recorded.
Odds ratio (of having heart disease for placebo v.s. Aspirin)= (20x135)/(80x15)= 2.25
Relative risk (of having heart disease for placebo v.s. Aspirin)= (20/100)/(15/150)= .2/.1 = 2
(The risk of a heart attack for people on placebo is twice that of people on aspirin.)

Step 1: First, create the data in SPSS Data Editor, and then weight the cases entered in the Data
Editor by click Data and select Weight Cases. In the Weight Cases dialog box select frequency
variable for weighting the cases. Weight Cases will allow users to be able to make a contingency
table with the joint frequency distribution entered and each associate with a joint class. For
example, 20 is the frequency for “Yes” and “Placebo”. The disease variable has internal values 0
and 1 (0 is labeled as Yes and 1 is labeled as No). The factor variable has internal values 0 and 1
(0 is labeled as Placebo and 1 is labeled as Aspirin).

Step 2: Following the procedure below (Analyze/Descriptive Statistics/Crosstabs) to make the


contingency table. In SPSS, the row variable is risk factor and column variable is outcome
variable.

You might also like