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 10

OPTIONS LS=80 NODATE PAGENO=1;
TITLE 'Example 11, Y603, Repeated-Measure ANOVA';
            
*------------------------Repeated Measure Design --------------------------*
*   THIS PROBLEM IS TAKEN FROM UNIT 8 OF STATISTICAL DESIGN                *
*   IN EDUCATIONAL RESEARCH BY C.Y. PENG.  THE NATURE OF THIS              *
*   PROBLEM IS REPEATED MEASURE. PROC CORR is first used to compute        *
*   the variance-covariance matrix.  Then PROC GLM and the REPEATED        *
*   statements are used to carry out univariate/multivariate analyses of   *
*   variance of (1) the linear trend, (2) the quadratic trend, and         *
*   (3) the cubic trend of the repeated scores.                            *   
*   In addition, the assumption of sphericity is tested and p-level adjusted
*--------------------------------------------------------------------------*;
DATA ex11;
     INPUT a s b1 b2 b3 b4;
           y1=(-3)*b1+(-1)*b2+b3+(3)*b4;
           y2=b1+(-1)*b2+(-1)*b3+b4;
           y3=(-1)*b1+3*b2+(-3)*b3+b4;
     LABEL a='Sportiness'
           s='Subject id'
           b1='First hour response'
           b2='Second hour response'
           b3='Third hour response'
           b4='Fourth hour response'
           y1='The linear trend on repeated scores'
           y2='The quadratic trend on repeated scores'
           y3='The cubic trend on  repeated scores';
CARDS;
1 1 3 4 7 7
1 2 6 5 8 8
1 3 3 4 7 9
1 4 3 3 6 8
2 5 1 2 5 10
2 6 2 3 6 10
2 7 2 4 5 9
2 8 2 3 6 11
;
PROC PRINT;
PROC CORR COV NOSIMPLE;
     VAR b1 b2 b3 b4;
TITLE2 'the variance-covariance matrix';
RUN;
            
PROC GLM;
     CLASS a;
     MODEL b1-b4=a;
     REPEATED hour POLYNOMIAL/SUMMARY PRINTM;
TITLE2 'Univariate/multivariate analyses of the repeated design and its assumption';
RUN;
                     Example 11, Y603, Repeated-Measure ANOVA                   1
            
            OBS    A    S    B1    B2    B3    B4    Y1    Y2    Y3
            
             1     1    1     3     4     7     7    15    -1    -5
             2     1    2     6     5     8     8     9     1    -7
             3     1    3     3     4     7     9    21     1    -3
             4     1    4     3     3     6     8    18     2    -4
             5     2    5     1     2     5    10    30     4     0
             6     2    6     2     3     6    10    27     3    -1
             7     2    7     2     4     5     9    22     2     4
             8     2    8     2     3     6    11    30     4     0
            
            
                    Example 11, Y603, Repeated-Measure ANOVA                   2
                          the variance-covariance matrix
            
                              Correlation Analysis
            
              4 'VAR' Variables:  B1       B2       B3       B4
            
                          Covariance Matrix     DF = 7
            
              B1            B2            B3            B4
            
B1   2.214285714   1.142857143   1.357142857  -1.142857143  First hour response
B2   1.142857143   0.857142857   0.714285714  -0.714285714  Second hour response
B3   1.357142857   0.714285714   1.071428571  -0.714285714  Third hour response
B4  -1.142857143  -0.714285714  -0.714285714   1.714285714  Fourth hour response
            
            
    Pearson Correlation Coefficients / Prob > |R| under Ho: Rho=0 / N = 8
            
                                 B1             B2             B3             B4
B1                          1.00000        0.82956        0.88110       -0.58659
First hour response          0.0            0.0108         0.0038         0.1264
            
B2                          0.82956        1.00000        0.74536       -0.58926
Second hour response         0.0108         0.0            0.0338         0.1243
            
B3                          0.88110        0.74536        1.00000       -0.52705
Third hour response          0.0038         0.0338         0.0            0.1795
            
B4                         -0.58659       -0.58926       -0.52705        1.00000
Fourth hour response         0.1264         0.1243         0.1795         0.0
            
            
            
                    Example 11, Y603, Repeated-Measure ANOVA                   3
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
                            Class Level Information
            
                           Class    Levels    Values
            
                           A             2    1 2
            
            
                     Number of observations in data set = 8
            
                     Example 11, Y603, Repeated-Measure ANOVA                   4
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
            
Dependent Variable: B1   First hour response
                                     Sum of            Mean
Source                  DF          Squares          Square   F Value     Pr > F
            
Model                    1       8.00000000      8.00000000      6.40     0.0447
            
Error                    6       7.50000000      1.25000000
            
Corrected Total          7      15.50000000
            
                  R-Square             C.V.        Root MSE              B1 Mean
            
                  0.516129         40.65578       1.1180340            2.7500000
            
            
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
            
A                        1       8.00000000      8.00000000      6.40     0.0447
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
A                        1       8.00000000      8.00000000      6.40     0.0447
            
            
            
            
                    Example 11, Y603, Repeated-Measure ANOVA                   5
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
            
Dependent Variable: B2   Second hour response
                                     Sum of            Mean
Source                  DF          Squares          Square   F Value     Pr > F
            
Model                    1       2.00000000      2.00000000      3.00     0.1340
            
Error                    6       4.00000000      0.66666667
            
Corrected Total          7       6.00000000
            
                  R-Square             C.V.        Root MSE              B2 Mean
            
                  0.333333         23.32847       0.8164966            3.5000000
            
            
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
            
A                        1       2.00000000      2.00000000      3.00     0.1340
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
A                        1       2.00000000      2.00000000      3.00     0.1340
                     Example 11, Y603, Repeated-Measure ANOVA                   6
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
            
Dependent Variable: B3   Third hour response
                                     Sum of            Mean
Source                  DF          Squares          Square   F Value     Pr > F
            
Model                    1       4.50000000      4.50000000      9.00     0.0240
            
Error                    6       3.00000000      0.50000000
            
Corrected Total          7       7.50000000
            
                  R-Square             C.V.        Root MSE              B3 Mean
            
                  0.600000         11.31371       0.7071068            6.2500000
            
            
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
            
A                        1       4.50000000      4.50000000      9.00     0.0240
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
A                        1       4.50000000      4.50000000      9.00     0.0240
            
            
            
                    Example 11, Y603, Repeated-Measure ANOVA                   7
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
            
Dependent Variable: B4   Fourth hour response
                                     Sum of            Mean
Source                  DF          Squares          Square   F Value     Pr > F
            
Model                    1       8.00000000      8.00000000     12.00     0.0134
            
Error                    6       4.00000000      0.66666667
            
Corrected Total          7      12.00000000
            
                  R-Square             C.V.        Root MSE              B4 Mean
            
                  0.666667         9.072184       0.8164966            9.0000000
            
            
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
            
A                        1       8.00000000      8.00000000     12.00     0.0134
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
A                        1       8.00000000      8.00000000     12.00     0.0134
            
            
            
                     Example 11, Y603, Repeated-Measure ANOVA                   8
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
                     Repeated Measures Analysis of Variance
                      Repeated Measures Level Information
            
            Dependent Variable         B1       B2       B3       B4
            
                 Level of HOUR          1        2        3        4
            
            
         HOUR.N represents the nth degree polynomial contrast for HOUR
            
            
                   M Matrix Describing Transformed Variables
            
                       B1                B2                B3                B4
            
 HOUR.1      -.6708203932      -.2236067977      0.2236067977      0.6708203932
 HOUR.2      0.5000000000      -.5000000000      -.5000000000      0.5000000000
 HOUR.3      -.2236067977      0.6708203932      -.6708203932      0.2236067977
            
            
Manova Test Criteria and Exact F Statistics for the Hypothesis of no HOUR Effect
          H = Type III SS&CP Matrix for HOUR   E = Error SS&CP Matrix
            
                              S=1    M=0.5    N=1
            
  Statistic                     Value          F      Num DF    Den DF  Pr > F
            
  Wilks' Lambda              0.02747678    47.1925         3         4  0.0014
  Pillai's Trace             0.97252322    47.1925         3         4  0.0014
  Hotelling-Lawley Trace    35.39436620    47.1925         3         4  0.0014
  Roy's Greatest Root       35.39436620    47.1925         3         4  0.0014
            
 
               Manova Test Criteria and Exact F Statistics for
                       the Hypothesis of no HOUR*A Effect
         H = Type III SS&CP Matrix for HOUR*A   E = Error SS&CP Matrix
            
                              S=1    M=0.5    N=1
            
  Statistic                     Value          F      Num DF    Den DF  Pr > F
            
  Wilks' Lambda              0.14430894     7.9061         3         4  0.0371
  Pillai's Trace             0.85569106     7.9061         3         4  0.0371
  Hotelling-Lawley Trace     5.92957746     7.9061         3         4  0.0371
  Roy's Greatest Root        5.92957746     7.9061         3         4  0.0371
            
            
            
                    Example 11, Y603, Repeated-Measure ANOVA                   9
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
                     Repeated Measures Analysis of Variance
                Tests of Hypotheses for Between Subjects Effects
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
A                        1       3.12500000      3.12500000      2.00     0.2070
            
Error                    6       9.37500000      1.56250000
                     Example 11, Y603, Repeated-Measure ANOVA                  10
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
                     Repeated Measures Analysis of Variance
           Univariate Tests of Hypotheses for Within Subject Effects
            
Source: HOUR
                                                                   Adj  Pr > F
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F
      3      194.50000000       64.83333333    127.89   0.0001   0.0001   0.0001
            
Source: HOUR*A
                                                                   Adj  Pr > F
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F
      3       19.37500000        6.45833333     12.74   0.0001   0.0019   0.0002
            
Source: Error(HOUR)
            
     DF       Type III SS       Mean Square
     18        9.12500000        0.50694444
            
                      Greenhouse-Geisser Epsilon = 0.5841
                             Huynh-Feldt Epsilon = 0.9432
            
            
                    Example 11, Y603, Repeated-Measure ANOVA                  11
   Univariate/multivariate analyses of the repeated design and its assumption
            
                        General Linear Models Procedure
                     Repeated Measures Analysis of Variance
                   Analysis of Variance of Contrast Variables
            
         HOUR.N represents the nth degree polynomial contrast for HOUR
            
Contrast Variable: HOUR.1
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
MEAN                     1     184.90000000    184.90000000    182.62     0.0001
A                        1      13.22500000     13.22500000     13.06     0.0112
            
Error                    6       6.07500000      1.01250000
            
Contrast Variable: HOUR.2
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
MEAN                     1       8.00000000      8.00000000     25.60     0.0023
A                        1       3.12500000      3.12500000     10.00     0.0195
            
Error                    6       1.87500000      0.31250000
            
Contrast Variable: HOUR.3
            
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
            
MEAN                     1       1.60000000      1.60000000      8.17     0.0289
A                        1       3.02500000      3.02500000     15.45     0.0077
            
Error                    6       1.17500000      0.19583333
            



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