/* Example SAS code for mixed effect ANOVA */

 

Option ps=45 ls=80 nodate nonumber;

 

DATA ta7_4;

  input method day Y;

  Lines;

  1 1 142.3

  1 1 144.0

  1 2 134.9

  1 2 146.3

  1 3 148.6

  1 3 156.5

  1 4 152.0

  1 4 151.4

  2 1 142.9

  2 1 147.4

  2 2 125.9

  2 2 127.6

  2 3 135.5

  2 3 138.9

  2 4 142.9

  2 4 142.3

;

Proc GLM;

  class method day;

  Model Y=method day method*day ;

  random day method*day/test;

  output out=out7_4 r=resid p=pred;

  contrast 'method1-method2' method 1 -1 / E=method*day;

run;

 


/* partial output

 

                                 The SAS System

 

                               The GLM Procedure

 

                            Class Level Information

 

                        Class         Levels    Values

 

                        method             2    1 2

 

                        day                4    1 2 3 4

 

 

                    Number of Observations Read          16

                    Number of Observations Used          16

 

                                 The SAS System

 

                               The GLM Procedure

 

Dependent Variable: Y

 

                                       Sum of

 Source                     DF        Squares    Mean Square   F Value   Pr > F

 

 Model                       7     945.697500     135.099643      9.37   0.0026

 

 Error                       8     115.340000      14.417500

 

 Corrected Total            15    1061.037500

 

 

               R-Square     Coeff Var      Root MSE        Y Mean

 

               0.891295      2.665290      3.797038      142.4625

 

 

 Source                     DF      Type I SS    Mean Square   F Value   Pr > F

 

 method                      1    329.4225000    329.4225000     22.85   0.0014

 day                         3    431.4425000    143.8141667      9.97   0.0044

 method*day                  3    184.8325000     61.6108333      4.27   0.0446

 

 

 Source                     DF    Type III SS    Mean Square   F Value   Pr > F

 

 method                      1    329.4225000    329.4225000     22.85   0.0014

 day                         3    431.4425000    143.8141667      9.97   0.0044

 method*day                  3    184.8325000     61.6108333      4.27   0.0446


 

                                 The SAS System

 

                               The GLM Procedure

 

   Source                  Type III Expected Mean Square

 

   method                  Var(Error) + 2 Var(method*day) + Q(method)

 

   day                     Var(Error) + 2 Var(method*day) + 4 Var(day)

 

   method*day              Var(Error) + 2 Var(method*day)

 

                                 The SAS System

 

                               The GLM Procedure

            Tests of Hypotheses for Mixed Model Analysis of Variance

 

Dependent Variable: Y

 

 Source                     DF    Type III SS    Mean Square   F Value   Pr > F

 

 method                      1     329.422500     329.422500      5.35   0.1038

 day                         3     431.442500     143.814167      2.33   0.2522

 

 Error                       3     184.832500      61.610833

 Error: MS(method*day)

 

 

 Source                     DF    Type III SS    Mean Square   F Value   Pr > F

 

 method*day                  3     184.832500      61.610833      4.27   0.0446

 

 Error: MS(Error)            8     115.340000      14.417500

 

 

 

Note: SAS uses the unrestricted model for hypothesis test above. For the restricted model, use MSB/MSE (instead of MSB/MSAB) to test the significance of the variance component for the random factor.

 

 

                                 The SAS System

 

 

 

Dependent Variable: Y

 

   Tests of Hypotheses Using the Type III MS for method*day as an Error Term

 

 Contrast                   DF    Contrast SS    Mean Square   F Value   Pr > F

 

 method1-method2             1    329.4225000    329.4225000      5.35   0.1038