This article explains how covariates are handled in designed experiments, comparing ANCOVA, REML-based approaches, spline models, and alternative methods using examples from Genstat. It outlines when covariates matter, how they influence treatment estimates, and how different modelling strategies affect accuracy.
Understanding covariates is essential in agricultural, plant breeding, animal breeding and biological experiments, where small differences in early measurements or underlying variation can significantly affect treatment comparison.
Understanding Covariates in Designed Experiments
For a designed experiment, it is quite common for variables (“covariates”) other than the one of primary interest (“primary response”) to be measured either before or during the trial. For example, in a pot trial, the initial height of seedlings might be measured, or in a cereal trial, the percentage of bird damage per plot might be recorded. Figure 1 (adapted from fig 15.11 of Welham et al. 2015) shows several possible relationships between the primary response and the covariate. In the bottom row, there are 3 possible scenarios where the relationship varies between treatments.

Figure 1: Some possible relationships between a covariate and a primary response. For d, e, and f, the three colours indicate different treatments.
The traditional approach: ANCOVA
The traditional approach to analysis including covariates is to use Analysis of Covariance (ANCOVA). This makes a few assumptions. First, that the covariate does not (strongly) vary between the treatments (as is the case in Figure 1f). Second, it assumes that the relationship between the covariate and the response variable being analysed is linear (as in Figure 1b) and not curvilinear (as in Figure 1c). Finally, it assumes that the slope of the relationship between the covariate and the response variable is the same for all treatments but that the constant might vary (as in Figure 1d). If these assumptions hold for the data, ANCOVA is fairly straightforward to use.
Example: Nematode control trial
The example presented here uses part of the nematode control trial data used by Payne (Payne 2024 Section 3.6). The trial used 9 treatment combinations (None, 4 fumigants each at two rates), but for simplicity, the treatments using the single rate have been excluded, to leave five treatments. There were 4 replicates of the fumigant treatments and 16 of the None treatment, laid out in 4 blocks with 4 None plots per block plus one of each treatment. Nematodes were counted both before (“Prior counts”) and after applying the treatment (“Count” or “Response”)
In the analysis presented in the Genstat Statistics (VSN International Ltd 2024) and ANOVA guides, the prior and post-treatment counts are first logged before analysis. However, in the original published analysis (Cochran & Cox 1992), the data is not transformed. Here, the data are not log transformed. The technical details underlying ANCOVA, as well as explanations of the various parts of the output, can be found in the Genstat guides and introductory texts (such as Mead et al. 2003, Welham et al. 2015).
The data are summarised in Figure 2. The prior and post-treatment counts are moderately correlated (r=0.63). Figure 2 suggests that there might be treatment differences in the post-treatment counts (i.e., the primary response left), but also that there may be treatment differences relating to the prior counts (centre). Furthermore, the post-treatment counts may be related to the prior treatment counts, with this relationship possibly varying between treatments, perhaps with different slopes (right).

Figure 2: Dot-histograms showing the primary response (Count; left) and covariate (Prior count; centre) for each treatment. The relationship between the primary response and the covariate is on the right, showing a separate fitted line for each treatment.
Exploring the relationship between prior counts and response
The data was first analysed with standard ANOVA. If a covariate is required, the residuals from this ANOVA will show a relationship with the prior counts, as well as with the residuals from an ANOVA of the prior counts. For this data, the ANOVA residuals are moderately correlated (r=0.67) with the residuals from an ANOVA of the prior counts (Figure 3) but less well correlated with the prior counts (r=0.41).


Figure 3: Comparison between the residuals from ANOVA of the primary response (i.e., the post-treatment counts) and the residuals from ANOVA of the Prior counts (left) or the Prior counts (right). The correlations are r=0.67 and r=0.41 for the residuals and counts respectively.
ANCOVA results and interpretation
The ANCOVA table for the analysis of the post-treatment counts with the prior counts as a covariate is shown below. The covariate appears twice, because adjustments for it can be made in the Block and Plot strata (the covariate is not orthogonal to the Blocks). The covariate effect is relatively minor for the Block stratum (p=0.193), but significant in the Plot (Units) stratum (p=0.014), the level at which the Treatments are applied. The covariance efficiency factor (cov.ef.) for the treatments is 0.8: a value close to 0 indicates that the covariate is strongly correlated with the response count, and a value close to 1 indicates that the prior and response counts are fairly independent. The covariance efficiency factor for the residual lines “measures how much the covariates have improved the precision of the experiment” (Payne 2024).

Comparing ANOVA, ANCOVA and REML methods
The residual mean square has reduced from 10188 to 5165 – more than half. There is, therefore, a substantial reduction in the standard errors for the means (Table 2). In addition, the F probability for the Treatment main effect is reduced, from 0.344 to 0.013, with a significant effect of the Prior count covariate (p<0.001).

There were large changes in the means between the ANOVA and ANCOVA analysis for two of the treatments (CK, CN; Figure 4)

Figure 4: Comparison of un-adjusted means (from ANOVA) with the adjusted means after including a covariate (ANCOVA). Red line is the 1-1 line.
Modelling separate slopes using REML
As mentioned, with ANCOVA, it is assumed that the slope of the relationship between the prior and post treatment counts is the same for each treatment: this is often not the case. ANCOVA cannot allow for separate slopes, so an alternative approach is required. If there is no block structure, then standard regression can be used (see e.g. Welham et al. 2015, section 15.4 p409). However, where there is structure, standard regression leads to biased results. Restricted maximum likelihood (REML, Payne et al. 2024) enables ‘random effects’ (such as the block structure) to be allowed for. REML methods can therefore be used to assess the similarity of the slope between treatments of the prior-post treatment relationship in the presence of any block structure. First, the ANCOVA analysis can be fitted with REML (albeit with results differing somewhat from ANCOVA because of the different underlying model and estimation method). In Genstat, the model is defined using a VCOMPONENTS statement:
VCOMPONENTS [fixed=Priorcount+Treatment] random=Blocks
Then, for a model allowing for the slope of the Prior counts relationship to vary, the statement is:
VCOMPONENTS [fixed=Priorcount*Treatment] random=Blocks
Here, “Priorcount*Treatment” is shorthand for “Priorcount+Treatment+Priorcount.Treatment”. The interaction term Priorcount.Treatment causes the slopes to be separately estimated for each treatment.
The results of these two analyses are summarised in Table 2. The means obtained with the ANCOVA model fitted with REML are very similar to those from ANCOVA (Figure 5). The interaction term in the second REML analysis was negligible (p=0.649), which is why the estimated means for that analysis are also very similar to those from the ANCOVA.

Figure 5: Comparison between the means from fitting using four different models/ methods. R_ indicates results from a REML analysis: R_AnCova mimics ANCOVA, and R_Slopes is the model allowing for the slope of the prior-post relationship to vary between treatments.
Alternative approaches for handling covariates
If, as for the nematode example, the covariate and the response are of the same type (both are counts, weights, lengths etc), then an alternative approach to ANCOVA is to analyse the difference between the covariate and the response variable. Other calculations (such as the ratio or log of the ratio) can also be analysed. In contrast to ANCOVA, analyses of calculated changes between the main response and a covariate make no assumptions about the form of the relationship between the two sets of counts. For the nematode data, the post-prior count difference varied between the treatments (p=0.023), with the greatest reduction with the None treatment and the least with CS. Given that the data is counts, the ratio or log(ratio) may be a more appropriate variable to analyse.

Figure 6: Mean post-prior treatment difference. Treatments are ordered by the mean difference. Error bars are 95% confidence limits
A second approach for when the covariate and response are of the same type is to stack the prior and post treatment responses and analyse those with assessment time as a split-plot treatment. All the various treatment and blocking factors including Plot also need to be stacked. A further factor Time needs to be created. Then the stacked variable can be examined with a split-plot analysis of variance. The above ANOVA of the differences is a sub-analysis of this: The treatment means for the differences are identical to the difference between the Prior and Post treatment means in the split-plot analysis. The advantage of the split-plot method is that extra information is provided about the Time and Treatment main effects. It is also a useful method where there are negative differences (usually due to measurement difficulties, errors/ imprecision) but that negative changes are impossible, for example, an organism can only increase in size, not decrease.
Curvilinear response: Smoothing spline
A further capability of REML is that it allows the covariate’s relationship with the response to be curvilinear. The spline option of the VCOMPONENTS command allows a non-parametric cubic smoothing spline to be fitted to the data. The spline can be estimated separately for each treatment. The following VCOMPONENTS command fits parallel smoothing splines:
VCOMPONENTS [fixed=Treatment+Priorcount; spline=Priorcount] random=Blocks
REML does not (currently) have facilities to enable a curve of a particular type to be fitted. For example, you cannot specify that there is an exponential or a logistic relationship. However, such a capability is available, using a Hierarchical Generalized Linear model (HGLM, Lee et al. 2006) and the Genstat’s HGNONLINEAR command.
Conclusion:
Several methods are available to allow adjustments to the main variable of interest using a covariate. Just a few of these are presented above. Adjustments to estimated means and treatment can be substantial: Thus, it is important to explore the relationship between a covariate and the main variable of interest.
References
Cochran, W.G. & Cox, G.M. 1992. Experimental designs.
Lee, Y., Nelder, J.A. & Pawitan, Y. 2006. Generalized Linear Models with Random Effects: Unified Analysis via H-likelihood. Chapman & Hall/CRC Press, London,Pp 416.
Mead, R., Curnow, R.N. & Hasted, A.M. 2003. Statistical Methods in Agriculture and Experimental Biology. CRC Press,Pp 488.
Payne, R. 2024. A Guide to Anova and Design in Genstat® (Release 24.2). VSN International, Hemel Hempsted, Hertfordshire, Uk,Pp 133.
Payne, R., Welham, S. & Harding, S. 2024. A Guide to REML in Genstat (Release 24.2). VSN International, Hemel Hempstead, Hertfordshire, UK,Pp 106.
VSN International Ltd. 2024. The Guide to the Genstat® Command Language (Release 24.2). VSN International, Hemel Hempsted, Hertfordshire, Uk.
Welham, S.J., Gezan, S.A., Clark, S.J. & Mead, A. 2015. Statistical methods in biology: design and analysis of experiments and regression. CRC Press, Boca Raton, Florida,Pp 563+xiii.