Fits and compares generalized linear mixed models for multiple
ecological responses and environmental predictors. The package supports
additive and temporal-interaction candidate models, AICc model selection,
likelihood-ratio tests, coefficient extraction, Nakagawa R-squared,
simulation-based diagnostics, figures, and spreadsheet exports.
Model selection follows Burnham and Anderson (2002, ISBN:9780387953649);
marginal and conditional R-squared follow Nakagawa and Schielzeth (2013)
ecoGLMM implements a reproducible candidate-model pipeline for ecological
generalized linear mixed models. It was created from the ecoacoustic analysis
workflow developed by André Felipe Carneiro dos Santos at the Graduate Program in Animal Biology,
Universidade Federal de Pernambuco (UFPE).
Version 0.1.3 fits one additive and one temporal-interaction model for each response–predictor combination, compares models using AICc, performs nested likelihood-ratio tests, extracts coefficients and Nakagawa R², runs DHARMa diagnostics, creates figures, and exports results.
install.packages("ecoGLMM_0.1.3.tar.gz", repos = NULL, type = "source")
install.packages("remotes")
remotes::install_github("andre-fcsantos/ecoGLMM")
The package includes two complementary resources:
inst/examples/ecoGLMM_template.R.After installation, open the vignette with:
vignette("getting-started", package = "ecoGLMM")
Copy the complete script to the current working directory with:
script <- system.file("examples", "ecoGLMM_template.R", package = "ecoGLMM")
file.copy(script, "ecoGLMM_template.R")
Development dependencies can also be installed manually:
install.packages(c(
"glmmTMB", "MuMIn", "performance", "DHARMa", "ggeffects", "ggplot2",
"writexl"
))
library(ecoGLMM)
index_config <- data.frame(
response = c("NDSI_beta", "AEI", "ACT", "BI", "ACI", "EVN", "ADI"),
family = c("beta", "beta", "beta", "gamma", "gaussian", "gaussian",
"gaussian"),
label = c("NDSI", "AEI", "ACT", "BI", "ACI", "EVN", "ADI")
)
analysis_data <- merge(acoustic_data, environmental_data,
by = "ponto", all.x = TRUE)
analysis_data$site <- analysis_data$ponto
analysis_data$period <- analysis_data$periodo
analysis_data <- prepare_acoustic_indices(analysis_data)
fit <- run_ecoglmm(
data = analysis_data,
config = index_config,
predictors = c("forest", "urban", "proximity", "watercourses"),
period = "period",
group = "site",
period_levels = c("T-0", "T-1", "T-2", "T-3", "T-4")
)
fit
summary(fit)
diagnostics <- diagnose_models(fit, nsim = 1000, seed = 123)
plot_effect(fit, "NDSI_beta")
plot_selection(fit, "NDSI_beta", metric = "delta")
plot_coefficients(fit)
export_ecoglmm(fit, "results", diagnostics = diagnostics)
The columns R2_marginal and R2_conditional are calculated with
MuMIn::r.squaredGLMM() to reproduce the original analytical pipeline.
The alternative results from performance::r2_nakagawa() are retained in
columns ending in _performance.
The package is under active development. Please report problems through the GitHub issue tracker.