next up previous
Next: About this document

STAT 330: 95-3

SAS example: ANOVA for a one way layout

The data consist of blood coagulation times for 24 animals fed one of 4 different diets. I use proc anova to test the hypothesis of no differences between mean coagulation times and to get simulataneous confidence intervals for all possible differences between mean times.

The data

A 62
A 60
A 63
A 59
B 63
B 67
B 71
B 64
B 65
B 66
C 68
C 66
C 71
C 67
C 68
C 68
D 56
D 62
D 60
D 61
D 63
D 64
D 63
D 59

I ran the following SAS code:

  options pagesize=60 linesize=70;
  data coagul;
  infile 'coagul.dat';
  input diet $ time ;
   label time='Coagulation Time';
  proc sort data=coagul;
   by diet;
  proc anova  data=coagul;
   class diet;
   model time = diet;
   means diet / bon regwq tukey cldiff;
   means diet / bon regwq tukey ;
  run;

The two lines labelled means request confidence intervals for differences between the 4 population means. The line class diet is a required saying that the variable class defines categories for the analysis of variance. The model line declares that I am interested only in the influence of diet on time; this line is also required.

The output from proc anova is

                            The SAS System                           8
                                      15:40 Thursday, October 26, 1995

                    Analysis of Variance Procedure
                       Class Level Information

                      Class    Levels    Values

                      DIET          4    A B C D


               Number of observations in data set = 24


                            The SAS System                           9
                                      15:40 Thursday, October 26, 1995

                    Analysis of Variance Procedure

Dependent Variable: TIME   Coagulation Time

Source                  DF    Sum of Squares     F Value      Pr > F
Model                    3      228.00000000       13.57      0.0001
Error                   20      112.00000000
Corrected Total         23      340.00000000

                  R-Square              C.V.               TIME Mean
                  0.670588          3.697550              64.0000000


Source                  DF          Anova SS     F Value      Pr > F
DIET                     3      228.00000000       13.57      0.0001



                            The SAS System                          10
                                      15:40 Thursday, October 26, 1995

                    Analysis of Variance Procedure

       Tukey's Studentized Range (HSD) Test for variable: TIME

     NOTE: This test controls the type I experimentwise error rate.

           Alpha= 0.05  Confidence= 0.95  df= 20  MSE= 5.6
              Critical Value of Studentized Range= 3.958

  Comparisons significant at the 0.05 level are indicated by '***'.

                       Simultaneous            Simultaneous
                           Lower    Difference     Upper
            DIET        Confidence    Between   Confidence
         Comparison        Limit       Means       Limit

        C    - B          -1.824       2.000       5.824
        C    - A           2.725       7.000      11.275   ***
        C    - D           3.423       7.000      10.577   ***

        B    - C          -5.824      -2.000       1.824
        B    - A           0.725       5.000       9.275   ***
        B    - D           1.423       5.000       8.577   ***

        A    - C         -11.275      -7.000      -2.725   ***
        A    - B          -9.275      -5.000      -0.725   ***
        A    - D          -4.056       0.000       4.056

        D    - C         -10.577      -7.000      -3.423   ***
        D    - B          -8.577      -5.000      -1.423   ***
        D    - A          -4.056       0.000       4.056


                            The SAS System                          11
                                      15:40 Thursday, October 26, 1995

                    Analysis of Variance Procedure

             Bonferroni (Dunn) T tests for variable: TIME

     NOTE: This test controls the type I experimentwise error rate
           but generally has a higher type II error rate than Tukey's
           for all pairwise comparisons.

           Alpha= 0.05  Confidence= 0.95  df= 20  MSE= 5.6
                     Critical Value of T= 2.92712

  Comparisons significant at the 0.05 level are indicated by '***'.

                       Simultaneous            Simultaneous
                           Lower    Difference     Upper
            DIET        Confidence    Between   Confidence
         Comparison        Limit       Means       Limit

        C    - B          -1.999       2.000       5.999
        C    - A           2.529       7.000      11.471   ***
        C    - D           3.259       7.000      10.741   ***

        B    - C          -5.999      -2.000       1.999
        B    - A           0.529       5.000       9.471   ***
        B    - D           1.259       5.000       8.741   ***

        A    - C         -11.471      -7.000      -2.529   ***
        A    - B          -9.471      -5.000      -0.529   ***
        A    - D          -4.242       0.000       4.242

        D    - C         -10.741      -7.000      -3.259   ***
        D    - B          -8.741      -5.000      -1.259   ***
        D    - A          -4.242       0.000       4.242


                            The SAS System                          12
                                      15:40 Thursday, October 26, 1995

                    Analysis of Variance Procedure

   Ryan-Einot-Gabriel-Welsch Multiple Range Test for variable: TIME

     NOTE: This test controls the type I experimentwise error rate.

                    Alpha= 0.05  df= 20  MSE= 5.6
                  WARNING: Cell sizes are not equal.
                Harmonic Mean of cell sizes= 5.647059

            Number of Means         2         3         4
            Critical Range  3.4039958 3.5629957 3.9417679

     Means with the same letter are not significantly different.

            REGWQ Grouping              Mean      N  DIET

                         A            68.000      6  C
                         A
                         A            66.000      6  B

                         B            61.000      4  A
                         B
                         B            61.000      8  D



                            The SAS System                          13
                                      15:40 Thursday, October 26, 1995

                    Analysis of Variance Procedure

       Tukey's Studentized Range (HSD) Test for variable: TIME

     NOTE: This test controls the type I experimentwise error rate,
           but generally has a higher type II error rate than REGWQ.

                    Alpha= 0.05  df= 20  MSE= 5.6
              Critical Value of Studentized Range= 3.958
                Minimum Significant Difference= 3.9418
                  WARNING: Cell sizes are not equal.
                Harmonic Mean of cell sizes= 5.647059

     Means with the same letter are not significantly different.

            Tukey Grouping              Mean      N  DIET

                         A            68.000      6  C
                         A
                         A            66.000      6  B

                         B            61.000      4  A
                         B
                         B            61.000      8  D



                            The SAS System                          14
                                      15:40 Thursday, October 26, 1995

                    Analysis of Variance Procedure

             Bonferroni (Dunn) T tests for variable: TIME

     NOTE: This test controls the type I experimentwise error rate,
           but generally has a higher type II error rate than REGWQ.

                    Alpha= 0.05  df= 20  MSE= 5.6
                      Critical Value of T= 2.93
                Minimum Significant Difference= 4.1223
                  WARNING: Cell sizes are not equal.
                Harmonic Mean of cell sizes= 5.647059

     Means with the same letter are not significantly different.

             Bon Grouping              Mean      N  DIET

                        A            68.000      6  C
                        A
                        A            66.000      6  B

                        B            61.000      4  A
                        B
                        B            61.000      8  D

The ANOVA table shows overwhelmingly significant evidence against the hypothesis of equal means. The multiple comparison procedures say that diets B and C are indistinguishable, as are A and D but that these two groups definitely differ from each other. The procedure called TUKEY is the only one under consideration in this course. The keyword CLDIFF on the first means line asked for actual confidence intervals while the second line produced the grouping just discussed.





Richard Lockhart
Thu Sep 5 16:13:09 PDT 1996