plot_MLM3: Plotting the interaction of a MLM3 model

View source: R/plot_MLM3.r

plot_MLM3R Documentation

Plotting the interaction of a MLM3 model

Description

plot_MLM3 plots the trait-environment interaction of a fitted MLM3 object.

Usage

plot_MLM3(
  MLM3,
  verbose = FALSE,
  title = paste("site and species effects (fixed + random) against env and trait")
)

Arguments

MLM3

the fitted MLM3 object, created by glmer (lme4) or glmmTMB.

verbose

logical; default FALSE. If TRUE, a summary of the MLM3 object is printed.

title

character text to adapt the main title.

Details

The code uses libraries ggplot2 and dplyr. The trait and environment variable names in the MLM3 model must be 'trait' and 'env' as in the example (as they are hard coded)

Value

A list of printable and modifiable objects of class ggplot2.

References

ter Braak (2019) New robust weighted averaging- and model-based methods for assessing trait-environment relationships. Methods in Ecology and Evolution (https://doi.org/10.1111/2041-210X.13278)

See Also

expand4glmm.

Examples

## Not run: 
data("Revisit")
formula.MLM3 <- y ~  env*trait  + (1 + env|species) + (1 + trait| site)
MLM3 <- glmmTMB(formula.MLM3, family = betabinomial,  data=Revisit)
plot_MLM3(MLM3)

## End(Not run)

CajoterBraak/TraitEnvMLMWA documentation built on Jan. 25, 2023, 7:36 p.m.