Nested Designs

PVPS Example

Program Listing

DATA PVPS(DROP=s cl rep);
 DO school = 1, 2;
  s = (school - 1) * 3;
  DO cl = 1 TO 3;
   classes = s + cl;
   DO rep = 1 TO 4;
    INPUT score @@;
	OUTPUT;
   END;
  END;
 END;
DATALINES;
12 13 11 12 15 19 17 17 10 12 11 17
18 20 21 16 20 14 17 15 19 22 21 21
;

OPTIONS LS=76 NODATE NOCENTER NONUMBER;

TITLE1 'Nested Designs: PVPS Example';
TITLE2 'Random Effect Model';
TITLE3 'Using PROC GLM';
PROC GLM DATA=PVPS;
 CLASS school classes;
 TITLE4 'Model Statement Output';
 MODEL score = school classes(school);
 FOOTNOTE 'Note: Inappropriate for Random-Effect Model';
 RUN;
 FOOTNOTE;
 TITLE4 'RANDOM Statement Output';
 RANDOM school classes(school) / TEST;
 RUN;
QUIT;

TITLE3 'Using PROC VARCOMP';
PROC VARCOMP DATA=PVPS;
 CLASS school classes;
 MODEL score = school classes(school);
RUN;

TITLE3 'Using PROC MIXED';
PROC MIXED DATA=PVPS;
 CLASS school classes;
 MODEL score =;
 RANDOM school classes(school);
RUN;

TITLE2 'Fixed Effect Model';

TITLE3 'Homogeneity of Variance Test';
PROC GLM DATA=PVPS;
 CLASS classes;
 MODEL score = classes;
 MEANS classes / HOVTEST=BF;
RUN;
QUIT;

TITLE3 'Nested Fixed Effect Model';
PROC GLM DATA=PVPS;
 CLASS school classes;
 TITLE3 'ANOVA Table';
 MODEL score = school classes(school);
 RUN;
 TITLE3 'Least Square Means';
 LSMEANS school / PDIFF;
 LSMEANS classes(school) / ADJUST=Tukey PDIFF;
 RUN;
QUIT;

TITLE2 'Mixed Effect Model';
PROC GLM DATA=PVPS;
 CLASS school classes;
 TITLE3 'Fixed-effect model ANOVA Table';
 FOOTNOTE 'Note: Inappropriate for Mixed-Effect Model';
 MODEL score = school classes(school);
 RUN;
 FOOTNOTE;
 TITLE3 'Correct ANOVA Table';
 RANDOM classes(school) / TEST;
 RUN;
QUIT;

Output Listing

Nested Designs: PVPS Example
Random Effect Model
Using PROC GLM
Model Statement Output

The GLM Procedure

      Class Level Information

Class         Levels    Values
school             2    1 2
classes            6    1 2 3 4 5 6

Number of Observations Read          24
Number of Observations Used          24
Nested Designs: PVPS Example


Dependent Variable: score
                              Sum of
Source              DF       Squares   Mean Square  F Value  Pr > F
Model                5   237.0000000    47.4000000    10.73  <.0001
Error               18    79.5000000     4.4166667
Corrected Total     23   316.5000000


R-Square     Coeff Var      Root MSE    score Mean
0.748815      12.93284      2.101587      16.25000


Source              DF     Type I SS   Mean Square  F Value  Pr > F
school               1   140.1666667   140.1666667    31.74  <.0001
classes(school)      4    96.8333333    24.2083333     5.48  0.0046


Source              DF   Type III SS   Mean Square  F Value  Pr > F
school               1   140.1666667   140.1666667    31.74  <.0001
classes(school)      4    96.8333333    24.2083333     5.48  0.0046


Note: Inappropriate for Random-Effect Model



Nested Designs: PVPS Example
Random Effect Model
Using PROC GLM
RANDOM Statement Output

The GLM Procedure

Source           Type III Expected Mean Square
school           Var(Error) + 4 Var(classes(school)) + 12 Var(school)
classes(school)  Var(Error) + 4 Var(classes(school))


Tests of Hypotheses for Random Model Analysis of Variance

Dependent Variable: score

Source            DF   Type III SS   Mean Square  F Value  Pr > F
school             1    140.166667    140.166667     5.79  0.0739
Error              4     96.833333     24.208333
Error: MS(classes(school))


Source            DF   Type III SS   Mean Square  F Value  Pr > F
classes(school)    4     96.833333     24.208333     5.48  0.0046
Error: MS(Error)  18     79.500000      4.416667



Nested Designs: PVPS Example
Random Effect Model
Using PROC VARCOMP

Variance Components Estimation Procedure

      Class Level Information

Class         Levels    Values
school             2    1 2
classes            6    1 2 3 4 5 6


Number of Observations Read          24
Number of Observations Used          24


                    MIVQUE(0) SSQ Matrix

Source                          school        classes(school)
school                       144.00000               48.00000
classes(school)               48.00000               80.00000
Error                         12.00000               20.00000

                    MIVQUE(0) SSQ Matrix

Source                           Error                  score
school                        12.00000                 1682.0
classes(school)               20.00000              948.00000
Error                         23.00000              316.50000


       MIVQUE(0) Estimates

Variance Component           score
Var(school)                9.66319
Var(classes(school))       4.94792
Var(Error)                 4.41667



Nested Designs: PVPS Example
Random Effect Model
Using PROC MIXED

The Mixed Procedure

                  Model Information

Data Set                     WORK.PVPS
Dependent Variable           score
Covariance Structure         Variance Components
Estimation Method            REML
Residual Variance Method     Profile
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Containment


              Class Level Information

Class      Levels    Values
school          2    1 2
classes         6    1 2 3 4 5 6


            Dimensions

Covariance Parameters             3
Columns in X                      1
Columns in Z                      8
Subjects                          1
Max Obs Per Subject              24


          Number of Observations

Number of Observations Read              24
Number of Observations Used              24
Number of Observations Not Used           0


                     Iteration History

Iteration    Evaluations    -2 Res Log Like       Criterion
        0              1       128.75129395
        1              1       112.87578100      0.00000000


                   Convergence criteria met.


    Covariance Parameter
         Estimates

Cov Parm            Estimate
school                9.6632
classes(school)       4.9479
Residual              4.4167


           Fit Statistics

-2 Res Log Likelihood           112.9
AIC (smaller is better)         118.9
AICC (smaller is better)        120.1
BIC (smaller is better)         115.0



Nested Designs: PVPS Example
Fixed Effect Model
Homogeneity of Variance Test

The GLM Procedure

      Class Level Information

Class         Levels    Values
classes            6    1 2 3 4 5 6


Number of Observations Read          24
Number of Observations Used          24


Dependent Variable: score

                            Sum of
Source            DF       Squares   Mean Square  F Value  Pr > F
Model              5   237.0000000    47.4000000    10.73  <.0001
Error             18    79.5000000     4.4166667
Corrected Total   23   316.5000000


R-Square     Coeff Var      Root MSE    score Mean
0.748815      12.93284      2.101587      16.25000


Source            DF     Type I SS   Mean Square  F Value  Pr > F
classes            5   237.0000000    47.4000000    10.73  <.0001


Source            DF   Type III SS   Mean Square  F Value  Pr > F
classes            5   237.0000000    47.4000000    10.73  <.0001


 Brown and Forsythe's Test for Homogeneity of score Variance
       ANOVA of Absolute Deviations from Group Medians

                       Sum of        Mean
Source         DF     Squares      Square    F Value    Pr > F
classes         5      8.8333      1.7667       0.95    0.4737
Error          18     33.5000      1.8611


Level of           ------------score------------
classes      N             Mean          Std Dev

1            4       12.0000000       0.81649658
2            4       17.0000000       1.63299316
3            4       12.5000000       3.10912635
4            4       18.7500000       2.21735578
5            4       16.5000000       2.64575131
6            4       20.7500000       1.25830574




Nested Designs: PVPS Example
Fixed Effect Model
ANOVA Table

The GLM Procedure

      Class Level Information

Class         Levels    Values
school             2    1 2
classes            6    1 2 3 4 5 6


Number of Observations Read          24
Number of Observations Used          24


Dependent Variable: score
                            Sum of
Source            DF       Squares   Mean Square  F Value  Pr > F
Model              5   237.0000000    47.4000000    10.73  <.0001
Error             18    79.5000000     4.4166667
Corrected Total   23   316.5000000


R-Square     Coeff Var      Root MSE    score Mean
0.748815      12.93284      2.101587      16.25000


Source            DF     Type I SS   Mean Square  F Value  Pr > F
school             1   140.1666667   140.1666667    31.74  <.0001
classes(school)    4    96.8333333    24.2083333     5.48  0.0046


Source            DF   Type III SS   Mean Square  F Value  Pr > F
school             1   140.1666667   140.1666667    31.74  <.0001
classes(school)    4    96.8333333    24.2083333     5.48  0.0046



Nested Designs: PVPS Example
Fixed Effect Model
Least Square Means

The GLM Procedure
Least Squares Means

                          H0:LSMean1=
                            LSMean2
school    score LSMEAN       Pr > |t|

1           13.8333333         <.0001
2           18.6666667


Adjustment for Multiple Comparisons: Tukey

                                       LSMEAN
classes    school    score LSMEAN      Number
1          1           12.0000000           1
2          1           17.0000000           2
3          1           12.5000000           3
4          2           18.7500000           4
5          2           16.5000000           5
6          2           20.7500000           6


               Least Squares Means for effect classes(school)
                    Pr > |t| for H0: LSMean(i)=LSMean(j)

                   Dependent Variable: score
i/j          1         2         3         4         5         6
   1              0.0344    0.9993    0.0029    0.0670    0.0002
   2    0.0344              0.0670    0.8416    0.9993    0.1689
   3    0.9993    0.0670              0.0060    0.1257    0.0004
   4    0.0029    0.8416    0.0060              0.6602    0.7567
   5    0.0670    0.9993    0.1257    0.6602              0.0923
   6    0.0002    0.1689    0.0004    0.7567    0.0923



Nested Designs: PVPS Example
Mixed Effect Model
Fixed-effect model ANOVA Table

The GLM Procedure

      Class Level Information

Class         Levels    Values
school             2    1 2
classes            6    1 2 3 4 5 6


Number of Observations Read          24
Number of Observations Used          24


Dependent Variable: score
                            Sum of
Source            DF       Squares   Mean Square  F Value  Pr > F
Model              5   237.0000000    47.4000000    10.73  <.0001
Error             18    79.5000000     4.4166667
Corrected Total   23   316.5000000


R-Square     Coeff Var      Root MSE    score Mean
0.748815      12.93284      2.101587      16.25000


Source            DF     Type I SS   Mean Square  F Value  Pr > F
school             1   140.1666667   140.1666667    31.74  <.0001
classes(school)    4    96.8333333    24.2083333     5.48  0.0046


Source            DF   Type III SS   Mean Square  F Value  Pr > F
school             1   140.1666667   140.1666667    31.74  <.0001
classes(school)    4    96.8333333    24.2083333     5.48  0.0046


Note: Inappropriate for Mixed-Effect Model



Nested Designs: PVPS Example
Mixed Effect Model
Correct ANOVA Table

The GLM Procedure

Source            Type III Expected Mean Square
school            Var(Error) + 4 Var(classes(school)) + Q(school)
classes(school)   Var(Error) + 4 Var(classes(school))


Tests of Hypotheses for Mixed Model Analysis of Variance

Dependent Variable: score

Source            DF   Type III SS   Mean Square  F Value  Pr > F
school             1    140.166667    140.166667     5.79  0.0739
Error              4     96.833333     24.208333
Error: MS(classes(school))


Source            DF   Type III SS   Mean Square  F Value  Pr > F
classes(school)    4     96.833333     24.208333     5.48  0.0046
Error: MS(Error)  18     79.500000      4.416667