ANCOVA with 2 covariates

Hello everyone,

I am currently doing an ANCOVA with :

  • dependent variable : volume of the right hippocampus
  • IV (factor) : group (with 2 dimensions)
  • IV (factor): timepoint (with 2 dimensions)
  • 2 covariates : age and tiv (total intracranial volume)

I tried first to do it with 1 covariate. When I want to add a 2nd covariate, it doesn't always work.

res.aov1 <- df1 %>%
anova_test(rHip ~ age + tiv + group*timepoint)
get_anova_table(res.aov1)
#significative effects of age, tiv and group

library(emmeans)
pwc <- df1 %>%
group_by(timepoint) %>%
emmeans_test(
rHip ~ group, covariate = age,
p.adjust.method = "bonferroni"
)
pwc %>% filter(timepoint == "t1")

----> How can I add a 2nd covariate to this last part ?

Or if someone can give me an example of any ANCOVA with 2 covariates that would help me a lot.

Thanks,
Cécile

I see that you loaded library(emmeans)
and I assumed emmeans_test would be in that package, but its not...

I loaded many packages at the beginning of my script :slight_smile:
library(tidyverse)
library(ggpubr)
library(rstatix)
library(ggplot2)
library(broom)
library(car)

I cant try it myself because your example is not reproducible (lacking data)
but I would try the following in the emmeans_test() call

covariate = c(age,tiv)

Oh thank you so much it worked !

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.