Contrasts for ANCOVA

As we did in ordinary ANOVA, contrasts are useful for obtaining more precise information about our data. We now show how to test the difference between two means. The key is to use the adjusted means and the correct error term.

To compare the adjusted means y'_i and y'_j, define the statistic t as follows:


Then t ~ T(dfRes(y,x,t)). Thus if p-value < α then we reject the null hypothesis that \bar y'_i = \bar y'_j.

Example 1: Determine whether there is a significant difference between Method 2 and Method 4 from Example 1 of Basic Concepts of ANCOVA.

We chose these two methods since from Figure 1 of Basic Concepts of ANCOVA we see that these are the methods with the largest and smallest means. Figure 1 shows the calculations described above for comparing the adjusted means of Method 2 and Method 4.

ANCOVA Contrasts Excel example

Figure 1 – Comparison of Method 2 and Method 4

Here the means for x (cells B5 and C5) and the adjusted means for y (cells B4 and C4) are found in Figure 7 of Regression Approach to ANCOVA. The formulas for the cells in column D are shown in column F. The formulas in cells D7, D8 and D11 refer to Figure 2 of Regression Approach to ANCOVA.

Since p-value = .0049 < .05 = α, we conclude there is a significant difference between the Method 2 and Method 4.

Observation: As we saw when computing the adjusted means, the regression coefficient for t2 represents the difference in adjusted means between Method 2 and Method 4. Looking at Figure 5 of Regression Approach to ANCOVA, we see that the regression coefficient for t2 is 11.457 with t-stat = 3.033, the same values as those in Figure 1.

In general, another way to compare two group means is to choose one of them as the treatment which gets coded as all zeros (e.g. in Example 1 of Basic Concepts of ANCOVAt1 = t2 = t3 = 0 for Method 4) and then look at the t-stat for the regression coefficient that corresponds to the other treatment (Method 2 in Example 1 of Basic Concepts of ANCOVA). If the p-value for this t-test is < α then there is a significant difference between the two means.

See ANCOVA Analysis Tools for information about how to conduct Contrast analyses using the Real Statistics ANCOVA data analysis tool.

4 Responses to Contrasts for ANCOVA

  1. Eileen Bill says:

    Hi, Charles,

    I’ve successfully run my ANCOVA, but can’t figure out from this page how to generate the multiple comparisons. Do I have do this by hand — putting in the equations myself? I’m sorry I just can’t figure out how to generate Figure 1 for my three groups.



    • Charles says:

      Figure 1 gives a pretty detailed description of the calculation necessary. I have not yet implemented this calculation in the Real Statistics Resource Pack, although I expect to do so shortly.

  2. hanna says:

    Hallo 🙂

    Thank you so much for this description. Saved my life! I have one question: is there any name for the method or a paper/book to cite that provides this equation for t?

    Thank you in advance

Leave a Reply

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