SPSS Paper Examples
Using SAS Proc Mixed to Fit Multilevel Models, Hierarchical Models, and Individual Growth Models
by Judith Singer

This paper can be downloaded from Professor Singer's web site at http://gseweb.harvard.edu/%7Efaculty/singer/Papers/sasprocmixed.pdf . The SPSS data files used are hsb12.sav and willett.sav .  

Note on comparing the SPSS and SAS results.  SPSS reports results for fit statistics (e.g. AIC) in "smaller is better" form, which is -2 times the results shown in the SAS output of the article.  Since the printing of the article, SAS has started showing its fit statistics in "smaller is better" form as well.


This first set of examples use the hsb12.sav data file.

Example on page 329.

mixed mathach
  /print=solution
  /random intercept | subject(school) .

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page page 331 .

mixed mathach with meanses
  /print=solution
  /fixed = meanses
  /random intercept | subject(school) .

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page 335 .

mixed mathach with cses
  /print=solution
  /fixed = cses
  /random intercept cses | subject(school) covtype(un).

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page 337 .

mixed mathach with meanses sector cses
  /print=solution
  /fixed = meanses sector cses meanses*cses sector*cses
  /random intercept cses | subject(school) covtype(un).

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page 339.  We can match the SAS results to SPSS results for -2 Log Liklihood, AIC and SBC (labeled in SPSS as bic).

mixed mathach with meanses sector cses
  /print=solution
  /fixed = meanses sector cses meanses*cses sector*cses
  /random intercept | subject(school) .

Mixed Model Analysis

Fixed Effects

Covariance Parameters

 

The next set of examples use the willett.sav data. 

Example on pages 341/342 .

mixed y with time
  /print=solution
  /fixed = time
  /random intercept time | subject(id) covtype(un).

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page 344 . The correlation of the fixed effects are slightly different from SAS.

mixed y with time ccovar
  /print=solution corb
  /fixed = time ccovar time*ccovar
  /random intercept time | subject(id) covtype(un).

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page 346 , compound symmetry results.

compute wave = time .
mixed y with time
  /print=solution
  /fixed = time
  /repeated = wave | subject(id) covtype(cs).

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page page 346 , results using ar1 covariance structure . Note the AIC from SAS does not match that from SPSS. (Remember, SPSS is showing "smaller is better" form, so the SAS results are multiplied by -2 for comparison to SPSS).

mixed y with time
  /print=solution
  /fixed = time
  /repeated = wave | subject(id) covtype(ar1).

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page 346 , unstructured covariance .

mixed y with time
  /print=solution
  /fixed = time
  /repeated = wave | subject(id) covtype(un).

Mixed Model Analysis

Fixed Effects

Covariance Parameters


Example on page 348 .

mixed y with time ccovar
  /print=solution
  /fixed = time ccovar time*ccovar
  /random intercept time | subject(id) covtype(un)
  /repeated = wave | subject(id) covtype(ar1).

Mixed Model Analysis

Fixed Effects

Covariance Parameters

How to cite this page

Report an error on this page or leave a comment

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.