STA 402S 1998: SAS Lesson 3

Multiple comparisons


options linesize=79 pagesize=35;
title 'STA 402S98 SAS Lesson 3:  Multiple Comparisons';

proc format; /* Used to label values of the categorical variables */
     value carfmt    1 = 'US'
                     2 = 'Japanese'
                     3 = 'Other' ;
data auto;
     infile 'cars.dat';
     input country mpg weight length;
     label country = 'Country of Origin'
           mpg = 'Miles per Gallon';
     format country carfmt.;
proc sort; by country;
proc univariate plot; var mpg; by country; /* side-by-side boxplots */

proc glm;
     class country;
     model mpg = country ;
     means country;
     means country / alpha=.05 bon tukey scheffe; /* alpha=.05 is default */;
     estimate 'JAPvsUSO' country 1 -.5 -.5;


Part of the list file looks like this.




Variable=MPG           Miles per Gallon

                   |
                40 +                                    0
                   |
                   |            0           |
                   |                        |
                30 +            |        +-----+
                   |            |        |     |
                   |            |        *--+--*     +-----+
                   |         +-----+     |     |     *--+--*
                20 +         *--+--*     +-----+     |     |
                   |         +-----+        |        +-----+
                   |            |                       |
                   |            |
                10 +
                    ------------+-----------+-----------+-----------
           COUNTRY                US    Japanese       Other



                       General Linear Models Procedure
                            Class Level Information

                     Class    Levels    Values

                     COUNTRY       3    Japanese Other US

                    Number of observations in data set = 75

NOTE: Due to missing values, only 74 observations can be used in this
analysis.

                STA 402S98 SAS Lesson 3:  Multiple Comparisons

                        General Linear Models Procedure
Dependent Variable: MPG   Miles per Gallon
                                     Sum of            Mean
Source                  DF          Squares          Square  F Value    Pr > F

Model                    2     421.83533359    210.91766679     7.41    0.0012
Error                   71    2021.62412587     28.47357924
Corrected Total         73    2443.45945946

                  R-Square             C.V.        Root MSE           MPG Mean

                  0.172639         25.05512       5.3360640          21.297297


                        General Linear Models Procedure

                 Level of        -------------MPG-------------
                 COUNTRY     N       Mean              SD

                 Japanese   11     26.1818182       6.11258017
                 Other      11     23.3636364       7.07492371
                 US         52     19.8269231       4.74329725


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

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

             Alpha= 0.05  Confidence= 0.95  df= 71  MSE= 28.47358
                  Critical Value of Studentized Range= 3.385

       Comparisons significant at the 0.05 level are indicated by '***'.
                            Simultaneous            Simultaneous
                                   Lower    Difference     Upper
              COUNTRY           Confidence    Between   Confidence
             Comparison            Limit       Means       Limit

        Japanese - Other          -2.629       2.818       8.265
        Japanese - US              2.116       6.355      10.594   ***

        Other    - Japanese       -8.265      -2.818       2.629
        Other    - US             -0.703       3.537       7.776

        US       - Japanese      -10.594      -6.355      -2.116   ***
        US       - Other          -7.776      -3.537       0.703


                        General Linear Models Procedure

                  Bonferroni (Dunn) T tests for variable: MPG

          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= 71  MSE= 28.47358
                         Critical Value of T= 2.45202

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

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

        Japanese - Other          -2.761       2.818       8.397
        Japanese - US              2.013       6.355      10.697   ***

        Other    - Japanese       -8.397      -2.818       2.761
        Other    - US             -0.806       3.537       7.879

        US       - Japanese      -10.697      -6.355      -2.013   ***
        US       - Other          -7.879      -3.537       0.806



                        General Linear Models Procedure

                       Scheffe's test for variable: MPG

          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= 71  MSE= 28.47358
                         Critical Value of F= 3.12576

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

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

        Japanese - Other          -2.871       2.818       8.507
        Japanese - US              1.927       6.355      10.783   ***

        Other    - Japanese       -8.507      -2.818       2.871
        Other    - US             -0.891       3.537       7.964

        US       - Japanese      -10.783      -6.355      -1.927   ***
        US       - Other          -7.964      -3.537       0.891


                       General Linear Models Procedure

Dependent Variable: MPG   Miles per Gallon

                                        T for H0:    Pr > |T|   Std Error of
Parameter                  Estimate    Parameter=0                Estimate

JAPvsUSO                -4.94580420          -3.64     0.0005     1.35713759