ANCOVA and the Agricultural Pollution Data

Let’s get a brief overview of ANCOVA and the agricultural pollution data.

R packages

We’ll use the following R packages in this chapter.

  • ggplot2
  • Sleuth3
  • arm

ANCOVA

In the previous chapter, we analyzed the interaction between two categorical explanatory variables. In this chapter, we’ll examine the interactions between a factor and a continuous explanatory variable, an analysis that is usually known as ANCOVA.

ANCOVA, covariates, and general linear models

In the context of experiments, ANCOVA refers to a design that has one factor and one continuous explanatory variable. One way to think of it is as a combination of the regression and one-way ANOVA linear models from previous chapters. As we’ve seen, one advantage of R is that it takes a general approach. The linear model function lm() can work with explanatory variables that are categorical factors (ANOVA) or continuous (regression) as well as with combinations of them (general linear models).

One aspect that can be potentially confusing is that general linear models are limited—they only use the normal distribution, but generalized linear models (GLMs or GLIMs) allow a broader range of distributions. If it has just one factor and one continuous variable, ANCOVA can be seen as the simplest general linear model. However, ANCOVA is also used to describe the analyses where we need to adjust for the effects of uncontrolled variables when we make an assessment of the effects of the design variables.

For example, imagine that we have a study where we want to assess the effects of an experimental treatment on the growth of an organism, but the initial size varies (see the Linear Model Complexities chapter for such a case). Before we assess the effect of the experimental treatment on growth, we need to adjust for differences in initial size. This type of analysis is also sometimes referred to as an ANCOVA with the initial size as the covariate. Some statisticians refer to all variables as covariates, so that’s something to be on the lookout for!

Get hands-on with 1200+ tech skills courses.