# ANOVA vs. T-test for two groups

I'm conducting an exercise intervention with office workers. The intervention will include Yoga classes and one to one coaching. I will be looking at the effects of the intervention on two dependent variables: 1. walking 2. the amount of time workers spend standing.

I have a control group and a treatment group. Walking data will be measured using pedometers, and standing time will be measured using a self-report questionnaire.

Am I right in thinking that a two-way unrelated ANOVA is needed to test for difference between the groups?

• alternatively, you could inverse the relation and model the independent group variable as a function of the dependent variables. This is especially interesting with the multivariate type of dependent data if it has some structure, e.g. clusters. Plotting the dependent variables in a scatter plot with different colors for the groups, in order to see what kind of distribution you are dealing with, would at least not hurt. – Sextus Empiricus Aug 15 '19 at 23:10

Usually, we use ANOVA if there are more than two groups. But you also can use ANOVA with two groups, as you describe. In that case ANOVA will result in the same conclusion as an Student's t test, where $$t^{2} = F$$. See this R code:

# Makes example reproducible
set.seed(1)
# define sample size
n <- 100
# generate a group
group <- sample(0:1, n, replace= TRUE)
# generate a dependent variable that varies between groups
y <- rnorm(n) + group
# run a t test (variance must be assumed as being equel, otherwise the results do differ to those from ANOVA)
t.test(y ~ group, var.equal= TRUE)
# run ANOVA
summary(aov(y ~ group))
# F= 32.97
# See if t^2= F
t.test(y ~ group, var.equal= TRUE)\$statistic**2
# t^2= 32.97


This is only true for the Student's t test where equal variances are assumed, while the results of a Welch t test differ to those of ANOVA. Further, since you have multiple dependent variables, maybe you want to have a look at a MANOVA, although I do not know whether this makes sense in your situation. Regardless what analysis you use you should check the assumptions.

If you do not have R you can simply put the code here.

It would be sensible to measure the amount of time your participants spend walking and standing before you carry out the treatment. You might even want to consider allocating them to control and treatment groups on this basis, so you can avoid accidentally using control and treatment groups that were different before you even started the treatment. If you don't measure beforehand, and especially if your study size isn't very large, it will be difficult for you to rule out the chance that any difference between your groups was just an accident of the more active people being assigned at random to to the treatment group, for example. You want control and treatment groups that are the same as each other before you start the treatment, in every way as far as possible.

Then you might want to look into using a repeated-measures ANOVA, so you can use the data from before and after treatment in one analysis.

Also, you will need to check whether your response data meet the assumptions required for the ANOVA, because if they do not then any conclusions may well be invalid. It is possible that your data will not meet the assumptions - for example, the distribution of values for time spent standing could be quite skewed. Consider transformation or an alternative statistical test if your residuals plots show up a problem.