I have conducted an experiment measuring individual sizes as a function of two categorical variables (A and B), each with three levels (1, 2, 3). The combination A3:B3 is a control group. This experiment was conducted across two replicates on separate individuals (i.e. no repeated measures). However, design constraints meant that these replicates were performed across three "blocks", as shown in the table below.

experimental design

As you can see, the control group appears in all blocks, but the other treatments are split across them, so the design is not fully factorial. I would like to test whether there is an effect on size caused by each variable and their interaction, both relative to each other and the control across all blocks. However, I would also like to test if there is an effect of block within each group, e.g. are A1:B1 individuals different in size in block 1 compared to block 2? Visualising the data suggest that this could be the case.

Using ANOVA in R I have set up a 3-way linear model as follows:

model <- lm(Size ~ A*B*Block)
Anova(model, type="II")

However, for the interactions B:Block and A:B:Block this model returns zero degrees of freedom. I believe this is due to factor level combinations with zero observations, i.e. because not all combinations appear in all blocks. I'm also concerned that I do not explicitly want to test the effect of block as a stand-alone variable, again because not all treatment combinations appear in all blocks (and therefore I'd expect to see differences in sizes across the blocks).

I would like help on how best to construct this model, and also how to run appropriate post-hoc tests. Running TukeyHSD(x=model, conf.level=0.95) results in a large number of NA contrasts due to missing factor combinations. How can I better set up these tests so that only comparisons I am interested in are performed?


1 Answer 1


You are correct that since not all combination appear in your data-set you will not be able to test certain interactions and contrasts. I am afraid there is no way round this with the constraints you had.

Do you really want to add the three-way interaction to your model? It is up to you but higher-order interactions can be hard to interpret especially when you have missing cells in the design. I would have included the two-ways only. (A+B+Block)^2 should do it. Note that if you fit a model with just the main effects (A + B + Block) there is still one effect which cannot be estimated since A3 and B3 are aliased, they only ever occur together so cannot be separated. Moving on to including the two-ways we find more problems. There is only one estimable effect for the A B interaction because none of A2B3, A3B2 and A3B3 are separately estimable because of the way they co--occur. There are also problems with the interactions with Block

You should not try to remove the main effect of Block. Search for the concept of marginality for explanations of why or look at this Q&A Including the interaction but not the main effects in a model for some discussion.

  • $\begingroup$ What I'd like to know is whether there was variation within treatment combinations (A1:B1, A2:B1, and so on) across blocks. I'm not sure how to do this without including the 3-way interaction. Would your proposed design allow me to capture this effect? $\endgroup$
    – allhands
    Commented Jan 20, 2019 at 16:32
  • 1
    $\begingroup$ The three-way tells you that the interaction between A and B differs between levels of Block which is not the level of detail you seem to want. Since quite a lot of the A by B interaction cannot be estimated since you only have five of the possible nine combinations it will only apply to that part of the A by B interaction. $\endgroup$
    – mdewey
    Commented Jan 20, 2019 at 16:46
  • $\begingroup$ Understood. Looking at the model you have suggested the B:Block interaction still has zero df (because of missing combinations in block 3), so this is one interaction that I cannot test? $\endgroup$
    – allhands
    Commented Jan 21, 2019 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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