Biology, images, analysis, design...
Use/Abuse Principles How To Related
"It has long been an axiom of mine that the little things are infinitely the most important" (Sherlock Holmes)

Search this site



One-way random effects ANOVA (Model II)

On this page: Principles  Model  Formulae  Estimating variance components  Assumptions 


In one-way ANOVA we have a single 'treatment' factor with several levels (= groups), and replicated observations at each level. In random effects one-way ANOVA, the levels or groups being compared are chosen at random. This is in contrast to fixed effects ANOVA, where the treatment levels are fixed by the researcher. Random effects ANOVA is appropriate in three situations:

  1. In quantitative genetics one often wishes to quantify the proportion of variance in a character that occurs between subjects relative to that within subjects. For example, the temperature that an individual lizard selects to rest in can vary over time within a subject, as well as differing on average from that of other subjects. Note here that subjects are the 'groups', and replicate observations are made on each subject.
  2. Random effects ANOVA is also used in studies to quantify measurement error. Repeatability (also termed test-retest reliability) assesses how similar repeated measurements are on the same subject. Again, subjects are the 'groups', and replicate observations are being made on each subject.
  3. Lastly it can be used to assess the relative magnitude of effects between and within clusters in cluster sampling. Here clusters are the 'groups', and individuals within the clusters comprise the replicate observations.



The mathematical model for one-way random effects ANOVA is similar to (but not identical to) the model for one-way fixed effects ANOVA. It again describes the effects that the determine the value of any given observation, but this time the 'treatment' factor is random rather than fixed:

Random effects

Yij  =  μ  +  Ai  +  εij
  • Yij is the value for jth individual of group i,
  • μ is the population (grand) mean,
  • Ai is the random effect for the ith level of factor A,
  • εij is the random error effect.

Expected mean squares

Random effects

Source of variation df Expected MS Variance ratio
1.Groups a-1 σ2 + nσ2A MS1/MS2
2.Error N-a σ2    
Total variation N-1        
  • a is the number of groups
  • n is the number of observations per group (sample size),
  • N is the total number of observations (= an),
  • σ2 is the error variance,
  • σ2A is the added variance component due to groups.



Computational formulae

The methodology for working out sums of squares is identical to that used for fixed-effects ANOVA. Again we are not assuming equal sample sizes in each group.

Algebraically speaking -

SSTotal   =   Σ( Y2 )   −   G2
SSB =Σ( Ti2 ) G2
SSW =SSTotal   −  SSB
  • SSTotal is the total sums of squares,
  • Y is the value of the jth observation in group i,
  • G is the overall total (ΣY),
  • N is the total number of observations (Σni)
  • SSB is sums of squares between groups,
  • Ti is the total of group i, (ΣYi)
  • ni are the number of observations in group i,
  • SSW is sums of squares within groups, or residual sums of squares.

These values are then inserted into the ANOVA table (see below), along with the degrees of freedom, and mean squares obtained by dividing the sums of squares by their respective degrees of freedom.

Source of variation
Between groups
Within groups
k − 1
N − k
N − 1
SSB / k−1
SSW / N−k
P value

The F-ratio for the 'groups effect' is obtained by dividing MSBetween by MSWithin. The P-value of this F-ratio is then obtained for k − 1 and N − k degrees of freedom.


Estimating variance components

Since we are now assuming random 'treatment' effects, there is no point estimating the magnitude of those effects (that is the means), nor the differences between means. For example, if we are making (n =) 2 measurements of weight on each of (k =) 20 subjects, we are not interested in which subject happens to be the heaviest. What is of interest is the amount of variability between subjects compared to the variability between the paired measurements on each subject. In other words, we need to estimate the variance components.

The variance within groups is estimated by MSW. The variance between groups is known as the added variance component and is estimated as shown below:

Algebraically speaking -

sA2    =    MSB − MSW
  • sA2 is the added variance component.

  • MSB and MSW are the mean square between samples and mean square within samples obtained from the ANOVA table, and

  • no is a measure of sample size. If sample sizes in each group are equal, no is equal to sample size. If sample sizes are unequal, no is given by:

    no = [1/(k − 1)][Σni − (Σni2/Σni)]
    where k is the number of groups, and ni is the sample size in the ith group.

The added variance component (sA2) can be quoted as an absolute measure of the variability between groups, or it can be quoted relative to the total variability (s2 + sA2). When it is quoted as a proportion of the total variability, it is known as the intraclass correlation coefficient.


The intraclass correlation coefficient

The intraclass correlation coefficient is the proportion the between groups variance comprises of (between groups + residual) variance. When the coefficient is high, it means that most of the variation is between groups. Hence it is a measure of similarity among replicates within a group relative to the difference between groups. When subjects are the 'groups', and the replicates are repeated observations being made on each subject, the intraclass correlation coefficient provides another measure of repeatability.

The intraclass correlation coefficient is calculated from the variance components derived from a random effects analysis of variance. For now we will only consider its estimation when we are doing a one way analysis of variance.

Algebraically speaking -

ICC    =    sA2
s2 + sA2
  • ICC is the intraclass correlation coefficient,
  • s2 is the within groups variance component.
  • sA2 is the added variance component.

An equivalent formulation is:

ICC    =    MSB - MSW
MSB + (no-1) MSW
  • ICC is the intraclass correlation coefficient,
  • MSB and MSW are the between groups and within groups mean squares from the ANOVA table,
  • no is the measure of sample size given above.

There is yet another computational formula which is exact if sample size (n) is constant, but only approximate if sample size varies. It has the advantage that it can be used to check the values of ICC given by researchers if the F-value and the degrees of freedom are (correctly) given.

ICC    =    (F − 1)
(F − 1 + no)
  • F is MSB/MSW,
  • no is the measure of sample size given above. If sample sizes are equal, then no = n which can be obtained from the degrees of freedom of F. If sample sizes are unequal, then mean sample size (= df1 + df2 + 1/df1 + 1) can be used as an approximation.

Note that the intraclass correlation coefficient is sensitive to the nature of the sample used to estimate it. For example, if the sample is homogeneous (that is the between subject variance is very small), then the within subject variance will be proportionally larger and the ICC will be low. In other words it's all relative. So whenever you interpret a correlation, remember to take into consideration the sample that was used to calculate it. The often-reproduced table which shows ranges of acceptable and unacceptable ICC values should not be used as it is meaningless.

One might think the Pearson correlation coefficient could be used to provide a measure of repeatability, at least when group size (n) = 2. Unfortunately that coefficient overestimates the true correlation for small sample sizes (less than ~15). In fact, the intraclass correlation is equivalent to the appropriate average of the Pearson correlations between all pairs of tests.

There are other intraclass correlation coefficients that can be used in special situations. Unfortunately these have resulted in a certain amount of confusion over the correct formulation for the most frequently used version of the ICC given above. For example there is an average measure intraclass correlation coefficient. This is appropriate if one wishes to assess the reliability of a mean measure based on multiple measurements on each subject. Some sources give this as [MSB-MSW]/MSW, or use what is known as the Spearman-Brown Prophecy formula (2*ICC)/1+ICC). One can also use different ANOVA models, for example a two way analysis of variance. Details are given in the references on the ICC given below.




In random effects ANOVA the groups (usually subjects) should be a random sample from a larger population. Otherwise, the same assumptions must hold as for a fixed effects ANOVA if one is to make valid statistical tests such as the F-ratio test, namely:

  1. Random sampling (equal probability)
  2. Independence of errors
  3. Homogeneity of variances
  4. Normal distribution of errors
  5. Effects are additive.

Note, however, that estimates of ICC for descriptive purposes only are not dependent on either normality or homogeneity of variances. They can for example be done on dichotomous data coded to 0s and 1s to perform the ANOVA. In this case of course the normal approximation confidence interval for the ICC (given by some statistical packages) would not be valid.

Related topics :

Design effect in cluster sampling