UCLA Academic Technology Services HomeServicesClassesContactJobs
Help the Stat Consulting Group by giving a gift             
Loading

SAS Code Fragment
Computing Intraclass Correlation

* This is based on the example from Winer Page 288 - 289.
data test;
 input score1 score2 score3 score4 pid;
cards;
2 4 3 3 1
5 7 5 6 2
1 3 1 2 3
7 9 9 8 4
2 4 6 1 5
6 8 8 4 6
;
run;
data test_long;
  set test;
  array s(4) score:;
  do judge = 1 to 4;
     y = s(judge);
     output;
   end;
run;
ods output CovParms = covp;
proc mixed data = test_long;
   class judge pid;
   model y = ;
   random intercept /subject=pid;
run;

data icc;
  set covp end=last;
  retain bvar;
  if subject~="" then bvar = estimate;
  if last then icc = bvar/(bvar+estimate);
run;
proc print data = icc;
run;
     Obs     CovParm     Subject    Estimate     bvar      icc

      1     Intercept      pid        5.6250    5.625     .
      2     Residual                  2.0000    5.625    0.73770

Reference

J. B. Winer Statistical Principles in Experimental Design, Second Edition, 1971


How to cite this page

Report an error on this page or leave a comment

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