I have three independent variables (A, B, C) with two levels each (low, high) as well as a metric dependent variable X. I now want to test whether respondents that reported to be high on each of the three independent variables have -- on average -- higher values on X.

In order to do so I created a new grouping variable where participants that reported high on A, B, and C are classified with 1 and all other with 0. I then calculated a simple t-Test to compare the two groups.

My question: Is this the most reasonable way to answer my research question?

I was also thinking about ANOVA with contrasts but could not figure out how to do this in my case with R. I read a few online tutorials but could not come up with a solution (e.g., [1], [2]). Contrasts might especially be of interest in order to test -- in addition to my original research question -- which variable outcome (high A, high B or high C) is more important to explain outcomes in X.


data$groups <- 0
data$groups[data$A == "high" & 
             data$B == "high" &
             data$C == "high"] <- 1 

t.test(data$X ~ data$groups)

1 Answer 1


The simplest way which I can think of is the following: fit the model, $$ X_{ijk} = \beta_0 + \beta_{Al}A_l + \beta_{Bl}B_l + \beta_{Cl}C_l + \epsilon. $$ In this model, $\beta_0$ is the "reference" or baseline and corresponds to subjects which answer "high" on all A, B, C. Variables $A_l$, $B_l$ and $C_l$ are categorical and take value 1 whenever a subject answers "low". Now the fitted value for respondents A=h, B=h, C=h would be $\hat\beta_0$ while the fitted value for e.g. respondents A=h, B=l, C=h would be $\hat\beta_0 + \hat\beta_{Bl}$.

Positive values of either of $\hat\beta_{Al}, \hat\beta_{Bl}, \hat\beta_{Cl}$ would be evidence against your hypothesis and point to a combination of answers with higher $X$ value than A=h, B=h, C=h.

In a sense, this gives you more than you asked for, since it points to the combination(s) of answers with higher $X$ value than the reference A=h, B=h, C=h. But now you have to test: for that, I would suggest using a Bonferroni-type correction. If you want a significance level $\alpha$ you might test for each $\beta_{Al}, \beta_{Bl}, \beta_{Cl}$ the hypothesis $H_0: \beta=0$ versus $\beta > 0$ at the significance level $\alpha/3$ and reject if any of the betas happens to be significant.

Surely more elaborate ways exist and you were not misguided in looking at contrasts, but I think the method outlined above is correct and easy enough to implement.


And why not consider a one-way ANOVA with eight levels, each corresponding to one combination of levels of A, B and C? You would test the null of equality of all levels and, if rejected, you may resort to specialized tests based e.g. on the Studentized range to test for significance differences.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.