Further inference from an ANOVA table: residual variance to standard errors and confidence intervals

How to use the residual mean square from an ANOVA table to quantify uncertainty and compare treatment means.

Below is an example of a 2-way Analysis of Variance (ANOVA) for a randomised complete block design. From the ANOVA table, we’re going to see how to calculate:

  • The standard error of a mean (SEM).
  • The confidence interval (CI) for a mean.
  • The standard error of the difference between two means (SED).
  • The least significant difference between two means (LSD).
  • The confidence interval for the difference between two means.
Analysis of variance
Variate: yield
Source of variation            d.f.         s.s.         m.s.        v.r.     F pr.

block stratum                   2        0.30850      0.15425       3.44

block.*Units* stratum
Nitrogen                        2        4.59223      2.29611      51.22     <.001
Sulphur                         3        0.97720      0.32573       7.27      0.001
Nitrogen.Sulphur                6        0.64851      0.10808       2.41      0.061
Residual                       22        0.98625      0.04483

Total                          35        7.51269
  
↓
Residual mean square, s2

The ANOVA table gives us an estimate of the residual mean square (s2) – also known as the mean square error, residual error or residual variation. This is the variation in the data unexplained by the ANOVA model.  In the example above, this is the variation remaining after the block effects (block) and treatment effects (Nitrogen, Sulphur and the Nitrogen by Sulphur interaction, Nitrogen.Sulphur) have been accounted for.

The standard error of a mean (SEM) is calculated using the following formula:

SEM=s2nSEM = \sqrt{\frac{s^{2}}{n}}

where n is the number of replicates (or sample size).

 

The SEM describes the uncertainty in our estimate of the population mean for a treatment from the available data. The bigger the sample size (i.e., the larger n), the smaller the SEM and the more precise our estimate is.

In our example, there are 12 unique treatment combinations: the 3 levels of Nitrogen by the 4 levels of Sulphur. Note, we can obtain the number of levels of each treatment, and number of blocks, from the degrees of freedom in the ANOVA table.

Analysis of variance
Variate: yield
Source of          d.f.
variation
block stratum      2    ← Number of blocks − 1

block.*Units* stratum
Nitrogen           2    ← Number of levels of Nitrogen − 1
Sulphur            3    ← Number of levels of Sulphur − 1
Nitrogen.Sulphur   6    ← (Number of levels of Nitrogen − 1) ×
                           (Number of levels of Sulphur − 1)
Residual          22

Total             35
  

Furthermore, the total number of degrees of freedom + 1 gives us the number of experimental units. Thus, in our example, there are 36 experimental units, with each of the 12 unique treatment combinations occurring exactly once in each of the 3 blocks.


Therefore…


  • The 12 Nitrogen by Sulphur means have replication of 3 (1 replicate per block).

For example, the 3 replicates of the treatment corresponding to the first level of Nitrogen and the second level of Sulphur (Nitrogen 1 Sulphur 2) are highlighted yellow in the schematic below of our randomised complete block design:


Plot Block 1 Block 2 Block 3
1 Nitrogen 3   Sulphur 4 Nitrogen 1   Sulphur 2 Nitrogen 3   Sulphur 1
2 Nitrogen 2   Sulphur 2 Nitrogen 2   Sulphur 1 Nitrogen 2   Sulphur 2
3 Nitrogen 1   Sulphur 4 Nitrogen 3   Sulphur 1 Nitrogen 2   Sulphur 1
4 Nitrogen 2   Sulphur 4 Nitrogen 3   Sulphur 3 Nitrogen 2   Sulphur 3
5 Nitrogen 2   Sulphur 1 Nitrogen 1   Sulphur 4 Nitrogen 1   Sulphur 2
6 Nitrogen 1   Sulphur 3 Nitrogen 2   Sulphur 2 Nitrogen 1   Sulphur 1
7 Nitrogen 3   Sulphur 2 Nitrogen 1   Sulphur 1 Nitrogen 2   Sulphur 4
8 Nitrogen 1   Sulphur 1 Nitrogen 3   Sulphur 4 Nitrogen 1   Sulphur 3
9 Nitrogen 2   Sulphur 3 Nitrogen 2   Sulphur 3 Nitrogen 3   Sulphur 4
10 Nitrogen 1   Sulphur 2 Nitrogen 2   Sulphur 4 Nitrogen 3   Sulphur 3
11 Nitrogen 3   Sulphur 3 Nitrogen 3   Sulphur 2 Nitrogen 1   Sulphur 4
12 Nitrogen 3   Sulphur 1 Nitrogen 1   Sulphur 3 Nitrogen 3   Sulphur 2

Thus, the standard error for the Nitrogen by Sulphur means is:

SEMNitrogen.Sulphur=0.044833=0.1222\begin{array}{rcl} \mathrm{SEM}_{\text{Nitrogen.Sulphur}} & = & \sqrt{\dfrac{0.04483}{3}} \\ & = & 0.1222 \end{array}
  • The 3 Nitrogen means, pooled over the four Sulphur levels, have replication of 12 (3 blocks x 4 levels of Sulphur).

For example, the replicates of the first level of Nitrogen (Nitrogen 1) are highlighted in yellow:

Plot Block 1 Block 2 Block 3
1 Nitrogen 3 Sulphur 4 Nitrogen 1 Sulphur 2 Nitrogen 3 Sulphur 1
2 Nitrogen 2 Sulphur 2 Nitrogen 2 Sulphur 1 Nitrogen 2 Sulphur 2
3 Nitrogen 1 Sulphur 4 Nitrogen 3 Sulphur 1 Nitrogen 2 Sulphur 1
4 Nitrogen 2 Sulphur 4 Nitrogen 3 Sulphur 3 Nitrogen 2 Sulphur 3
5 Nitrogen 2 Sulphur 1 Nitrogen 1 Sulphur 4 Nitrogen 1 Sulphur 2
6 Nitrogen 1 Sulphur 3 Nitrogen 2 Sulphur 2 Nitrogen 1 Sulphur 1
7 Nitrogen 3 Sulphur 2 Nitrogen 1 Sulphur 1 Nitrogen 2 Sulphur 4
8 Nitrogen 1 Sulphur 1 Nitrogen 3 Sulphur 4 Nitrogen 1 Sulphur 3
9 Nitrogen 2 Sulphur 3 Nitrogen 2 Sulphur 3 Nitrogen 3 Sulphur 4
10 Nitrogen 1 Sulphur 2 Nitrogen 2 Sulphur 4 Nitrogen 3 Sulphur 3
11 Nitrogen 3 Sulphur 3 Nitrogen 3 Sulphur 2 Nitrogen 1 Sulphur 4
12 Nitrogen 3 Sulphur 1 Nitrogen 1 Sulphur 3 Nitrogen 3 Sulphur 2

(Note, within each of the 3 blocks, a given level of Nitrogen corresponds to 4 unique treatment combinations: 1 at each level of Sulphur).

Thus, the standard error for the Nitrogen means is:

SEMNitrogen=0.0448312=0.0611\begin{array}{rcl} \mathrm{SEM}_{\text{Nitrogen}} & = & \sqrt{\dfrac{0.04483}{12}} \\ & = & 0.0611 \end{array}
  • The 4 Sulphur means, pooled over the 3 Nitrogen levels, have replication of 9 (3 blocks x 3 levels of Nitrogen).

For example, the replicates of the second level of Sulphur (Sulphur 2) are highlighted yellow:

Plot Block 1 Block 2 Block 3
1 Nitrogen 3 Sulphur 4 Nitrogen 1 Sulphur 2 Nitrogen 3 Sulphur 1
2 Nitrogen 2 Sulphur 2 Nitrogen 2 Sulphur 1 Nitrogen 2 Sulphur 2
3 Nitrogen 1 Sulphur 4 Nitrogen 3 Sulphur 1 Nitrogen 2 Sulphur 1
4 Nitrogen 2 Sulphur 4 Nitrogen 3 Sulphur 3 Nitrogen 2 Sulphur 3
5 Nitrogen 2 Sulphur 1 Nitrogen 1 Sulphur 4 Nitrogen 1 Sulphur 2
6 Nitrogen 1 Sulphur 3 Nitrogen 2 Sulphur 2 Nitrogen 1 Sulphur 1
7 Nitrogen 3 Sulphur 2 Nitrogen 1 Sulphur 1 Nitrogen 2 Sulphur 4
8 Nitrogen 1 Sulphur 1 Nitrogen 3 Sulphur 4 Nitrogen 1 Sulphur 3
9 Nitrogen 2 Sulphur 3 Nitrogen 2 Sulphur 3 Nitrogen 3 Sulphur 4
10 Nitrogen 1 Sulphur 2 Nitrogen 2 Sulphur 4 Nitrogen 3 Sulphur 3
11 Nitrogen 3 Sulphur 3 Nitrogen 3 Sulphur 2 Nitrogen 1 Sulphur 4
12 Nitrogen 3 Sulphur 1 Nitrogen 1 Sulphur 3 Nitrogen 3 Sulphur 2

Thus, the standard error for the Sulphur means is:

SEMSulphur=0.044839=0.0706\begin{array}{rcl} \mathrm{SEM}_{\text{Sulphur}} & = & \sqrt{\dfrac{0.04483}{9}} \\ & = & 0.0706 \end{array}

The confidence interval (CI) for a mean is

mean±SEM×tα/2,rdf\text{mean} \pm SEM \times t_{\alpha/2,\,rdf}

where tα/2,rdf is the α/2 critical value of the t distribution with rdf degrees of freedom. For a confidence interval of C%, α = 1 − C/100. For example, for a 95% confidence interval, α = 0.05. The rdf refers to the residual degrees of freedom. This can be read directly from the ANOVA table.

Analysis of variance
Variate: yield
Source of variation            d.f.         s.s.         m.s.        v.r.     F pr.

block stratum                   2        0.30850      0.15425       3.44

block.*Units* stratum
Nitrogen                        2        4.59223      2.29611      51.22     <.001
Sulphur                         3        0.97720      0.32573       7.27      0.001
Nitrogen.Sulphur                6        0.64851      0.10808       2.41      0.061
Residual                       22        0.98625      0.04483

Total                          35        7.51269
↓
Residual degrees of freedom, rdf

In a nutshell, a C% confidence interval for a mean is a range of values that you can be C% certain contains the true population mean. Although, strictly speaking, the confidence level C% represents a long-run percentage: the C% confidence interval gives an estimated range of values that we would expect the true, but unknown, population parameter to lie within C% of the times, should we repeat our experiment a large number of times.

The tables of means for our example are given below:

Tables of means
Variate: yield
Grand mean 1.104

Nitrogen          1        2        3
                  0.601    1.313    1.398

Sulphur           1        2        3        4
                  0.829    1.155    1.167    1.266

Nitrogen.Sulphur          1        2        3        4
1                         0.560    0.770    0.524    0.552
2                         0.894    1.289    1.525    1.545
3                         1.032    1.404    1.454    1.700

For example, the 95% confidence interval for the overall mean for Sulphur level 4 is:

1.266±0.0706×t0.025,221.266±0.0706×2.074(1.120,1.412)\begin{array}{c} 1.266 \pm 0.0706 \times t_{0.025,22} \\ 1.266 \pm 0.0706 \times 2.074 \\ (1.120, 1.412) \end{array}

Similarly, the 99% confidence interval for the Nitrogen level 1, Sulphur level 3 mean is:

0.524±0.1222×t0.005,220.524±0.1222×2.819(0.180,0.868)\begin{array}{c} 0.524 \pm 0.1222 \times t_{0.005,22} \\ 0.524 \pm 0.1222 \times 2.819 \\ (0.180, 0.868) \end{array}

The standard error of the difference between two means (SED) is calculated using the following formula:

SED=SEM×2SED = \text{SEM} \times \sqrt{2}

Note: The formula is different when the sample sizes of the means being compared are unequal.

The SED describes the uncertainty in our estimate of the difference between two population means. 

For our example, the SED between …

a) two Nitrogen by Sulphur means is:

SEDNitrogen.Sulphur=0.1222×2=0.1728\begin{array}{rcl} \mathrm{SED}_{\text{Nitrogen.Sulphur}} & = & 0.1222 \times \sqrt{2} \\ & = & 0.1728 \end{array}

b) two overall Nitrogen means is:

SEDNitrogen=0.0611×2=0.0864\begin{array}{rcl} \mathrm{SED}_{\text{Nitrogen}} & = & 0.0611 \times \sqrt{2} \\ & = & 0.0864 \end{array}

and

c) two overall Sulphur means is:

SEDSulphur=0.0706×2=0.0998\begin{array}{rcl} \mathrm{SED}_{\text{Sulphur}} & = & 0.0706 \times \sqrt{2} \\ & = & 0.0998 \end{array}

Two means can be compared using their least significant difference (LSD). The LSD gives the smallest value in which the absolute difference between the two means is deemed to be is statistically significant at the α level of significance. The LSD is given by:

LSD(α×100%)=SED×tα/2,rdfLSD(\alpha \times 100\%) = SED \times t_{\alpha/2, rdf}

Thus, for our example, the LSD(5%) for comparing …

a) two Nitrogen by Sulphur means is:

LSD(5%)Nitrogen.Sulphur=0.1728×t0.025,22=0.1728×2.074=0.3584\begin{array}{rclcl} LSD(5\%)_{Nitrogen.Sulphur} & = & 0.1728 & \times & t_{0.025,22} \\ & = & 0.1728 & \times & 2.074 \\ & = & 0.3584 & & \end{array}

b) two overall Nitrogen means is:

LSD(5%)Nitrogen=0.0864×t0.025,22=0.0864×2.074=0.1792\begin{array}{rclcl} LSD(5\%)_{Nitrogen} & = & 0.0864 & \times & t_{0.025,22} \\ & = & 0.0864 & \times & 2.074 \\ & = & 0.1792 & & \end{array}

and

c) two overall Sulphur means is:

LSD(5%)Sulphur=0.0998×t0.025,22=0.0998×2.074=0.2070\begin{array}{rclcl} LSD(5\%)_{Sulphur} & = & 0.0998 & \times & t_{0.025,22} \\ & = & 0.0998 & \times & 2.074 \\ & = & 0.2070 & & \end{array}

 Using the overall means for Nitrogen as an example, at the 5% significance level…

  • there is statistical evidence that the Nitrogen 1 and Nitrogen 2 means differ
abs(meanNitrogen 1−meanNitrogen 2)=abs(0.601−1.313)=0.712≥0.1792, the LSD(5%)\begin{array}{rcl} \mathrm{abs}\big(\text{mean}_{Nitrogen\ 1} – \text{mean}_{Nitrogen\ 2}\big) & = & \mathrm{abs}(0.601 – 1.313) \\ & = & 0.712 \\ & \geq & 0.1792,\ \text{the LSD(5\%)} \end{array}
  • there is statistical evidence that the Nitrogen 1 and Nitrogen 3 means differ
abs(meanNitrogen 1−meanNitrogen 3)=abs(0.601−1.398)=0.797≥0.1792, the LSD(5%)\begin{array}{rcl} \mathrm{abs}\big(\text{mean}_{Nitrogen\ 1} – \text{mean}_{Nitrogen\ 3}\big) & = & \mathrm{abs}(0.601 – 1.398) \\ & = & 0.797 \\ & \geq & 0.1792,\ \text{the LSD(5\%)} \end{array}
  •  there is NO statistical evidence that the Nitrogen 2 and Nitrogen 3 means differ
abs(meanNitrogen 2−meanNitrogen 3)=abs(1.313−1.398)=0.085<0.1792, the LSD(5%)\begin{array}{rcl} \mathrm{abs}\big(\text{mean}_{Nitrogen\ 2} – \text{mean}_{Nitrogen\ 3}\big) & = & \mathrm{abs}(1.313 – 1.398) \\ & = & 0.085 \\ & < & 0.1792,\ \text{the LSD(5\%)} \end{array}

The difference between two means can also be compared, and more fully described, using a confidence interval for the difference between two means. This is given by:

(m1−m2)±SED×tα/2, rdf(m_1 – m_2) \pm \mathrm{SED} \times t_{\alpha/2,\ \mathrm{rdf}}

or, equivalently,

(m1−m2)±LSD(α×100%)(m_1 – m_2) \pm \mathrm{LSD}(\alpha \times 100\%)

where m1 and m2 are the two means being compared.

Once again. using the overall means for Nitrogen as an example, the 95% confidence interval for the difference between:

  • the Nitrogen 1 and Nitrogen 2 means (meanNitrogen 1−meanNitrogen 2)\big(\text{mean}_{Nitrogen\ 1} – \text{mean}_{Nitrogen\ 2}\big)is:
−0.712±0.1792(−0.891, −0.533)\begin{array}{rcl} -0.712 \pm 0.1792 \\ (-0.891,\ -0.533) \end{array}
  • the Nitrogen 1 and Nitrogen 3 means (meanNitrogen 1−meanNitrogen 3)\big(\text{mean}_{Nitrogen\ 1} – \text{mean}_{Nitrogen\ 3}\big)is:
−0.797±0.1792(−0.976, −0.618)\begin{array}{rcl} -0.797 \pm 0.1792 \\ (-0.976,\ -0.618) \end{array}
  • the Nitrogen 2 and Nitrogen 3 means (meanNitrogen 2−meanNitrogen 3)\big(\text{mean}_{Nitrogen\ 2} – \text{mean}_{Nitrogen\ 3}\big)
−0.085±0.1792(−0.264, 0.094)\begin{array}{rcl} -0.085 \pm 0.1792 \\ (-0.264,\ 0.094) \end{array}

Notice that the CIs comparing Nitrogen 1 with Nitrogen 2, and Nitrogen 1 with Nitrogen 3, both exclude zero. Hence, we can conclude, at the 5% significance level, that the mean for Nitrogen 1 is significant differently from both the Nitrogen 2 and Nitrogen 3 means. (In this case the mean for Nitrogen 1 is lower than that of Nitrogen 2 and Nitrogen 3). Conversely, as the CI comparing Nitrogen 2 and Nitrogen 3 includes zero, we conclude that there is no evidence of a difference between these two means (at the 5% significance level).

Luckily for us, we rarely need to calculate these quantities ourselves, as they are generated by most statistical software packages. However, it is useful to understand how they are calculated and how they are related. For example, in order to scrutinize reported results, or to calculate, at a later date, a quantity that you’ve forgotten to generate.  

Genstat has a very powerful set of ANOVA tools, that are straightforward and easy to use. In addition to the ANOVA table, you can readily output the treatment means, SEMs, SEDs, LSDs and CIs.

Picture of Dr. Vanessa Cave
Dr. Vanessa Cave
Dr. Vanessa Cave is an applied statistician interested in the application of statistics to the biosciences, in particular agriculture and ecology, and is a developer of the Genstat statistical software package. She has over 15 years of experience collaborating with scientists, using statistics to solve real-world problems. Vanessa provides expertise on experiment and survey design, data collection and management, statistical analysis, and the interpretation of statistical findings. Her interests include statistical consultancy, mixed models, multivariate methods, statistical ecology, statistical graphics and data visualisation, and the statistical challenges related to digital agriculture. Vanessa is a past President of both the Australasian Region of the International Biometric Society and the New Zealand Statistical Association, on the Editorial Board of The New Zealand Veterinary Journal and an honorary academic at the University of Auckland. She has a PhD in statistics from the University of St Andrew.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Related articles

How much of the variation in your field trial comes from the treatments, and how much comes from...
What should you do when count data are more variable than your model expects? Vanessa Cave and David...
Precision breeding can deliver scientifically impressive traits, but practical value depends on more than technical success. Owen McIntosh...