Psychology 815:Computer Lab #9
Analysis of Variance: interactions, contrasts, and planned comparisons
November 1, 1996


Happy Halloween! I hope this lab won't be too scary :)

We're going to use the JAM/US data set again. Since we will continue to use this data set throughout the semester, I want to make sure that it is always available to you -- in case you accidentally write over it or lose it. I therefore put the two raw data sets (JAMCBCL.DAT and USCBCL.DAT), as well as the SAS program that reads in the data and merges it into one data set (READDATA.SAS) on my FTP site. While I was at it, I put the SE-ETA program there too. What does FTP mean? It stands for File Transfer Protocol, which basically means that you can download the data and the program directly to your disk using Netscape or any other web browser.

 Note: To get to the FTP site, follow this link: ftp://culture.psy.msu.edu/
 
 

Objectives:

  1. Analysis of Variance (multifactorial design)
  2. Contrasts
  3. Planned comparisons

Objective 1: The Analysis of Variance (ANOVA): multifactorial design

1) Copy the two data files to the TEMP directory on the hard drive and run program

   READDATA to read the data into SAS

2) Run an ANOVA with AGE and SEXCB as the independent variables and AGGRESS as the

   dependent variable.  Ask SAS to give you the interactions, as well as the main effects, for the

   two independent variables.  The SAS code is provided below:



proc glm data=SASUSER.DATA815;

   class AGE SEXCB;                           *remember, these are the independent variables;

   model AGGRESS = AGE SEXCB AGE*SEXCB ;      *notice how the interaction is indicated;

   means AGE SEXCB/;                          *Tells SAS to give you the means;

run;
3) Now, use the output to manually calculate the eta. You will find a calculator in the Accessories folder.

 Here is the formula: eta = SQRT (Type III SS / Corrected Total SS)


Objective 2: Contrasts
 

1) Run an ANOVA with AGE as the independent variable and AGGRESS as the dependent

    variable.  This time, specify the contrasts for linear, quadratic, and cubic.  The numbers for the

    contrasts were provided for you in a separate handout.   Once again, the SAS code is provided:



proc glm;

   class AGE;

   model AGGRESS = AGE;

   contrast 'LINEAR' AGE -3 -1 1 3  /  E ETYPE= 3;                   *The E TYPE indicates error type;

   contrast 'RESIDUAL' AGE 1 -1 -1 1, AGE -1 3 -3 1  /  E ETYPE= 3;  *Combines the quadratic and cubic;

   contrast 'QUADRATIC' AGE 1 -1 -1 1 / E ETYPE=3;

   contrast 'CUBIC'  AGE -1 3 -3 1 / E ETYPE=3;

run;






Objective 3: Planned comparisons

Last week, we used the Scheffe post hoc test to determine which age groups are significantly different from one another. Post hoc tests are fine if you are doing exploratory research, but they're too conservative if you have a directional hypothesis. Here is a good way to test age group differences if you are doing a confirmatory study.
 

1) Run an ANOVA with the same independent and dependent variables as in Objective 2.

    However, this time examine the following sets of contrasts.



proc glm;

   class AGE;

   model AGGRESS  = AGE;

   contrast 'FIRST TWO'  AGE 1 -1 0 0  /  E ETYPE= 3;

   contrast 'MIDDLE TWO' AGE 0 -1 1 0  /  E ETYPE= 3;

   contrast 'LAST TWO'   AGE 0 0 -1 1  /  E ETYPE= 3;

   contrast 'FIRST AND LAST' AGE 1 0 0 -1  /  E ETYPE= 3;

run;



2) You should note the following:

     a) The sum of the numbers in the contrast must always add up to zero

     b) The zeros indicate which age groups to leave out of the contrast

     c) The actual numbers used in these contrasts do not matter, as long as they add up to zero

     d) Very important: Use p = .1 (not .05) as the cutoff for significance.
What age groups are significantly different from one another? How do you know?