# Seeking Explanation of how this ANCOVA result in R shows the group means are not equal

Cross Validated Asked by Kyle on October 13, 2020

I am looking for an explanation as to how the ANCOVA results, below, show that the means of the groups defined by IndVar1 and IndVar2 are not equal, after accounting for the covariate, Covar.

I think the answer is that the intercept is adjusted (due to the covariate), and the p-values of IndVar1 and IndVar2 are still significant (p < 0.05).

-Model_1 includes the covariate, Covar. Model_2 does not (included for reference).
-DependentVar and Covar are continuous variables.
-IndVar1 and IndVar2 are categorical.
-The assumptions of ANCOVA for this test are met.
-Covar is significant when it is the only variable in the model.
-The interaction of IndVar1 and IndVar2 is not significant, so it’s not included.

> Model_1 <- aov(DependentVar ~ IndVar1 + IndVar2 + Covar, data = Dataset)
> Model_1 <- Anova(Model_1, type = "III")
> Model_1
Anova Table (Type III tests)

Response: DependentVar
Sum Sq   Df   F value    Pr(>F)
(Intercept)      8335.0    1     6244.6   < 2.2e-16 ***
IndVar1            18.5    5        2.7     0.029 *
IndVar2            49.2    5        6.5     7.821e-06 ***
Covar               2.9    1        1.8     0.18360
Residuals       2075.2  1250

> Model_2 <- aov(DependentVar ~ IndVar1 + IndVar2, data = Dataset)
> Model_2 <- Anova(Model_2, type = "III")
> Model_2
Anova Table (Type III tests)

Response: DependentVar
Sum Sq   Df   F value    Pr(>F)
(Intercept)  12235.4    1      7310.5   < 2.2e-16 ***
IndVar1         16.4    5         2.8     0.04549 *
IndVar2         49.6    5         6.9     3.7e-06 ***
Residuals     2099.2  1251


The answer is as I suspected. The intercepts are adjusted due to the covariate, and if one of the p-values of the two grouping variables is significant, then the adjusted means of all of the groups are not equal.

Answered by Kyle on October 13, 2020

I may be misunderstanding what you're asking here, so please clarify if I have misread something. As currently written, my understanding is that you have a factor, IndVar1, with some number of levels and another factor, IndVar2, with also some number of levels. Your question is then how the results from the ANCOVA would show that the means of at least one level of the IndVar1 factor differ from the means of at least one level of the IndVar2 factor.

If that is correct, then you need to include an interaction term in the model. Right now, the ANOVA table just shows that there is at least one mean difference within the factors. So, say that IndVar1 has 3 levels. These results tell you that there is at least one of those levels that is significantly different from the other two. So, you know that IndVar1 and IndVar2 both have significant main effects even after controlling for some other variable (i.e., Covar).

Running the following code instead will add the interaction term and let you know more about how the independent variables relate to one another:

Model_1 <- aov(DependentVar ~ IndVar1 + IndVar2 + IndVar1:Indvar2 + Covar, data = Dataset)


and just to be complete, a slightly more parsimonious way of running the two-way ANCOVA would be like this:

Model_1 <- aov(DependentVar ~ IndVar1*IndVar2 + Covar, data = Dataset)


Answered by Billy on October 13, 2020

## Related Questions

### How to get from input depth to output depth in convnets?

1  Asked on February 6, 2021 by randy-welt

### What is “symmetry” in evaluation metrics

1  Asked on February 5, 2021 by cherry-wu

### Acceptable average difference value for scientific literature?

0  Asked on February 5, 2021 by mksm1228

### Not reaching convergence with mixed model

1  Asked on February 4, 2021 by paze

### Independent variables minimum counts for logistic regression

1  Asked on February 4, 2021 by gideon-j-i

### What’s the advantage of cosine distance over Jaccard distance for text document similarity

0  Asked on February 4, 2021 by zesla

### Best way to visualise presence/absence of specific events in multiple case/control studies

1  Asked on February 4, 2021 by user964689

### How can I determine the overall best algorithm from a set of algorithms given pairwise probabilities?

0  Asked on February 3, 2021 by relieff

### How to use CLT on statistical inference?

1  Asked on February 2, 2021 by user777

### Is there a mathematical proof for change being correlated with baseline value

2  Asked on February 2, 2021

### Why is $P(t < T leq t + dt) = f(t)dt$?

2  Asked on February 1, 2021

### I used Pearson’s product-moment correlation coefficient, what paper do I cite?

3  Asked on February 1, 2021 by mikhail

### Are the No Free Lunch Theorem and Halting Problem connected?

1  Asked on February 1, 2021 by user70990

### Interpreting logistic regression coefficients for a categorical variable

1  Asked on February 1, 2021 by rafael-hernndez-salazar

### Write mixed linear model as two level hierarchical model

1  Asked on January 31, 2021 by user179028

### How the multiplication of observations numbers contributes to Bayesian assumption in BIC calculation?

1  Asked on January 30, 2021 by eddie-s

### Confidence Intervals for the coefficients of a Multiple Multivariate Regression

0  Asked on January 30, 2021 by virginie

### Validation loss fluctuating while training the neural network in tensorflow

1  Asked on January 29, 2021 by i-a

### Specification of longitudinal mixed-effects model with varying treatment times, varying observation times in lme4

1  Asked on January 29, 2021

### Need help understanding how only variable A can be correlated to the absolute value of A-B

2  Asked on January 29, 2021 by marcus-bdholm