# ANOVA approach to ANCOVA

We now show how to perform ANCOVA based on ANOVA instead of regression.

Example 1: Redo Example 1 of Basic Concepts of ANCOVA using an ANOVA approach to ANCOVA.

We start by calculating the slopes of the regression lines of the reading scores for each method versus the family income of the children in that sample based on the raw data in Figure 1 of Basic Concepts of ANCOVA. The results are displayed in Figure 1.

Figure 1 – Slopes of regression lines for Example 1

Some representative formulas in Figure 1 are presented in Figure 2.

Figure 2 – Representative formulas from Figure 1

The next step is to run a one-way ANOVA on the reading scores (input data range B5:E15)and another on the family incomes (input data range G5:J15) using either Excel’s Anova: Single Factor data analysis tool or the Real Statistics Single Factor Anova data analysis tool (see Figure 3).

Figure 3 – ANOVA on readings scores and family income

Using the results from Figure 1 and 3, we can now create (in Figure 4) the same two versions of ANCOVA that appear in Figure 3 and 4 of Regression Approach to ANCOVA.

Figure 4 – ANCOVA for Example 1

To see how this is done, we show in Figure 5 some representative formulas from Figure 4.

Figure 5 – Representative formulas from Figure 4

Real Statistics Data Analysis Tool:  The Real Statistics Resource Pack provides the ANCOVA data analysis tool.

To use the tool for the analysis of Example 1, click on cell L1 (where the output will start), enter Ctrl-m and double click on Analysis of Variance (as shown Figure 0 of Anova Confidence Interval). Select ANCOVA and press OK. Then fill in the dialog box that appears as shown in Figure 6.

Figure 6 – Dialog box for Analysis of Covariance

The output is shown in Figure 7.

Figure 7 – Analysis of Covariance data analysis tool

### 35 Responses to ANOVA approach to ANCOVA

1. Angela says:

Very clear and helpful: Thank you very much!
However, I can’t see how you go from Fig 1 and Fig 3 to Fig 4. Fig 5 doesn’t provide enough information to see how this is done (I’m referring to: http://www.real-statistics.com/analysis-of-covariance-ancova/anova-approach-ancova/)

Would it be possible to get the actual excel sheet you did this in so that I can see all your formulae?

Thanks

2. Ernest S says:

Charles,

Thank you for putting this resource together! I have a few questions. I downloaded your add-ins and accompanying worksheets as well.

1. Figure 1. I understand the logic behind it, and the calculations. However, what do you do with it? Are some cell values utilized later? Are there judgments to be made from this?

2. figure 4. Is this an array output from ‘covariance’ from your add-in? I’m trying to understand how to get this output. If it is from the add-in, which data range is selected?

Thanks

• Charles says:

Hello Ernest,

1. The data in Figure 1 is used to create the two ANOVA results shown in Figure 3. This was confusing since the wrong image was shown in Figure 3. I have now corrected this and so now it is easier to see this. Figure 1 also shows the slopes for comparison with the regression approach to Ancova shown in http://www.real-statistics.com/analysis-of-covariance-ancova/regression-approach-ancova/.

2. The output for Figure 4 is not created by the add-in, but using the formulas shown in Figure 5. This should now be much easier to understand since you can now see the correct version of Figure 3.

I hope this helps and thanks for identifying the problem.

Charles

• Ernest S says:

Charles, thank you for your clarification! How can I test the slopes of the regression lines (x,y)? Are they equal or not? Is that a conclusion from Fig 4 that I’m just not reading right? thanks

3. Pamela says:

Is the ANCOVA data analysis tool in the resource pack for MAC? I couldn’t seem to find it.

Thanks, Pamela

• Charles says:

Pamela,
The ANCOVA data analysis tool has only recently been added to the Windows version of the resource pack. I hope to get a new Mac release out shortly. It will include the ANCOVA data analysis tool.
Charles

• Pamela says:

Thanks! I look forward to the new release.

Pamela

4. walter williamson says:

5. Charity says:

Hello,

Thanks so much for this resource.

Two questions about ANCOVA using RealStatistics:
1) Why does the input go all the way to row 17 instead of stopping at row 15? When I tried doing both of these, it gave me different output values, too, so I’d like to understand better why I wouldn’t stop at just the raw values.
2) I think there is a bug; when I tried to do the ANCOVA function in your example workbook, the output just lists “Method 1” as all of the 4 groups, and the adjusted means become “0”. The F and p also return errors rather than numbers.

Thanks for your help.

Charity

• Charles says:

Charity,

1) The input should stop at row 15. The dialog box values are in error. The output is correct, however, and uses the data through row 15 only. Thanks for catching this error. I have made a notation on the webpage and shortly I will substitute the image with one containing the correct input ranges.

2) There is a bug in the headings when you place the output on a new worksheet. The headings are correct when you keep the output on the same page as the input. Thanks for finding this error as well. I will correct the software in the next release. When I ran the ANCOVA data analysis tool using the latest release (2.6.2), however, I did not get errors for F and p-value.

Charles

• Charity says:

Thank you so much!! This was super helpful.

6. sohaib says:

hi,
i am trying to get ancova table but it always got compile error in hidden module. i followed all given steps precisely but same massage, please let me know from where/what mistake i am doing?

• Charles says:

This sort of problem seems to come up from time to time, but I am not sure why. If you can answer the following questions I will try to figure out what has gone wrong:

1. What operating system are you using (Windows 8.1, 8.0, 7, Vista, XP, Mac OS)?
2. What version of Excel are you using (Excel 2013, 2011, 2010, 2007, 2003, 2002)?
3. Are you able to use any of the other Real Statistics data analysis tools without getting the “compile error in hidden module” error?
4. What value do you get when you enter the formula =VER() in any cell in the spreadsheet?

Charles

• sohaib says:

thankyou for responce Charles,
i am using windows 8.1, microsoft office 2007, and getting error for all of realstat analysis, correlation, anova, ancova and regression. =VER() in any column is okay(it calculates variance exactly). the massage of error displayed is from microsoft visual basic.

sohaib

• Charles says:

Please check =VER() since it does not calculate variance.
Charles

• Tom says:

I have got the same problem. RealStats-2007 does not work on my laptop. I use RealStats for Excel 2010 instead. My laptop is Win 7 Ultimate SP1, Office 2007, Excel 2010. The command =VER() in any column is okay with 4.2 in results.

• Charles says:

Tom,

If I understand correctly, RealStats works properly for Excel 2010, but RealStats-2007 does not work. Is that correct?

Does =VER() work properly for RealStats-2007?
Does the version of Office 2007 that you are using also contain Access and Outlook?

Charles

• Charles says:

Tom,
I have recently heard from others who are having problems specifically with Excel 2007 as part of Office 2007 Professional. I have also been given the suggestion that upgrading to the latest Office 2007 service pack (namely SP3) can resolve this type of problem, but I have not been able to test this myself.
Charles

• Tom says:

Dear Charles,
Thanks for your advice about upgrading. I use Original MS Office 2007 Home and Student. Its version is 12.0.4518.1014. I do not install Outlook and Access. I will upgrade my office to SP3 (12.0.6611.1000) and test RealStats 2007 when I finish my report.

Tom

7. Tom says:

Dear Charles,

I wonder why in Figure 4 (ANCOVA for Example 1), the P-value of Treatment is 0.031940102 which is not as the same as p-value of Between in Figure 7 (Analysis of Covariance data analysis tool)

Yours faithfully,
Tom

• Charles says:

Dear Tom,

Sorry for taking so long to respond. There is a mistake in the output from the Real Statistics Ancova data analysis tool. I have alerted readers to this after Figure 7 and plan to fix this error in the next release of the software.

Thank you very much for catching this error. I am grateful to you and the many others who have helped improve the website and software.

Charles

8. Bill G. says:

Real-Statistics is really great. Many thanks. I recommend it to my students. One small query – I think there’s an error in the calculation of the adjusted means in your ANCOVA output. The average term for the covariate is missing from the formula you are using.

• Charles says:

Bill,
I believe that you are correct since the results are not the same as those using the regression method on the webpage ANCOVA using Regression.
I will take a look at this shortly and make any corrections necessary.
Thanks for bringing this to my attention.
Charles

9. Jay says:

Hello Charles,

This statistics package is really helpful. Is there a way to do post hoc test for ancova?

Best,

J
———-

• Charles says:

Jay,

The website explains how to use contrasts (with or without a Bonferroni/Sidak correction) for post hoc testing. See the webpage
Contrasts for ANCOVA

You can also use Tukey’s HSD, but I haven’t included this on the website yet.

Charles

10. Michelle says:

Hello Charles!
Does your output have the results for the interaction of your factor and covariate method*income? If not, you wouldn’t happen have another analysis that will help?
Thanks so much!

• Charles says:

Michelle,
I haven’t forgotten your question, but have not yet been able to allocate enough time to give you a suitable response.
Charles

11. K.Stephen Choi says:

Hello Charles,

Thank you for your valuable work here.
Question: So how do you interpret the result her?
a nice narrative result interpretation would be nice.

Steve

• Charles says:

This is discussed on the webpage ANCOVA Basic Concepts.

For Example 1 on the referenced webpage, since p-value = .03194 < .04 (see Figure 4) we conclude that there is a significant difference between the reading scores of the 4 methods factoring out the effects of family income (i.e. excluding the influence of family income). Charles

12. weldeysus says:

Hello;
How can I incorporate initial weight as covariant for final weight with

treatment number ——— 5
block number —————-5

• Charles says:

Sorry, but I don’t understand your question.
Charles

13. Francois says:

Question,
what is the x for the P value? is it the F value? Thanks in advance

• Charles says:

Francois,
Yes, x is F in the calculation of the p-value.
Charles