Introduction: *Generalized linear mixed-effects models*
(GLMMs) are an extension of linear mixed-effects models (**Module
M.5**) used when there is clustering (i.e., nested data
structures) or non-independence (i.e., repeated measurements) among
observations and the response variable is not normally distributed. As
generalized linear models (**Module M. 6**), GLMMs consider
distributions from an exponential family (e.g., binomial, Poisson) but
can also incorporate random effects.

In this module, you will expand your skills on linear models
(**Modules M.4**) to GLMMs while testing associations
between Cayo Santiago rhesus macaque male social dispersal and
population density.

**Upon completion of this module, you will be able
to:**

- Center predictor variables;
- Test correlations among predictor variables;
- Fit generalized linear mixed-effects models;
- Interpret model output;
- Plot model predictions.

**References:**

**Extra training:**

**Associated literature:**

##
**Expand for R Notation and functions index**

**Notation:**

**[]** for subsets by columns;
**:** for generating regular sequences;
**$** for accessing or creating a variable in a
dataset.

**Commands:**

Base R:

**as.numeric()** for changing variable class to
numeric;
**cor()** for testing correlations between
variables;
**exp()** for exponential function;
**install.packages()** for installing packages;
**names()** for extracting/changing column names;
**summary()** for model output.

lmer4:

**glmer()** for fitting generalized linear
mixed-effects models.

MuMIn:

**model.sel()** for model selection table.

sjPlot:

**plot_model( )** for plotting model effects.

tidyverse:

**mutate()** for modifying and creating new
columns.

### Testing associations between social dispersal and population
density

Rhesus macaque populations are socially organized into multi-male,
multi-female social groups (Fig 1). At Cayo Santiago, these groups
formed naturally and most females remain in their natal groups their
entire life. However, males migrate out of their natal social group at
puberty (social dispersal; Fig 1). This behavior likely evolved to avoid
inbreeding. Although natal social group dispersal is expected,
individual males show high variability in the timing of migration. One
important factor driving annual social dispersal in males could be high
population density due to increased competition. As Cayo Santiago is an
15.2 ha island, metrics of population density are accurately
estimated.