# Specification of linear mixed-effects model

my apologies if this is a very basic question or if similar questions have been asked before. I am relatively new to this kind of modelling and did not find anything yet that resolves my question.

I have an experiment were we count the number of soil insects, expressed as thousands of animals per square meter in our plots. We have four treatments (Control (C), Warming (W), Nutrients (N), Warming and Nutrients (WN)). The four treatments are replicated in 10 Blocks, so each block has all four treatments. Within each block two treatments received herbivore fences (I call it cage), two did not (called control, this was randomly assigned to a treatment within a block). As a result, we have 5 sets of all treatments that had a cage, 5 sets that did not.

My datafile essentially looks like this

    Block   Treatment   Cage       Number
1       C           cage       2.4
1       N           control    5.8
1       W           cage       2.3
1       WN          control    4.1
2       C           control    5.3
....    ....        ....       ....
10      WN          cage       2.7


What I want to know is what effect Treatments have on the number of animals, if caging affects that (interaction), and if there are perhaps differences between the blocks (due to environmental differences, for instance). I plan to use lme4.

Simply, I could specify it like this, with Treatment and Cage as interacting fixed factors, and Block as a random factor:

    model<-lmer(Number ~ Treatment*Cage + (1|Block), data=mydata)


But that would ignore the fact that the Cage treatment is nested within the Blocks. I mean, not all combinations of Cage and Treatment are represented in each block. Is my line of thinking here correct? What are your thoughts on how to capture the design in the model?

## 1 Answer

Based on your description, your work is reasonable to accomplish your stated goals.

What I want to know is what effect Treatments have on the number of animals, if caging affects that (interaction), and if there are perhaps differences between the blocks (due to environmental differences, for instance).

Your linear mixed model will show the effects of treatments (along with caging effects and any possible interactions with treatments). Additionally, the random effects will estimate differences between blocks.

But that would ignore the fact that the Cage treatment is nested within the Blocks. I mean, not all combinations of Cage and Treatment are represented in each block. Is my line of thinking here correct?

Although each combination of cage and treatment isn't represented in each block, the random effect for each Block is being used to account for that Block's difference so that the overall cage and treatment effects can be estimated more accurately. Since you aren't interested in estimating separate treatment and cage coefficients for each block, the combinations don't need to exist in each block.

• Thanks so much for your answer! Good to hear I was going the right direction. In the meanwhile, my data got a little more complex. We have old data from the same experiment and want to check if something changes over time. I would therefore have Climate Treatment, Cage treatment, Year as fixed factors, Block as random factor. Would you suggest doing a maximum likelihood analysis here, to pick the simplest model to explain our data? Or include all in the model and interpret effects interactions just from the model output? – user188446 Dec 22 '17 at 14:26
• So in other words, I would like to answer to following set of questions:  Does treatment have an effect on the number of animals?  Does the response to treatment differ between years?  Does Cage treatment influence the response to treatments between years? – user188446 Dec 22 '17 at 15:00