[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Intraclass correlations for 2-way ANOVA?
On Tue, Rena Jenkins asked:
> I would like to calculate an intraclass correlation coefficient, to
> measure agreement between raters. I know that you can use the
> command "loneway" along these lines:
> loneway measurement rater
> ...but I have measurements by the same group of raters on several
> different objects (the objects being indentified by the variable "ID").
> I want to use the two-way model:
> anova measurement id rater
> How would I calculate an ICC from the sums of squares given in the
> resulting ANOVA?
Instead of going to the two random factor case right away, let's make
sure we know how to compute the intraclass correlation for one random
The formulas for this can be found in Kuehl's book on "Design of
Experiments" (page 155). The example I am using here is from the manual
[R] loneway (page 339, version 8). The approach is to first count the
number of repetitions for each level of factor A, then compute the
variance components, and lastly compute ICC.
*----one random factor--------------*
keep if nummake==4
loneway `depvar' `A'
drop sum tag
anova `depvar' `A'
You may notice I am assuming a balanced design. If the design is not
balanced, then there are slightly more complicated formulas for the
variance components (also given in Kuehl).
OK, now for two random factors. For these formulas I must turn to the
comprehensive experimental design text by Winer et. al. "Statistical
Principles of Experimental Design" (page 413). The formula is what you
would expect it to be: ICC=variance of A/(total variance). So again, we
count the number of repetitions, and this time the number of levels of
each factor, compute the variance components, and then ICC.
This time I am going to generate my own balanced dataset. Again, if your
design is not balanced, you just have to work harder to get the variance
components (the formulas for this are in Winer).
*----two random factors--------------*
*--- generate balanced data
set obs 36
replace A=1 if A==7
bysort A: generate B=int(_n/2+1)
replace B=1 if B==4
table `A' `B'
local p= sum
drop sum tag
local q= sum
drop sum tag
anova `depvar' `A' `B' `A'*`B'
Notice, we have to work a bit harder to get the mean squares for each of
the factors this time, since they are not in the saved results after
-anova-. But, that is where -test- comes in handy, because they are in
the results after -test-.
By the way, both the books I have refered to above are available at the
* For searches and help try: