I am using lme4 to create a mixed model for my data. I am looking at the effect of land cover on soil properties at three depths, for example, carbon concentration.
I have identified my fixed factors as land cover and soil depth and have a random effect of site. I also have tree biomass as a "random" effect which may affect the response, however, I am aware that random effects must be categorical therefore I should specify this as a covariate. I am unsure where I would put this in the R code though.
I've seen examples as so:
model <- lmer(carbon ~ land_cover + depth + biomass + (1 | site), data = carbon, REML = FALSE).
and others which suggest it should be incorporated into the random effect as
(biomass | site), possibly:
model <- lmer(carbon ~ land_cover + depth + (biomass | site), data = carbon, REML = FALSE)
The first code to me seems as though this would specify biomass as a fixed factor, which it is not, however, the latter produces an error for me. I think this might be to do with missing data in my file though, so if I sort this out, would the second code be correct?