UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Code Fragment: 
Computing Intraclass Correlation

* This is based on the example from Winer Page 288
. lis

           j1        j2        j3        j4       pid
  1.        2         4         3         3         1
  2.        5         7         5         6         2
  3.        1         3         1         2         3
  4.        7         9         9         8         4
  5.        2         4         6         1         5
  6.        6         8         8         4         6

reshape long j, i(pid) j(judge)
(note: j = 1 2 3 4)

Data                               wide   ->   long
-----------------------------------------------------------------------------
Number of obs.                        6   ->      24
Number of variables                   5   ->       3
j variable (4 values)                     ->   judge
xij variables:
                           j1 j2 ... j4   ->   j
-----------------------------------------------------------------------------

lis

          pid      judge         j
  1.        1          1         2
  2.        1          2         4
  3.        1          3         3
  4.        1          4         3
  5.        2          1         5
  6.        2          2         7
  7.        2          3         5
  8.        2          4         6
  9.        3          1         1
 10.        3          2         3
 11.        3          3         1
 12.        3          4         2
 13.        4          1         7
 14.        4          2         9
 15.        4          3         9
 16.        4          4         8
 17.        5          1         2
 18.        5          2         4
 19.        5          3         6
 20.        5          4         1
 21.        6          1         6
 22.        6          2         8
 23.        6          3         8
 24.        6          4         4

anova j pid judge

                           Number of obs =      24     R-squared     =  0.8833
                           Root MSE      = 1.11056     Adj R-squared =  0.8210

                  Source |  Partial SS    df       MS           F     Prob > F
              -----------+----------------------------------------------------
                   Model |      140.00     8       17.50      14.19     0.0000
                         |
                     pid |      122.50     5       24.50      19.86     0.0000
                   judge |       17.50     3  5.83333333       4.73     0.0162
                         |
                Residual |       18.50    15  1.23333333   
              -----------+----------------------------------------------------
                   Total |      158.50    23  6.89130435   

* You can then take the output from above and use the
* formulas on page 288 and 289 for computing the intraclass correlation.

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.