UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS Textbook Examples
Multilevel Analysis Techniques and Applications by Joop Hox
Chapter 7: Cross-Classified Multilevel Models


Table 7.1 using data set pupcross.sas7bdat.

Part 1: Intercept only.

proc mixed data =pupcross covtest noclprint method=ml; 
   class pupil pschool sschool; 
   model achiev =   / solution ddfm =satterth; 
   random intercept / subject=sschool; 
   random intercept / subject=pschool; 
run; 
The Mixed Procedure
                  Model Information
Data Set                     WORK.PUPCROSS
Dependent Variable           ACHIEV
Covariance Structure         Variance Components
Subject Effects              SSCHOOL, PSCHOOL
Estimation Method            ML
Residual Variance Method     Profile
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Satterthwaite
            Dimensions
Covariance Parameters             3
Columns in X                      1
Columns in Z Per Subject         80
Subjects                          1
Max Obs Per Subject            1000
                   Convergence criteria met.
                  Covariance Parameter Estimates
                                     Standard         Z
Cov Parm      Subject    Estimate       Error     Value        Pr Z
Intercept     SSCHOOL     0.06540     0.02131      3.07      0.0011
Intercept     PSCHOOL      0.1693     0.03931      4.31      <.0001
Residual                   0.5132     0.02390     21.47      <.0001
           Fit Statistics
-2 Log Likelihood              2317.8
AIC (smaller is better)        2325.8
AICC (smaller is better)       2325.9
BIC (smaller is better)        2317.8

                   Solution for Fixed Effects
                         Standard
Effect       Estimate       Error      DF    t Value    Pr > |t|
Intercept      6.3487     0.07831    66.7      81.07      <.0001


Part 2: intercept plus pupil level variables.

proc mixed data =pupcross covtest noclprint method=ml; 
   class pupil pschool sschool; 
   model achiev = pupsex pupses  / solution ddfm =satterth; 
   random intercept / subject=sschool; 
   random intercept / subject=pschool; 
run; 
The Mixed Procedure

                  Model Information

Data Set                     WORK.PUPCROSS
Dependent Variable           ACHIEV
Covariance Structure         Variance Components
Subject Effects              SSCHOOL, PSCHOOL
Estimation Method            ML
Residual Variance Method     Profile
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Satterthwaite

            Dimensions

Covariance Parameters             3
Columns in X                      3
Columns in Z Per Subject         80
Subjects                          1
Max Obs Per Subject            1000

                   Convergence criteria met.


                  Covariance Parameter Estimates

                                     Standard         Z
Cov Parm      Subject    Estimate       Error     Value        Pr Z

Intercept     SSCHOOL     0.06361     0.02059      3.09      0.0010
Intercept     PSCHOOL      0.1690     0.03878      4.36      <.0001
Residual                   0.4743     0.02209     21.47      <.0001


           Fit Statistics

-2 Log Likelihood              2243.5
AIC (smaller is better)        2255.5
AICC (smaller is better)       2255.6
BIC (smaller is better)        2243.5

                   Solution for Fixed Effects

                         Standard
Effect       Estimate       Error      DF    t Value    Pr > |t|

Intercept      5.7555      0.1053     214      54.67      <.0001
PUPSEX         0.2613     0.04564     949       5.73      <.0001
PUPSES         0.1141     0.01610     943       7.09      <.0001


        Type 3 Tests of Fixed Effects

              Num     Den
Effect         DF      DF    F Value    Pr > F

PUPSEX          1     949      32.79    <.0001
PUPSES          1     943      50.21    <.0001


Part 3:  primary by secondary School crossed with pupil and school variables.

proc mixed data =pupcross covtest noclprint method=ml; 
   class pupil pschool sschool; 
   model achiev = pupsex pupses  pdenom sdenom/ solution ddfm =satterth; 
   random intercept / subject=sschool; 
   random intercept / subject=pschool; 
run; 
The Mixed Procedure
                  Model Information
Data Set                     WORK.PUPCROSS
Dependent Variable           ACHIEV
Covariance Structure         Variance Components
Subject Effects              SSCHOOL, PSCHOOL
Estimation Method            ML
Residual Variance Method     Profile
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Satterthwaite
            Dimensions
Covariance Parameters             3
Columns in X                      5
Columns in Z Per Subject         80
Subjects                          1
Max Obs Per Subject            1000

                  Covariance Parameter Estimates
                                     Standard         Z
Cov Parm      Subject    Estimate       Error     Value        Pr Z
Intercept     SSCHOOL     0.05542     0.01852      2.99      0.0014
Intercept     PSCHOOL      0.1594     0.03686      4.33      <.0001
Residual                   0.4741     0.02208     21.47      <.0001
           Fit Statistics
-2 Log Likelihood              2237.5
AIC (smaller is better)        2253.5
AICC (smaller is better)       2253.6
BIC (smaller is better)        2237.5

                   Solution for Fixed Effects
                         Standard
Effect       Estimate       Error      DF    t Value    Pr > |t|
Intercept      5.5185      0.1408     145      39.20      <.0001
PUPSEX         0.2631     0.04561     950       5.77      <.0001
PUPSES         0.1136     0.01609     945       7.06      <.0001
PDENOM         0.2041      0.1241    50.2       1.64      0.1063
SDENOM         0.1762     0.09466    48.1       1.86      0.0689
        Type 3 Tests of Fixed Effects
              Num     Den
Effect         DF      DF    F Value    Pr > F
PUPSEX          1     950      33.27    <.0001
PUPSES          1     945      49.79    <.0001
PDENOM          1    50.2       2.71    0.1063
SDENOM          1    48.1       3.46    0.0689

Part 4:  primary by secondary School crossed with pupil and school variables with variable pupses being modeled as a random effect.

proc mixed data =pupcross covtest noclprint method=ml; 
   class pupil pschool sschool; 
   model achiev = pupsex pupses  pdenom sdenom/ solution ddfm =satterth; 
   random intercept / subject=sschool; 
   random intercept pupses / subject=pschool type=un; 
run; 
The Mixed Procedure

                  Model Information

Data Set                     WORK.PUPCROSS
Dependent Variable           ACHIEV
Covariance Structures        Variance Components,
                             Unstructured
Subject Effects              SSCHOOL, PSCHOOL
Estimation Method            ML
Residual Variance Method     Profile
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Satterthwaite


            Dimensions

Covariance Parameters             5
Columns in X                      5
Columns in Z Per Subject        130
Subjects                          1
Max Obs Per Subject            1000


          Number of Observations

Number of Observations Read            1000
Number of Observations Used            1000
Number of Observations Not Used           0


                     Iteration History

Iteration    Evaluations        -2 Log Like       Criterion

        0              1      2474.36462150
        1              3      2224.66280358      0.00088577
        2              1      2224.47834515      0.00001539
        3              1      2224.47532928      0.00000001


                   Convergence criteria met.


                  Covariance Parameter Estimates

                                     Standard         Z
Cov Parm      Subject    Estimate       Error     Value        Pr Z

Intercept     SSCHOOL     0.05373     0.01801      2.98      0.0014
UN(1,1)       PSCHOOL      0.1486     0.07521      1.98      0.0241
UN(2,1)       PSCHOOL    -0.01560     0.01500     -1.04      0.2983
UN(2,2)       PSCHOOL    0.008014    0.003882      2.06      0.0195
Residual                   0.4584     0.02185     20.98      <.0001


           Fit Statistics

-2 Log Likelihood              2224.5
AIC (smaller is better)        2244.5
AICC (smaller is better)       2244.7
BIC (smaller is better)        2224.5

                   Solution for Fixed Effects

                         Standard
Effect       Estimate       Error      DF    t Value    Pr > |t|

Intercept      5.5324      0.1375     104      40.25      <.0001
PUPSEX         0.2532     0.04530     949       5.59      <.0001
PUPSES         0.1142     0.02047    54.3       5.58      <.0001
PDENOM         0.1999      0.1176    49.2       1.70      0.0956
SDENOM         0.1646     0.09344    47.7       1.76      0.0846


        Type 3 Tests of Fixed Effects

              Num     Den
Effect         DF      DF    F Value    Pr > F

PUPSEX          1     949      31.23    <.0001
PUPSES          1    54.3      31.15    <.0001
PDENOM          1    49.2       2.89    0.0956
SDENOM          1    47.7       3.10    0.0846

Table 7.2 using data set socsflat.sas7bdat. We will skip this example for the time being.


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California