LMER random effects I have a question regarding a linear mixed-effects model, specifically the random effects. I have taken one core in each zone (three Zones (U,L,P)) across five transects (T1-T5) and three seasonalities (A, J, O), each core was halved into two Horizons (upper, lower) and analysed separately. My main interestes are how lipid pattern changes across Zone, Season and Horizon.
I would like to run a linear mixed effects model, but I am uncertain how to inform the model of the dependency of my halved cores. I had considered creating a "plotID" from the Zone and Transect factors as a unique identifier and add the horizon as nested within this.
This is the code I have for now:
m3 <- lmer(Bacteria ~ Zone*Season*Horizon + (1 | PlotID)+(1 | Horizon:PlotID),df)   

Is this the correct way to identify this for the model?
Thank you in advance for your help
 A: You have Horizon as both a fixed effect and a random effect. That's almost always not a good idea. It should be either fixed or random, and there are a bunch of competing considerations for when to include things as random such as:

*

*when we don't care about the fixed effect of a factor

*when a factor has a large number of levels

*when we have sampled from larger population of levels

*when we want to generalise the inferences to other levels of the factor that were not in our sample

The reasons for treating a factor as fixed are:

*

*when the research question specifically concerns inference for that factor

*when the factor has a relatively few number of levels

*when we have the entire population of levels for that factor

In this case it is fairly clear that all these considerations point towards modelling Horizon as fixed:

*

*because the research question involves inference on Horizon

*because we have only 2 levels of Horizon

*because the 2 levels of horizon are the entire population of horizons

