Practice

Computer Programs

SAS headstart
SAS procedures
Program 1
Program 2
Program 3
Program 4
Program 5
Program 6
Program 7
Program 8
Program 9
Program 10
Program 11
Program 12
Program 13
Program 14

Topical Bibliographies (Readings)

Datasets and Stories

Software Help  


Search for 

Program 14

TITLE '2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk';
OPTIONS LS=75 NODATE PAGENO=1;
DATA ANCOVA;
     INPUT a $ b $ y x;
     LABEL a='degree of shock'
           b='race of conferderate'
           x='covariate-TASA score'
           Y='dependent score-change from pre-post';
datalines;
1 1 14 21
1 1 10 18
1 1 2 17
1 1 -2 18
1 1 6 17
1 2 0 16
1 2 -8 16
1 2 -4 15
1 2 8 19
1 2 4 17
2 1 -6 15
2 1 -2 17
2 1 -10 14
2 1 -18 13
2 1 -14 15
2 2 9 19
2 2 -7 14
2 2 5 18
2 2 1 15
2 2 -3 15
;
            
PROC REG;
     MODEL y=x;
     PLOT y*x;
     BY a b;
TITLE2 'Regression of y on x';
RUN;
PROC GLM;
     CLASS a b;
     MODEL y=x a b a*b/solution;
     MEANS a b a*b;
     LSMEANS a b a*b/E STDERR PDIFF;
TITLE2 'ANCOVA analysis through TYPE III SS';
RUN;
PROC GLM;
     CLASS a b;
     MODEL y=x a b a*b x*a*b;
TITLE2 'Test of equal slopes: CRFAC-22';
RUN;
               2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              1
            
---------------- degree of shock=1 race of conferderate=1 -----------------
Model: MODEL1
Dependent Variable: Y          dependent score-change from pre-post
            
                           Analysis of Variance
            
                           Sum of         Mean
  Source          DF      Squares       Square      F Value       Prob>F
  Model            1     72.59259     72.59259        2.492       0.2126
  Error            3     87.40741     29.13580
  C Total          4    160.00000
            
      Root MSE       5.39776     R-square       0.4537
      Dep Mean       6.00000     Adj R-sq       0.2716
      C.V.          89.96265
            
                            Parameter Estimates
                    Parameter      Standard    T for H0:
   Variable  DF      Estimate         Error   Parameter=0    Prob > |T|
   INTERCEP   1    -41.185185   29.99054873        -1.373        0.2633
   X          1      2.592593    1.64248576         1.578        0.2126
            
                 Variable
   Variable  DF     Label
   INTERCEP   1  Intercept
   X          1  covariate-TASA score
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              2
                           Regression of y on x
            
---------------- degree of shock=1 race of conferderate=1 -----------------
            
            
     |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
   Y |                                                                    |
  14 +                                                             1      +
     |                                                                    |
d    |                                                                    |
e    |                                                                    |
p    |                                                                    |
e 12 +                                                                    +
n    |                                                                    |
d    |                                                                    |
e    |                                                                    |
n    |                                                                    |
t 10 +                   1                                                +
     |                                                                    |
s    |                                                                    |
c    |                                                                    |
o    |                                                                    |
r  8 +                                                                    +
e    |                                                                    |
-    |                                                                    |
c    |                                                                    |
h    |                                                                    |
a  6 +     1                                                              +
n    |                                                                    |
g    |                                                                    |
e    |                                                                    |
     |                                                                    |
f  4 +                                                                    +
r    |                                                                    |
o    |                                                                    |
m    |                                                                    |
     |                                                                    |
p  2 +     1                                                              +
r    |                                                                    |
e    |                                                                    |
-    |                                                                    |
p    |                                                                    |
o  0 +                                                                    +
s    |                                                                    |
t    |                                                                    |
     |                                                                    |
     |                                                                    |
  -2 +                   1                                                +
     |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
         17.0   17.5   18.0   18.5   19.0   19.5   20.0   20.5   21.0
            
            
                           covariate-TASA score   X
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              3
            
---------------- degree of shock=1 race of conferderate=2 -----------------
Model: MODEL1
Dependent Variable: Y          dependent score-change from pre-post
            
                           Analysis of Variance
            
                           Sum of         Mean
  Source          DF      Squares       Square      F Value       Prob>F
  Model            1    111.30435    111.30435        6.857       0.0791
  Error            3     48.69565     16.23188
  C Total          4    160.00000
            
      Root MSE       4.02888     R-square       0.6957
      Dep Mean       0.00000     Adj R-sq       0.5942
      C.V.            .
                            Parameter Estimates
                    Parameter      Standard    T for H0:
   Variable  DF      Estimate         Error   Parameter=0    Prob > |T|
   INTERCEP   1    -57.739130   22.12298784        -2.610        0.0797
   X          1      3.478261    1.32828281         2.619        0.0791
            
                 Variable
   Variable  DF     Label
   INTERCEP   1  Intercept
   X          1  covariate-TASA score
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              4
                           Regression of y on x
            
---------------- degree of shock=1 race of conferderate=2 -----------------
            
            
     |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
   Y |                                                                    |
   8 +                                                             1      +
     |                                                                    |
d    |                                                                    |
e    |                                                                    |
p    |                                                                    |
e  6 +                                                                    +
n    |                                                                    |
d    |                                                                    |
e    |                                                                    |
n    |                                                                    |
t  4 +                                 1                                  +
     |                                                                    |
s    |                                                                    |
c    |                                                                    |
o    |                                                                    |
r  2 +                                                                    +
e    |                                                                    |
-    |                                                                    |
c    |                                                                    |
h    |                                                                    |
a  0 +                   1                                                +
n    |                                                                    |
g    |                                                                    |
e    |                                                                    |
     |                                                                    |
f -2 +                                                                    +
r    |                                                                    |
o    |                                                                    |
m    |                                                                    |
     |                                                                    |
p -4 +     1                                                              +
r    |                                                                    |
e    |                                                                    |
-    |                                                                    |
p    |                                                                    |
o -6 +                                                                    +
s    |                                                                    |
t    |                                                                    |
     |                                                                    |
     |                                                                    |
  -8 +                   1                                                +
     |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
         15.0   15.5   16.0   16.5   17.0   17.5   18.0   18.5   19.0
            
            
                           covariate-TASA score   X
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              5
---------------- degree of shock=2 race of conferderate=1 -----------------
            
Model: MODEL1
Dependent Variable: Y          dependent score-change from pre-post
            
                           Analysis of Variance
            
                           Sum of         Mean
  Source          DF      Squares       Square      F Value       Prob>F
  Model            1    116.36364    116.36364        8.000       0.0663
  Error            3     43.63636     14.54545
  C Total          4    160.00000
            
      Root MSE       3.81385     R-square       0.7273
      Dep Mean     -10.00000     Adj R-sq       0.6364
      C.V.         -38.13850
            
                            Parameter Estimates
                    Parameter      Standard    T for H0:
   Variable  DF      Estimate         Error   Parameter=0    Prob > |T|
   INTERCEP   1    -63.818182   19.10389169        -3.341        0.0444
   X          1      3.636364    1.28564869         2.828        0.0663
            
                 Variable
   Variable  DF     Label
   INTERCEP   1  Intercept
   X          1  covariate-TASA score
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              6
                           Regression of y on x
---------------- degree of shock=2 race of conferderate=1 -----------------
            
            
      |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
    Y |                                                                    |
   -2 +                                                             1      +
      |                                                                    |
d     |                                                                    |
e     |                                                                    |
p     |                                                                    |
e  -4 +                                                                    +
n     |                                                                    |
d     |                                                                    |
e     |                                                                    |
n     |                                                                    |
t  -6 +                                 1                                  +
      |                                                                    |
s     |                                                                    |
c     |                                                                    |
o     |                                                                    |
r  -8 +                                                                    +
e     |                                                                    |
-     |                                                                    |
c     |                                                                    |
h     |                                                                    |
a -10 +                   1                                                +
n     |                                                                    |
g     |                                                                    |
e     |                                                                    |
      |                                                                    |
f -12 +                                                                    +
r     |                                                                    |
o     |                                                                    |
m     |                                                                    |
      |                                                                    |
p -14 +                                 1                                  +
r     |                                                                    |
e     |                                                                    |
-     |                                                                    |
p     |                                                                    |
o -16 +                                                                    +
s     |                                                                    |
t     |                                                                    |
      |                                                                    |
      |                                                                    |
  -18 +     1                                                              +
      |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
          13.0   13.5   14.0   14.5   15.0   15.5   16.0   16.5   17.0
            
            
                             covariate-TASA score   X
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              7
            
---------------- degree of shock=2 race of conferderate=2 -----------------
Model: MODEL1
Dependent Variable: Y          dependent score-change from pre-post
            
                           Analysis of Variance
            
                           Sum of         Mean
  Source          DF      Squares       Square      F Value       Prob>F
  Model            1    143.82979    143.82979       26.684       0.0141
  Error            3     16.17021      5.39007
  C Total          4    160.00000
            
      Root MSE       2.32165     R-square       0.8989
      Dep Mean       1.00000     Adj R-sq       0.8652
      C.V.         232.16526
            
                            Parameter Estimates
                    Parameter      Standard    T for H0:
   Variable  DF      Estimate         Error   Parameter=0    Prob > |T|
   INTERCEP   1    -43.808511    8.73619543        -5.015        0.0153
   X          1      2.765957    0.53544925         5.166        0.0141
            
                 Variable
   Variable  DF     Label
   INTERCEP   1  Intercept
   X          1  covariate-TASA score
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              8
                           Regression of y on x
---------------- degree of shock=2 race of conferderate=2 -----------------
            
            
     |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
   Y |                                                                    |
     |                                                                    |
     |                                                                    |
d 10 +                                                                    +
e    |                                                                    |
p    |                                                               1    |
e    |                                                                    |
n  8 +                                                                    +
d    |                                                                    |
e    |                                                                    |
n    |                                                                    |
t  6 +                                                                    +
     |                                                                    |
s    |                                                   1                |
c    |                                                                    |
o  4 +                                                                    +
r    |                                                                    |
e    |                                                                    |
-    |                                                                    |
c  2 +                                                                    +
h    |                                                                    |
a    |               1                                                    |
n    |                                                                    |
g  0 +                                                                    +
e    |                                                                    |
     |                                                                    |
f    |                                                                    |
r -2 +                                                                    +
o    |                                                                    |
m    |               1                                                    |
     |                                                                    |
p -4 +                                                                    +
r    |                                                                    |
e    |                                                                    |
-    |                                                                    |
p -6 +                                                                    +
o    |                                                                    |
s    |   1                                                                |
t    |                                                                    |
  -8 +                                                                    +
     |                                                                    |
     |                                                                    |
     |---|----|----|----|----|----|----|----|----|----|----|----|----|----|
       14.0  14.5  15.0  15.5  16.0  16.5  17.0  17.5  18.0  18.5  19.0
            
            
                            covariate-TASA score   X
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk              9
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
                          Class Level Information
            
                         Class    Levels    Values
            
                         A             2    1 2
            
                         B             2    1 2
            
                  Number of observations in data set = 20
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             10
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
            
Dependent Variable: Y   dependent score-change from pre-post
                                   Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F
            
Model                    4     1109.38025     277.34506    20.36    0.0001
            
Error                   15      204.36975      13.62465
            
Corrected Total         19     1313.75000
            
                  R-Square           C.V.      Root MSE             Y Mean
            
                  0.844438      -492.1544       3.69116           -0.75000
            
            
Source                  DF      Type I SS   Mean Square  F Value    Pr > F
            
X                        1     1002.53493    1002.53493    73.58    0.0001
A                        1        2.69215       2.69215     0.20    0.6630
B                        1       40.66396      40.66396     2.98    0.1046
A*B                      1       63.48922      63.48922     4.66    0.0475
            
Source                  DF    Type III SS   Mean Square  F Value    Pr > F
            
X                        1     435.630252    435.630252    31.97    0.0001
A                        1      11.129110     11.129110     0.82    0.3804
B                        1      39.229413     39.229413     2.88    0.1104
A*B                      1      63.489216     63.489216     4.66    0.0475
            
            
                                 T for H0:     Pr > |T|    Std Error of
Parameter          Estimate     Parameter=0                  Estimate
            
INTERCEPT      -48.00840336 B         -5.44      0.0001      8.82290727
X                3.02521008            5.65      0.0001      0.53500667
A         1     -2.21008403 B         -0.94      0.3607      2.34428178
          2      0.00000000 B           .         .           .
B         1     -6.76470588 B         -2.76      0.0146      2.45170858
          2      0.00000000 B           .         .           .
A*B       1 1    7.92436975 B          2.16      0.0475      3.67094118
          1 2    0.00000000 B           .         .           .
          2 1    0.00000000 B           .         .           .
          2 2    0.00000000 B           .         .           .
            
NOTE: The X'X matrix has been found to be singular and a generalized
      inverse was used to solve the normal equations.   Estimates followed
      by the letter 'B' are biased, and are not unique estimators of the
      parameters.
            
               2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             11
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
            
 Level of      -------------Y-------------    -------------X-------------
 A          N      Mean            SD             Mean            SD
            
 1         10    3.00000000     6.74948558      17.4000000     1.71269768
 2         10   -4.50000000     8.31664997      15.5000000     1.90029238
            
 Level of      -------------Y-------------    -------------X-------------
 B          N      Mean            SD             Mean            SD
            
 1         10   -2.00000000     10.3279556      16.5000000     2.32139805
 2         10    0.50000000      5.9860950      16.4000000     1.77638835
            
Level of  Level of    ------------Y------------   ------------X------------
A         B         N     Mean          SD            Mean          SD
            
1         1         5   6.00000000   6.32455532     18.2000000   1.64316767
1         2         5   0.00000000   6.32455532     16.6000000   1.51657509
2         1         5 -10.00000000   6.32455532     14.8000000   1.48323970
2         2         5   1.00000000   6.32455532     16.2000000   2.16794834
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             12
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
                            Least Squares Means
                  Coefficients for A Least Square Means
            
A                                            1             2
            
Effect                            Coefficients
            
INTERCEPT                                    1             1
            
X                                        16.45         16.45
            
A         1                                  1             0
          2                                  0             1
            
B         1                                0.5           0.5
          2                                0.5           0.5
            
A*B       1 1                              0.5             0
          1 2                              0.5             0
          2 1                                0           0.5
          2 2                                0           0.5
            
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             13
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
                            Least Squares Means
            
       A             Y       Std Err     Pr > |T|      Pr > |T| H0:
                LSMEAN        LSMEAN   H0:LSMEAN=0   LSMEAN1=LSMEAN2
            
       1    0.12605042    1.27310231        0.9224        0.3804
       2   -1.62605042    1.27310231        0.2209
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             14
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
                            Least Squares Means
                  Coefficients for B Least Square Means
B                                            1             2
            
Effect                            Coefficients
            
INTERCEPT                                    1             1
            
X                                        16.45         16.45
            
A         1                                0.5           0.5
          2                                0.5           0.5
            
B         1                                  1             0
          2                                  0             1
            
A*B       1 1                              0.5             0
          1 2                                0           0.5
          2 1                              0.5             0
          2 2                                0           0.5
            
       B             Y       Std Err     Pr > |T|      Pr > |T| H0:
                LSMEAN        LSMEAN   H0:LSMEAN=0   LSMEAN1=LSMEAN2
            
       1   -2.15126050    1.16755324        0.0853        0.1104
       2    0.65126050    1.16755324        0.5852
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             15
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
                            Least Squares Means
                 Coefficients for A*B Least Square Means
            
            
A                                     1             1             2
B                                     1             2             1
            
Effect                     Coefficients
            
INTERCEPT                             1             1             1
            
X                                 16.45         16.45         16.45
            
A         1                           1             1             0
          2                           0             0             1
            
B         1                           1             0             1
          2                           0             1             0
            
A*B       1 1                         1             0             0
          1 2                         0             1             0
          2 1                         0             0             1
          2 2                         0             0             0
            
A                                     2
B                                     2
            
Effect                     Coefficients
            
INTERCEPT                             1
            
X                                 16.45
            
A         1                           0
          2                           1
            
B         1                           0
          2                           1
            
A*B       1 1                         0
          1 2                         0
          2 1                         0
          2 2                         1
            
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             16
                    ANCOVA analysis through TYPE III SS
            
                      General Linear Models Procedure
                            Least Squares Means
            
          A   B             Y       Std Err     Pr > |T|   LSMEAN
                       LSMEAN        LSMEAN   H0:LSMEAN=0   Number
            
          1   1    0.70588235    1.89776603        0.7151     1
          1   2   -0.45378151    1.65268575        0.7874     2
          2   1   -5.00840336    1.87195005        0.0173     3
          2   2    1.75630252    1.65614597        0.3057     4
            
                     Pr > |T| H0: LSMEAN(i)=LSMEAN(j)
            
                      i/j     1       2       3       4
                      1   .      0.6476  0.0726  0.6883
                      2  0.6476   .      0.0914  0.3607
                      3  0.0726  0.0914   .      0.0146
                      4  0.6883  0.3607  0.0146   .
            
NOTE: To ensure overall protection level, only probabilities associated
      with pre-planned comparisons should be used.
            
            
               2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             17
                      Test of equal slopes: CRFAC-22
            
                      General Linear Models Procedure
                          Class Level Information
            
                         Class    Levels    Values
            
                         A             2    1 2
            
                         B             2    1 2
            
                  Number of observations in data set = 20
            
            
              2-WAY ANCOVA, Q.12 (p.748), Chapter 15 of Kirk             18
                      Test of equal slopes: CRFAC-22
                      General Linear Models Procedure
            
Dependent Variable: Y   dependent score-change from pre-post
            
                                   Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F
Model                    7     1117.84036     159.69148     9.78    0.0004
            
Error                   12      195.90964      16.32580
            
Corrected Total         19     1313.75000
            
                  R-Square           C.V.      Root MSE             Y Mean
            
                  0.850878      -538.7360       4.04052           -0.75000
            
            
Source                  DF      Type I SS   Mean Square  F Value    Pr > F
            
X                        1     1002.53493    1002.53493    61.41    0.0001
A                        1        2.69215       2.69215     0.16    0.6918
B                        1       40.66396      40.66396     2.49    0.1405
A*B                      1       63.48922      63.48922     3.89    0.0721
X*A*B                    3        8.46011       2.82004     0.17    0.9128
            
Source                  DF    Type III SS   Mean Square  F Value    Pr > F
            
X                        1     422.638630    422.638630    25.89    0.0003
A                        1       0.755252      0.755252     0.05    0.8333
B                        1       0.119095      0.119095     0.01    0.9333
A*B                      1      13.332579     13.332579     0.82    0.3839
X*A*B                    3       8.460112      2.820037     0.17    0.9128
            



Comments: peng@indiana.edu
Dr. Peng's Home Page: Dr. Chao-Ying Joanne Peng
Copyright 1999, The Trustees of Indiana University