Two-Way ANOVA Model #1

Factory Example

Program Listing

OPTIONS LS=80 NODATE NONUMBER NOCENTER;

DATA factory (DROP=rep);
 DO shift = 1 TO 3;    /* 3 shifts */
  DO gender = 2,1 ;  /* 2=male, 1=female */
   DO rep = 1 TO 2;    /* 2 replicates */
    INPUT response @@;
    OUTPUT;
   END;
  END;
 END;
 DATALINES;
 8 6  10 12    2 4  6 8    4 6  6 8
;

PROC FORMAT;
 VALUE gend 1='Female' 2='Male';
RUN;

TITLE1 'Two-Way ANOVA';
TITLE2 'Factory Data';
PROC GLM DATA=factory;
 CLASS shift gender;
 FORMAT gender gend.;
 TITLE3 'Full Model';
 MODEL response = shift gender shift*gender;
 RUN;
 TITLE3 "Tukey's All Pairwise Comparisons";
 LSMEANS shift gender/ADJUST=TUKEY CL PDIFF;
 *LSMEANS gender/ADJUST=TUKEY CL PDIFF;
 RUN;
 TITLE3 "Bonferroni on treatment means";
 LSMEANS shift*gender/ADJUST=BON CL PDIFF;
 RUN;
 TITLE3 "Simple Effects of Gender Within Shift";
 LSMEANS shift*gender/SLICE=shift;
 RUN;
 TITLE3 "alpha[1] - alpha[2]";
 ESTIMATE 'alpha[1] - alpha[2]' gender 1 -1;
 RUN;
 TITLE3 "mu[11] - mu[12]";
 ESTIMATE 'mu[11] - mu[12]' gender 1 -1 shift*gender 1 -1;
 RUN;
 TITLE3 "Two Contrasts";
 CONTRAST 'two contrasts' gender 1 -1,
                          gender 1 -1 shift*gender 1 -1;
 RUN;
QUIT;

Output Listing

Two-Way ANOVA
Factory Data
Full Model

The GLM Procedure
 
Dependent Variable: response   
                                                                      
                              Sum of
Source             DF        Squares    Mean Square   F Value   Pr > F
Model               5    70.66666667    14.13333333      7.07   0.0169 
Error               6    12.00000000     2.00000000                   
Corrected Total    11    82.66666667                                  

R-Square     Coeff Var      Root MSE    response Mean
0.854839      21.21320      1.414214         6.666667

                                                                    
Source           DF      Type I SS    Mean Square   F Value   Pr > F
shift             2    34.66666667    17.33333333      8.67   0.0170
gender            1    33.33333333    33.33333333     16.67   0.0065
shift*gender      2     2.66666667     1.33333333      0.67   0.5477

                                                                    
Source           DF    Type III SS    Mean Square   F Value   Pr > F
shift             2    34.66666667    17.33333333      8.67   0.0170
gender            1    33.33333333    33.33333333     16.67   0.0065
shift*gender      2     2.66666667     1.33333333      0.67   0.5477


Two-Way ANOVA
Factory Data
Tukey's All Pairwise Comparisons

The GLM Procedure
Least Squares Means
Adjustment for Multiple Comparisons: Tukey

                                 
             response      LSMEAN
shift          LSMEAN      Number
1          9.00000000           1
2          5.00000000           2
3          6.00000000           3

     Least Squares Means for effect shift
     Pr > |t| for H0: LSMean(i)=LSMean(j)
                       
         Dependent Variable: response
 
i/j              1             2             3
   1                      0.0167        0.0544
   2        0.0167                      0.6035
   3        0.0544        0.6035              

                                                
             response
shift          LSMEAN      95% Confidence Limits
1            9.000000        7.269772  10.730228
2            5.000000        3.269772   6.730228
3            6.000000        4.269772   7.730228

        Least Squares Means for Effect shift
 
                                                   
            Difference         Simultaneous 95%
               Between      Confidence Limits for
i    j           Means       LSMean(i)-LSMean(j)   
1    2        4.000000        0.931851     7.068149
1    3        3.000000       -0.068149     6.068149
2    3       -1.000000       -4.068149     2.068149


Two-Way ANOVA
Factory Data
Tukey's All Pairwise Comparisons

The GLM Procedure
Least Squares Means
Adjustment for Multiple Comparisons: Tukey

                                     
                          H0:LSMean1=
              response      LSMean2
gender          LSMEAN       Pr > |t|
Female      8.33333333         0.0065
Male        5.00000000               

                                                   
              response
gender          LSMEAN        95% Confidence Limits
Female        8.333333        6.920608     9.746059
Male          5.000000        3.587275     6.412725

       Least Squares Means for Effect gender
 
            Difference         Simultaneous 95%
               Between      Confidence Limits for
i    j           Means       LSMean(i)-LSMean(j)
1    2        3.333333        1.335438     5.331229


Two-Way ANOVA
Factory Data
Bonferroni on treatment means

The GLM Procedure
Least Squares Means
Adjustment for Multiple Comparisons: Bonferroni

                                           
                       response      LSMEAN
shift    gender          LSMEAN      Number
1        Female      11.0000000           1
1        Male         7.0000000           2
2        Female       7.0000000           3
2        Male         3.0000000           4
3        Female       7.0000000           5
3        Male         5.0000000           6

                Least Squares Means for effect shift*gender
                    Pr > |t| for H0: LSMean(i)=LSMean(j)
                                      
                                                                
                  Dependent Variable: response
i/j          1         2         3         4         5         6
   1              0.4503    0.4503    0.0197    0.4503    0.0814
   2    0.4503              1.0000    0.4503    1.0000    1.0000
   3    0.4503    1.0000              0.4503    1.0000    1.0000
   4    0.0197    0.4503    0.4503              0.4503    1.0000
   5    0.4503    1.0000    1.0000    0.4503              1.0000
   6    0.0814    1.0000    1.0000    1.0000    1.0000          

                                                            
                       response
shift    gender          LSMEAN        95% Confidence Limits
1        Female       11.000000        8.553088    13.446912
1        Male          7.000000        4.553088     9.446912
2        Female        7.000000        4.553088     9.446912
2        Male          3.000000        0.553088     5.446912
3        Female        7.000000        4.553088     9.446912
3        Male          5.000000        2.553088     7.446912

    Least Squares Means for Effect shift*gender
 
                                                   
            Difference         Simultaneous 95%
               Between      Confidence Limits for
i    j           Means       LSMean(i)-LSMean(j)   
1    2        4.000000       -2.643866    10.643866
1    3        4.000000       -2.643866    10.643866
1    4        8.000000        1.356134    14.643866
1    5        4.000000       -2.643866    10.643866
1    6        6.000000       -0.643866    12.643866
2    3               0       -6.643866     6.643866
2    4        4.000000       -2.643866    10.643866
2    5               0       -6.643866     6.643866
2    6        2.000000       -4.643866     8.643866


Two-Way ANOVA
Factory Data
Bonferroni on treatment means

The GLM Procedure
Least Squares Means
Adjustment for Multiple Comparisons: Bonferroni

    Least Squares Means for Effect shift*gender
 
                                                   
            Difference         Simultaneous 95%
               Between      Confidence Limits for
i    j           Means       LSMean(i)-LSMean(j)   
3    4        4.000000       -2.643866    10.643866
3    5               0       -6.643866     6.643866
3    6        2.000000       -4.643866     8.643866
4    5       -4.000000      -10.643866     2.643866
4    6       -2.000000       -8.643866     4.643866
5    6        2.000000       -4.643866     8.643866


Two-Way ANOVA
Factory Data
Simple Effects of Gender Within Shift

The GLM Procedure
Least Squares Means
                               
                       response
shift    gender          LSMEAN
1        Female      11.0000000
1        Male         7.0000000
2        Female       7.0000000
2        Male         3.0000000
3        Female       7.0000000
3        Male         5.0000000


Two-Way ANOVA
Factory Data
Simple Effects of Gender Within Shift

The GLM Procedure
Least Squares Means

          shift*gender Effect Sliced by shift for response
 
                                                                    
                         Sum of
shift        DF         Squares     Mean Square    F Value    Pr > F
1             1       16.000000       16.000000       8.00    0.0300
2             1       16.000000       16.000000       8.00    0.0300
3             1        4.000000        4.000000       2.00    0.2070


Two-Way ANOVA
Factory Data
alpha[1] - alpha[2]

The GLM Procedure
 
Dependent Variable: response   
                                        Standard
Parameter                 Estimate         Error    t Value   Pr > |t|
alpha[1] - alpha[2]     3.33333333    0.81649658       4.08     0.0065


Two-Way ANOVA
Factory Data
mu[11] - mu[12]

The GLM Procedure
 
Dependent Variable: response   
                                     Standard
Parameter             Estimate          Error    t Value    Pr > |t|
mu[11] - mu[12]     4.00000000     1.41421356       2.83      0.0300


Two-Way ANOVA
Factory Data
Two Contrasts

The GLM Procedure
 
Dependent Variable: response   

Contrast           DF    Contrast SS    Mean Square   F Value   Pr > F
two contrasts       2    34.00000000    17.00000000      8.50   0.0178