# Analysis for a design with variation among and within trees

I'm planning an experiment that involves sampling insects from four trees along each of five streets (each street being an experimental site). My focal tree species has distinct male and female individuals, and plant sex is a factor I want to investigate, so my experiment will sample equal numbers of each sex. Additionally, I want to investigate insect distribution within trees, so I've split up each tree into two sides: one facing the street and the other facing away from the street. My expected data will look like this:

Site  Tree  Sex  Side  Abundance
1     1     M    S     10
1     1     M    B     5
1     2     F    S     11
1     2     F    B     6
1     3     M    S     8
1     3     M    B     3
1     4     F    S     12
1     4     F    B     6


(For column Side, S is the side facing the street and B the side facing away from the street.)

My currently planned model has sex and side as fixed effects (including an interaction between them), and site and tree nested within site as random effects, i.e.:

y~Sex*Side+(1|Site)+(1|Site:Tree)


However, I'm unsure about this because sex varies among individual plants (a plant is either male or female), whereas side varies within individual plants (each plant has two sides). Just what kind of a model would I need to incorporate these factors?

• It might be helpful to create a reproducible example. stackoverflow.com/questions/5963269/… Commented Oct 28, 2020 at 8:08
• What is site ? Is it the same as street, so you have 5 of them ? Commented Oct 28, 2020 at 9:28
• @RobertLong Sorry about that, streets are indeed sites. I've edited the question to make this clearer. Commented Oct 28, 2020 at 10:53

y ~ Sex*Side + (1 | Site) + (1 | Site:Tree)

y ~ Sex*Side + Site*Tree

Hopefully the inferences for Sex, Side and their interaction will be similar in both models.