Steps to conduct ANCOVA between two groups that has 2 covariate? Using R, I want to compare two groups (1 & 2), each group having two covariate. More specifically, i need to:


*

*Within each group, test for significant relationships between the dependent variable (z) with each covariate (x and y) and determine whether to include both covariate or drop one out.

*After getting two parsimonious models, test them for significant differences between the two groups.


The question is, do i need to break this into two separate steps as above, or should run the ANCOVA for all models in one go? What difference will it make?
I hosted my data file here just in case it is necessary.
 A: 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).
