I would run it all in one model although I wouldn't use an ANCOVA probably. Instead I would a less strict linear model. I make this suggestion because ANOVAs/ANCOVAs have a very strict set of assumptions (see here) which are rarely met. They are a specific case of linear models and should rarely be used, despite their prevalence.
Either model you use will require you to change the shape of your data slightly by stacking what you currently have in the repository and then including an additional column coding for group 1 v.s. group 2.
You could use something like:
colnames(df) <- c("x", "y", "z", "x", "y", "z")
df2 <- rbind(df[,1:3], df[,4:6])
df2$group <- c(rep("1", nrow(df)), rep("2", nrow(df)))
Once you have it in this shape you can fit the model with:
fit <- lm(z ~ x + y + group, data = df)
summary(fit)
If you want to have a multiplicative model to see if the effects of x and y differ depending on the level of group you could fit something like:
fit <- lm(z ~ (x + y) * group, data = df)
summary(fit)
You should check the assumptions of these models though. The s20x
package has some good functions like normcheck
, eovcheck
and cooks20x
for doing this.
From here you could go on to interpret the confidence intervals for your terms which will tell you just how much the groups differ by (see the confint
function).