Use the following steps to analyze a GLMM:
- We will use the OrchardSprays dataset, which is included in R. It contains data for an experiment to assess the potency of various constituents of orchard sprays in repelling honeybees, using a Latin square design. The target variable will be a count variable, and the treatment effect will be treatment.rowpos and colpos should ideally be assumed to be random effects. First, we load the libraries:
library(lme4) library(emmeans) library(MASS) set.seed(10)
- Let's ignore the random effects and fit this model using the regular GLM framework. Note that we specify family=poisson():
fixed_std_model = glm(decrease ~ treatment,family=poisson(),data=OrchardSprays) summary(fixed_std_model ...