Return to Bates College Homepage

Introduction to SPSS for the PC: Within Subject Analyses


Part 2: Within Subject Analyses

Within SPSS, analyses are generated using either menu selections or command syntax.  Below is a description of how to run some common within subject analyses using menu selections.  Following each description is the command syntax used to generate the same analyses along with a brief explanation of the commands (For more help on using syntax see: Tips for SPSS Syntax).  To generate the results utilized in these examples you will need to enter the Raw Data set below.
 

I.      Two-sample Correlated t-test
II.     Repeated Measures ANOVA
III.    Mixed Factorial ANOVA


VI. Two-sample Correlated t-test
Sample question: Do rates of smoking decrease from pre-intervention to post-intervention?  To answer this question, you can run a two-sample correlated t-test comparing the preintervention smoking rates to post-intervention rates.
 



 

Command Syntax for Two-sample Correlated t-test:

T-TEST
  PAIRS= pre  WITH post (PAIRED).
T-TEST
  PAIRS= pre  WITH post (PAIRED). - The "pairs=" subcommand identifies which pair of variables you want to correlate for your t-test.  In this case we type pre WITH post (PAIRED).


Back to Within Subject Analyses list
 

II. Repeated Measures Analysis of Variance (ANOVA)
Sample question: Do rates of smoking decrease across the four data collection periods.  That is, does smoking not only decrease from pre-intervention to post-intervention but also does the rate continue to decrease during a 6-month and 12-month follow up?  To answer this question you can run a repeated measures ANOVA, comparing all four time periods for all smokers.



 


Command Syntax for Repeated Measures ANOVA:

GLM
  pre post follow6 follow12
  /WSFACTOR = rate 4
  /EMMEANS = TABLES(rate) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE
  /WSDESIGN = rate .
GLM
  pre post follow6 follow12 - This statement indicates all the time variables to be examined.
 /WSFACTOR = rate 4 - This statement indicates that the above variables should be treated as a within subject factor.  The title of the factor is "rate" which has "4" time variables.
/EMMEANS = TABLES(rate) COMPARE ADJ(LSD) - This command will generate estimated marginal means and conduct a post hoc test (in this case the least significance difference test).
/PRINT = DESCRIPTIVE - The "/print=" subcommand allows the user to print several descriptive and inferential statistical tests that may be important to examine when running a repeated measures ANOVA.  To get a complete list of the statistics offered for the Repeated Measures ANOVA refer to the help menu in SPSS (i.e., Select Help > Topics on the menu bar which will open the Help Topics window.  Click on the Index tab.  Type "GLM" in the box.  GLM Repeated Measures will appear in the second box.  Highlight Options under GLM Repeated Measures.  Click on the Display button.).
/WSDESIGN = rate. - The "/wsdesign=" subcommand identifies the main and interaction effects to be analyzed using a within subject design.
Back to Within Subject Analyses list
 

III. Mixed Factorial ANOVA
Sample question: Do the smoking rates differ across the three types of smoking cessation program over time?  That is, does one program lead to greater reductions in smoking rates among smokers?  To answer this question you can run a Mixed Factorial ANOVA, with pre- and post intervention smoking rates as the within subject variable and smoking cessation program as the independent variable.


 


Command Syntax for Mixed Factorial ANOVA:

GLM
  pre post BY program
  /WSFACTOR = time 2
  /POSTHOC = program ( TUKEY )
  /EMMEANS = TABLES(time) COMPARE ADJ(LSD)
  /PRINT = DESCRIPTIVE
  /WSDESIGN = time
  /DESIGN = program .
GLM
  pre post BY program - This statement indicates the between subject and with subject factors to be utilized when conducting the Mixed ANOVA.  The within subject variable is listed first followed by the between subject variable with "By" separating the two.
 /WSFACTOR = time 2 - This statement indicates that the above variables should be treated as a within subject factor.  The title of the factor is "time" and there "2" time variables.
 /POSTHOC = TUKEY - The "/posthoc=" subcommand will generate the post hoc test listed after the equal sign (in this case Tukey's) for the between subject variable(s).  For a complete list of post hoc tests refer to the GLM Repeated Measures Options in the SPSS help files.
/EMMEANS = TABLES(time) COMPARE ADJ(LSD) - This command will generate estimated marginal  means and conduct a post hoc test (in this case the least significance difference test) for the within subject variable(s).
 /PRINT = DESCRIPTIVE - The "/print=" subcommand allows the user to print several descriptive and inferential statistical tests that may be important to examine when running a Mixed ANOVA.  To get a complete list of the statistics offered refer to the help menu in SPSS (i.e., Select Help > Topics on the menu bar which will open the Help Topics window.  Click on the Index tab.  Type "GLM" in the box.  GLM Repeated Measures will appear in the second box.  Highlight Options under GLM Repeated Measures.  Click on the Display button.).
/WSDESIGN = time. - The "/wsdesign=" subcommand identifies the main and interaction effects to be analyzed related to within subject factor(s).
  /DESIGN = program. - The "/design=" subcommand identifies the main and interaction effects to be analyzed related to between subject factor(s).
 Back to Within Subject Analyses list
 

Raw Data

To illustrate how to conduct within subject analyses we will use the following hypothetical data set based on examining the effectiveness of smoking cessation programs among heavy smokers who are also recovering alcoholics.  The description of the variables are given below the data set.  Please refer to Setting Up Data Files to define variables and enter data into SPSS.
 
 
id
gender
program
pre
post
follow6
follow12
1
1
1
31
15
18
19
2
2
1
28
0
0
0
3
1
1
26
12
15
15
4
2
1
38
0
0
1
5
2
1
19
7
9
8
6
1
1
24
0
5
6
7
2
1
26
7
10
11
8
1
1
32
16
14
15
9
2
1
29
8
10
9
10
2
1
25
5
8
7
11
2
2
37
0
6
6
12
1
2
21
0
4
5
13
2
2
28
10
13
13
14
2
2
27
5
5
4
15
1
2
35
0
0
0
16
2
2
34
11
10
9
17
1
2
38
0
0
0
18
2
2
32
0
6
7
19
2
2
36
4
7
8
20
1
2
29
0
0
0
21
1
3
30
7
10
12
22
1
3
27
0
0
0
23
1
3
39
13
15
16
24
2
3
41
16
19
23
25
2
3
29
0
7
7
26
2
3
36
0
0
2
27
2
3
33
9
14
16
28
1
3
32
18
17
18
29
2
3
27
0
0
0
30
2
3
27
0
11
9

 
Variable Name Description and Coding
id participant identification number
gender 1 = female, 2 = male
program 1 = Standard ALA program pus nicotine anonymous program, 2 = Behavioral counseling plus exercise program, 3 = Behavioral counseling plus nicotine gum
pre Mean # of cigarettes smoked per day Pre-intervention
post Mean # of cigarettes smoked following intervention
follow6 Mean # of cigarettes smoked at six month follow up
follow12 Mean # of cigarettes smoked at 12 month follow up

 
 

© 2004 Bates College. All rights reserved.
Maintained by Brian Pfohl