Data and code from: Unravelling the drivers of island species richness in tropical savannas
Data files
Apr 02, 2026 version files 1.69 MB
-
00_Script_Sys_Config_Packages.R
3.66 KB
-
01_Script_Data_Processing.R
45.27 KB
-
02_Script_Mews_et_al_2026_JoE.R
261.96 KB
-
03_BRMS_comparison_loo.R
12.27 KB
-
04_Script_BSEM_outputs.R
17.06 KB
-
05_Script_DAG_BSEM.R
11.32 KB
-
06_Script_BSEM_outputs_Metacommunity_v2.R
23.05 KB
-
07_Script_DAG_BSEM_Metacommunity.R
9.64 KB
-
Data_Package_Metadata.pdf
208.14 KB
-
Ecological_Data.xlsx
195.16 KB
-
Herbs_Landscape_scale.csv
3.56 KB
-
MODELING-DATA.xlsx
865.70 KB
-
README.md
26.76 KB
-
Termites_Landscape_scale.csv
4.02 KB
-
Trees_Landscape_scale.csv
3.63 KB
Abstract
Despite their ecological and conservation relevance and their potential to advance our understanding of species–habitat relationships, natural island habitats in seasonal tropical terrestrial systems remain inadequately explored. In particular, the processes governing species diversity in these environments are still poorly understood. Here, we examine how island size, geographical isolation, and habitat heterogeneity and availability affect species richness in campos de murundus—literally “fields of earth mounds”—a distinctive ecosystem within South American tropical savannas. Our study targets three major biological groups that dominate and structure murundu communities—trees, herbs, and termites—and is based on an extensive inventory of these taxa across 373 murundu islands sampled within eleven 1-ha plots distributed throughout the vast seasonal floodplains of east-central Brazil. Bayesian mixed-effects models indicated that tree and herb species richness increased with murundu island size, consistent with predictions from island biogeography theory. By contrast, neither isolation nor environmental heterogeneity or habitat availability exerted detectable effects on the species richness of trees, herbs, or termites at the murundu island scale. At the landscape scale, tree alpha diversity was largely driven by metacommunity attributes directly associated with landscape habitat amount, increasing with total abundance and declining with beta diversity. In contrast, termite species richness was weakly explained by the environmental variables considered, showing no clear association with island size, isolation, or environmental heterogeneity. Overall, island size accounted for most of the explained variation in plant species richness, whereas termite assemblages were more strongly associated with spatial eigenvectors at intermediate and fine spatial scales. We conclude that, for woody and non-woody plant communities in hyperseasonal savannas, island species richness is primarily determined by murundu island size and habitat amount, with little evidence of dispersal limitation or strong influences of environmental heterogeneity. At the landscape scale, tree species richness did not respond directly to habitat amount; however, total abundance and gamma diversity increased with habitat amount, which in turn resulted in higher alpha diversity. Beta diversity appears to be more closely linked to the nested composition of species on small islands within larger ones than to spatial turnover. In contrast, termite communities are only weakly structured by the predictors tested, suggesting that stochastic processes, local habitat constraints, and species-specific nesting behaviours play a more prominent role.
Dataset DOI: 10.5061/dryad.612jm64kr
Description of the data and file structure
In this study, we investigated the predictors of species richness of three biological groups (trees, herbs, and termites) in insular environments of tropical hyperseasonal savannas, namely campos de murundus (literally “earth mound fields”). Data were collected from eleven discontinuous plots of 1 hectare each, covering a total sampled area of 11 hectares. Within these plots, 373 murundus (earth mounds) were mapped and sampled. For each murundu, all vascular plants were recorded and identified, excluding grasses and sedges. Plants were grouped into two categories based on stem diameter measured 30 cm above the ground: (i) trees (trees, shrubs, palms, and lianas with a diameter ≥ 3 cm) and (ii) herbs (sub-shrubs and herbs with a diameter < 3 cm). Tree data were recorded as species abundances, while herb data were recorded as presence–absence. Termites were sampled in each murundu using two methods: collection from nests and from soil. Nest sampling involved collecting fragments from different positions and heights, followed by manual collection of termites for a fixed time period. Soil samples were also taken and processed using the same collection procedure. All termite specimens were preserved and later identified in the laboratory, and termite data were recorded as species abundances. Environmental data included the murundu area, degree of isolation, and habitat heterogeneity. The Murundu area was estimated using geometric modelling. Isolation was measured as distances to neighbouring and larger murundus. Habitat heterogeneity was estimated using murundu height and volume for plants, and height combined with nest number for termites.
Dataset overview
This dataset contains the data and code used in Mews et al. (accepted for publication in the Journal of Ecology). The data were collected in campos de murundus (earth mound fields), a hyperseasonal tropical savanna formation in central Brazil, where vegetation occurs on discrete earth mounds that function as habitat islands within seasonally flooded grasslands. Fieldwork was conducted in the Araguaia State Park (ASP), north-eastern Mato Grosso, central Brazil (11°43′S–12°38′S; 50°43′W–50°49′W). The park covers approximately 223,000 ha and is part of one of the largest continuous wetlands in Brazil.
Eleven discontinuous plots of 1 ha (100 × 100 m) were established, totalling 11 ha. Within these plots, 373 individual murundus were mapped and sampled. Three biological groups were surveyed: trees (woody plants, including trees, shrubs, palms, and lianas, with diameter at 30 cm above ground (D30) ≥ 3 cm); herbs (sub-shrubs and herbs with D30 < 3 cm); and termites (sampled from nests and soil within each murundu). From the biological matrices, species richness and abundance metrics were derived at both murundu and landscape scales.
In addition to the biological and environmental data, this repository includes all R scripts used to process the data, construct spatial and environmental predictors, perform statistical and Bayesian analyses, and generate figures. The scripts are organised sequentially and documented to describe their structure, purpose and execution order, ensuring full transparency and reproducibility of the analytical workflow.
The dataset includes two Excel files for analyses at the local (murundu) scale (Ecological_Data.xlsx and MODELING-DATA.xlsx) and three .csv files for analyses at the landscape scale (Tree_Landscape_scale.csv, Herbs_Landscape_scale.csv and Termites_Landscape_scale.csv), separated by biological group (trees, herbs and termites). A dedicated PDF document entitled Data_Package_Metadata provides the full names of all variables together with comprehensive metadata, including detailed descriptions, definitions, units, and data processing information. Ecological_Data.xlsx is the master spreadsheet containing the original local-scale data. MODELING-DATA.xlsx is derived from Ecological_Data.xlsx and includes spatial filters, with all variables already standardised and formatted for the statistical analyses. All data are provided in standard formats (.csv, .xlsx) to maximise interoperability and reusability.
Files and variables
File: Ecological_Data.xlsx
Description: An .xlsx file comprising 53 variables in 373 rows, corresponding to individual murundus sampled across eleven plots. The file contains two worksheets: one with the ecological data used in the analyses (Ecological_data) and a second metadata worksheet (Metadata) providing detailed explanations of all variables, including their definitions. Cells containing “NA” indicate missing data. These values occur primarily for termites and herbaceous plants, as in many murundus, the combined effects of seasonal flooding dynamics and recurrent fire events lead to local extinction of these groups, preventing their recording at the time of sampling.
Variables:
- ID.murundu: Unique identifier for each murundu.
- Plots: Plot code where the murundu is located (CM1–CM11).
- META.code: Metacommunity identification code.
- X: Longitude coordinate of the murundu centroid (decimal degrees).
- Y: Latitude coordinate of the murundu centroid (decimal degrees).
- Area_Mur_m2: Murundu area (m²).
- Vol_Mur_m3: Murundu volume (m³).
- Distance_mur_near: Distance to the nearest neighbouring murundu (metres).
- Distance_mur_big_near: Distance to the nearest large murundu (metres).
- Height_Mur: Height of the murundu relative to the surrounding flatland (metres).
- N_termite_nests: Number of termite nests present on the murundu.
- N_total: Total number of plants recorded.
- N_living: Number of living plants.
- N_died: Number of dead plants.
- N_Spp_living: Number of living plant species.
- BasalArea_plants: Total basal area of plants (cm²).
- MeanHeight_plants: Mean height of plants (metres).
- MeanDiam_plants: Mean plant diameter (cm).
- Vol_plants: Total plant volume (m³).
- CobHerbaceous: Percentage cover of herbaceous vegetation.
- Abund.Trees: Total abundance of tree individuals.
- Abund.HERBs: Total abundance of herb individuals.
- Abund.termites: Total abundance of termite individuals.
- Richness.Trees: Observed species richness of trees.
- Richness.HERBs: Observed species richness of herbs.
- Richness.termites: Observed species richness of termites.
- Heter.veg: Vegetation habitat heterogeneity index.
- Heter.termite: Termite habitat heterogeneity index.
- Richness_TD_obs.Trees: Observed taxonomic diversity richness for trees.
- Richness_TD_asy.Trees: Asymptotic taxonomic diversity richness for trees.
- Shannon_TD_obs.Trees: Observed Shannon diversity index for trees.
- Shannon_TD_asy.Trees: Asymptotic Shannon diversity index for trees.
- Simpson_TD_obs.Trees: Observed Simpson diversity index for trees.
- Simpson_TD_asy.Trees: Asymptotic Simpson diversity index for trees.
- SC.Trees: Sample coverage for trees.
- Richness_TD_obs.Herbs: Observed taxonomic diversity richness for herbs.
- Richness_TD_asy.Herbs: Asymptotic taxonomic diversity richness for herbs.
- Shannon_TD_obs.Herbs: Observed Shannon diversity index for herbs.
- Shannon_TD_asy.Herbs: Asymptotic Shannon diversity index for herbs.
- Simpson_TD_obs.Herbs: Observed Simpson diversity index for herbs.
- Simpson_TD_asy.Herbs: Asymptotic Simpson diversity index for herbs.
- SC.Herbs: Sample coverage for herbs.
- Pielou.J.Termite: Pielou’s evenness index for termites.
- qTD.Rich.Termite: Hill number (q = 0; richness) for termites.
- Richness_TD_obs.Termite: Observed taxonomic diversity richness for termites.
- Richness_TD_asy.Termite: Asymptotic taxonomic diversity richness for termites.
- qTD.Shan.Termite: Hill number (q = 1; Shannon diversity) for termites.
- Shannon_TD_obs.Termite: Observed Shannon diversity index for termites.
- Shannon_TD_asy.Termite: Asymptotic Shannon diversity index for termites.
- qTD.Simp.Termite: Hill number (q = 2; Simpson diversity) for termites.
- Simpson_TD_obs.Termite: Observed Simpson diversity index for termites.
- Simpson_TD_asy.Termite: Asymptotic Simpson diversity index for termites.
- SC.Termite: Sample coverage for termites.
File: MODELING-DATA.xlsx
Description: An .xlsx file containing ecological, spatial, and modelling variables for 373 individual murundus sampled across eleven plots. The file comprises 447 variables, integrating: (i) raw spatial and structural attributes of murundus; (ii) vegetation and termite abundance and diversity metrics; (iii) taxonomic diversity indices (Hill numbers, Shannon, Simpson, Pielou, and sample coverage) for trees, herbs, and termites; and (iv) a large set of spatial eigenfunctions (MEMs – Moran’s Eigenvector Maps) generated separately for each plot and used for spatial modelling and control of spatial autocorrelation. Each row corresponds to a single murundu (sampling unit). Cells containing “NA” indicate missing data. These values occur primarily for termites and herbaceous plants, as in many murundus, the combined effects of seasonal flooding dynamics and recurrent fire events lead to local extinction of these groups, preventing their recording at the time of sampling.
Primary variables:
- ID.murundu: Unique identifier for each murundu.
- Plots: Plot code where the murundu is located (CM1–CM11).
- META.code: Metacommunity identification code.
- Area_Mur_m2: Murundu area (m²).
- Vol_Mur_m3: Murundu volume (m³).
- Distance_mur_near: Distance to the nearest neighbouring murundu (metres).
- Distance_mur_big_near: Distance to the nearest large murundu (metres).
- Height_Mur: Height of the murundu relative to the surrounding flatland (metres).
- N_termite_nests: Number of termite nests present on the murundu.
- N_total: Total number of plants recorded.
- N_living: Number of living plants.
- N_died: Number of dead plants.
- N_Spp_living: Number of living plant species.
- BasalArea_plants: Total basal area of plants (cm²).
- MeanHeight_plants: Mean height of plants (metres).
- MeanDiam_plants: Mean plant diameter (cm).
- Vol_plants: Total plant volume (m³).
- CobHerbaceous: Percentage cover of herbaceous vegetation.
- Abund.Trees: Total abundance of tree individuals.
- Abund.HERBs: Total abundance of herb individuals.
- Abund.termites: Total abundance of termite individuals.
- Richness.Trees: Observed species richness of trees.
- Richness.HERBs: Observed species richness of herbs.
- Richness.termites: Observed species richness of termites.
- Heter.veg: Vegetation habitat heterogeneity index.
- Heter.termite: Termite habitat heterogeneity index.
- Pielou.J.Trees: Pielou’s evenness index.
- qTD.Rich.Trees: Hill number (q = 0; richness).
- Richness_TD_obs.Trees: Observed taxonomic diversity richness for trees.
- Richness_TD_asy.Trees: Asymptotic taxonomic diversity richness for trees.
- qTD.Shan.Trees: Hill number (q = 1; Shannon diversity).
- Shannon_TD_obs.Trees: Observed Shannon diversity index for trees.
- Shannon_TD_asy.Trees: Asymptotic Shannon diversity index for trees.
- qTD.Simp.Trees: Hill number (q = 2; Simpson diversity).
- Simpson_TD_obs.Trees: Observed Simpson diversity index for trees.
- Simpson_TD_asy.Trees: Asymptotic Simpson diversity index for trees.
- SC.Trees: Sample coverage for trees.
- Pielou.J.Herbs: Pielou’s evenness index.
- qTD.Rich.Herbs: Hill number (q = 0; richness).
- Richness_TD_obs.Herbs: Observed taxonomic diversity richness for herbs.
- Richness_TD_asy.Herbs: Asymptotic taxonomic diversity richness for herbs.
- qTD.Shan.Herbs: Hill number (q = 1; Shannon diversity).
- Shannon_TD_obs.Herbs: Observed Shannon diversity index for herbs.
- Shannon_TD_asy.Herbs: Asymptotic Shannon diversity index for herbs.
- qTD.Simp.Herbs: Hill number (q = 2; Simpson diversity).
- Simpson_TD_obs.Herbs: Observed Simpson diversity index for herbs.
- Simpson_TD_asy.Herbs: Asymptotic Simpson diversity index for herbs.
- SC.Herbs: Sample coverage for herbs.
- Pielou.J.Termite: Pielou’s evenness index for termites.
- qTD.Rich.Termite: Hill number (q = 0; richness) for termites.
- Richness_TD_obs.Termite: Observed taxonomic diversity richness for termites.
- Richness_TD_asy.Termite: Asymptotic taxonomic diversity richness for termites.
- qTD.Shan.Termite: Hill number (q = 1; Shannon diversity) for termites.
- Shannon_TD_obs.Termite: Observed Shannon diversity index for termites.
- Shannon_TD_asy.Termite: Asymptotic Shannon diversity index for termites.
- qTD.Simp.Termite: Hill number (q = 2; Simpson diversity) for termites.
- Simpson_TD_obs.Termite: Observed Simpson diversity index for termites.
- Simpson_TD_asy.Termite: Asymptotic Simpson diversity index for termites.
- SC.Termite: Sample coverage for termites.
- X: Longitude coordinate of the murundu centroid (decimal degrees).
- Y: Latitude coordinate of the murundu centroid (decimal degrees).
Moran’s Eigenvector Maps (MEMs)
MEM_PlotCM*_n: Moran’s Eigenvector Maps (MEM) generated separately for each plot (CM1–CM11), used to model and control spatial autocorrelation across multiple spatial scales. A total of 362 MEM variables are included in the dataset, and all share the same conceptual definition, differing only in their eigenvector order and associated spatial scale of variation represented within each plot.
Derived, transformed, and centred variables
Variables prefixed with log_ represent log-transformed predictors, and variables suffixed with _center represent centred versions used in modelling (e.g., log_Area, log_Heter_veg_center, log_Dist_Big_center).
- Dist_near: Distance to nearest neighbouring murundu (m).
- Dist_near_large: Distance to nearest large neighbouring murundu (m).
- Murundu_height: Height of the murundu (m).
- N_nests: Number of termite nests.
- log_Vol_Mur: Log-transformed murundu volume.
- N_dead_trees: Number of dead tree individuals.
- N_trees: Total number of tree individuals.
- S_live_trees: Species richness of living trees.
- N_live_trees: Number of living tree individuals.
- Basal_area_trees: Basal area of trees.
- D_trees: Mean tree diameter.
- Herbs_cover: Herbaceous vegetation cover.
- Vol_trees: Estimated tree volume.
- Heter_termite_center: Termite heterogeneity index centred for modelling.
- Heter_veg_center: Vegetation heterogeneity index centred for modelling.
- log_Area: Log-transformed murundu area.
- log_Heter_veg: Log-transformed vegetation heterogeneity index.
- log_Heter_termite: Log-transformed termite heterogeneity index.
- log_Dist_large: Log-transformed distance to nearest large murundu.
- log_Vol_Mur_center: Centred log-transformed murundu volume.
- log_Area_center: Centred log-transformed murundu area.
- log_Heter_veg_center: Centred log-transformed vegetation heterogeneity.
- log_Heter_termite_center: Centred log-transformed termite heterogeneity.
- log_Dist_large_center: Centred log-transformed distance to nearest large murundu.
Files: Landscape-scale data
The following three files are provided as comma-separated values (.csv) spreadsheets containing landscape-scale predictors and diversity metrics for each biological group analysed. Each file comprises 11 rows (corresponding to plots) and a defined set of variables, as detailed below.
1. Herbs_Landscape_scale.csv
This file contains 16 variables organised in 11 rows.
2. Termites_Landscape_scale.csv
This file contains 18 variables organised in 11 rows.
3. Trees_Landscape_scale.csv
This file contains 17 variables organised in 11 rows.
Each row corresponds to a single sampling plot. Columns include spatial configuration metrics, habitat amount descriptors, and diversity-related response variables specific to each taxonomic group.
The full names of all variables, together with their detailed definitions, units, transformations (where applicable), and ecological interpretation, are provided in the metadata file entitled “Data_Package_Metadata.pdf”. Users should consult this document to ensure correct interpretation and reuse of the data.
Code/Software
Data files can be viewed using any spreadsheet software compatible with Microsoft Excel formats. All statistical analyses and figure preparation were conducted in R software (R Core Team, 2025*, version 4.5.0).
Reference:
R Core Team. (2025). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. Retrieved from https://www.R-project.org/
Structure of the analytical workflow
The repository is organised into eight scripts, which must be executed sequentially in the order indicated by their prefixes. The scripts are organised following FAIR principles (Findable, Accessible, Interoperable, Reusable) and implement a comprehensive analytical workflow including environmental configuration, data processing, statistical modelling (frequentist and Bayesian), spatial analysis, and visualisation.
00_Script_Sys_Config_Packages.R – environment setup
01_Script_Data_Processing.R – data preparation
02_Script_Mews_et_al_2026_JoE.R – main analyses
03_BRMS_comparison_loo.R – model comparison
04_Script_BSEM_outputs.R – BSEM effect tabulation
05_Script_DAG_BSEM.R – BSEM visualisation
06_Script_BSEM_outputs_Metacommunity_v2.R – metacommunity BSEM tabulation
07_Script_DAG_BSEM_Metacommunity.R – metacommunity BSEM visualisation
Each script is described in detail below.
Script 00: 00_Script_Sys_Config_Packages.R
Purpose
This script establishes the reproducible computational environment used throughout the project. It provides the technical foundation required for all subsequent analyses.
Specifically, it:
- creates a project-specific R environment using renv;
- manages package dependencies with explicit version control;
- defines CRAN repositories and session settings;
- loads all libraries required for data manipulation, ecological analyses, spatial statistics, modelling, diagnostics, and visualisation.
Reproducibility framework
Reproducibility is ensured through:
- dependency isolation and version locking via renv;
- snapshotting of the full computational state;
- consistent package retrieval across systems and time.
For details on renv, see:
https://rstudio.github.io/renv/
For the FAIR principles, see:
Wilkinson et al. (2016). Scientific Data, 3, 160018.
https://doi.org/10.1038/sdata.2016.18
Execution notes
This script must be run first, before any other script in the repository.
Script 01: 01_Script_Data_Processing.R
Purpose
This script performs all data ingestion, cleaning, transformation, and derivation of analytical variables required for modelling species richness and abundance.
It integrates biotic, spatial, and environmental datasets collected from 373 murundu islands across eleven 1-ha plots in the Araguaia State Park (central Brazil).
Main operations
The script:
- imports species composition matrices for trees, herbs and termites;
- computes per-murundu:
- total abundance (for trees and termites),
- observed species richness;
- constructs habitat heterogeneity metrics appropriate to each taxonomic group;
- generates spatial filters (MEMs) from murundu centroid coordinates, calculated separately for each plot;
- centres and transforms predictor variables to improve model stability;
- assembles modelling-ready datasets used by subsequent scripts.
Required input files
All files are accessed using relative paths (via here::here()), including:
- FAIR_data/Ecologica-Data.csv – main environmental dataset
- FAIR_data/Trees_comp.csv – tree species composition
- FAIR_data/Herbaceas_comp.csv – herb species composition
- FAIR_data/Termites_comp.csv – termite species composition
- FAIR_data/Coordenadas.csv – spatial coordinates of murundus
- FAIR_data/*_Landscape_scale.csv – landscape-scale datasets for each taxon
Outputs
This script primarily generates in-memory R objects, including:
- Processed dataframes with diversity metrics (richness, abundance, asymptotic estimates, sample coverage)
- Spatial MEMs matrices nested within plots
- Figure S6 (density plots of metacommunity abundance and richness)
- Data ready for assemblage-scale and metacommunity-scale modelling
Script 02: 02_Script_Mews_et_al_2026_JoE.R
Purpose
This script implements the core statistical analyses reported in the manuscript (GLMMs, Bayesian regression (brms), and Bayesian Structural Equation Models (BSEM)). It fits models that quantify how island-scale and landscape-scale predictors influence species richness and abundance of trees, herbs, and termites.
Main analytical components
Island-scale analyses
For each taxonomic group, the script fits models assessing the effects of:
- murundu area;
- isolation metrics (nearest neighbour and nearest large murundu);
- habitat heterogeneity;
- spatial structure (MEM spatial filters).
Model types include:
- generalised linear models;
- generalised linear mixed-effects models;
- Bayesian hierarchical models.
Landscape-scale analyses
At the plot level, the script evaluates predictions of the Habitat Amount Hypothesis, modelling total abundance and total species richness as functions of:
- total murundu area;
- number of murundus (proxy for metacommunity size);
- mean inter-murundu distance.
Bayesian inference
Bayesian models are fitted using brms, with:
- appropriate likelihoods for count data;
- weakly informative priors;
- explicit control of sampling parameters;
- extraction of posterior summaries and predictions.
Outputs
The script produces:
- fitted model objects;
- posterior summaries and predictions;
- diagnostic objects;
- data frames and figures used directly in the manuscript.
Script 03: 03_BRMS_comparison_loo.R
Purpose
This script performs formal Bayesian model comparison using leave-one-out cross-validation (LOO) to evaluate the out-of-sample predictive performance of competing models.
Methodological framework
Model comparison is based on PSIS-LOO, providing:
- estimates of expected log predictive density (ELPD);
- differences in predictive performance between models (ΔELPD);
- associated uncertainty estimates;
- diagnostics based on Pareto k values.
Key references:
Vehtari et al. (2017). Statistics and Computing, 27, 1413–1432.
https://doi.org/10.1007/s11222-016-9696-4
Outputs
This script generates:
- LOO objects for each Bayesian model;
- model comparison tables;
- diagnostic summaries supporting model selection.
These results provide a principled and reproducible basis for choosing among alternative ecological hypotheses.
Script 04: 04_Script_BSEM_outputs.R
Purpose:
Extracts, calculates, and tabulates direct, indirect, and total effects from Bayesian Structural Equation Models (BSEM) fitted with brms.
Main analytical components:
- Extracts model structure directly from the brms formula object
- Retrieves posterior samples for each path coefficient
- Computes indirect effects via mediators and total effects
- Summarises effects with posterior mean, SD, and 95% credible intervals
- Identifies statistically significant effects (credible interval does not cross zero)
Main operations:
- extrair_estrutura_bsem(): parses model formulas to identify predictors, mediators, and final response
- extrair_coeficiente(): extracts posterior samples for a given path
- calcular_efeitos_preditor(): computes direct, indirect, and total effects for a predictor
- gerar_tabela_completa(): assembles a comprehensive results table
Outputs:
- CSV tables (e.g., BSEM_TREE_efeitos_habitat_amount.csv) saved in Tabelas_finais/
- Console summary of significant effects
Script 05: 05_Script_DAG_BSEM.R
Purpose:
Generates a directed acyclic graph (DAG) visualising path coefficients from a Bayesian Structural Equation Model.
Main operations:
- Constructs nodes (predictors, mediators, response) and edges (paths) from model structure
- Positions nodes adaptively based on the number of predictors and mediators
- Colours edges according to significance and sign of effect:
- Black: positive significant
- Red: negative significant
- Grey: non‑significant
- Uses dashed lines for non‑significant paths
- Edge thickness reflects effect magnitude
Outputs:
- PNG file of the path diagram (e.g., diagrama_caminhos_landscape.png)
Script 06: 06_Script_BSEM_outputs_Metacommunity_v2.R
Purpose:
Specialised version of Script 04 for metacommunity‑focused BSEMs, where mediators may have reciprocal relationships.
Main analytical components:
Identical to Script 04, but includes additional functionality to handle paths between mediators (e.g., abundance influencing beta diversity, beta influencing gamma diversity).
Main operations:
- Detects and extracts coefficients for mediator‑to‑mediator paths
- Includes these paths in the calculation of indirect effects
- Outputs a complete table with all direct, indirect, and total effects
Outputs:
- CSV tables (e.g., BSEM_TREE_efeitos_metacommunity.csv) saved in Tabelas_finais/
- Console summary of significant effects
Script 07: 07_Script_DAG_BSEM_Metacommunity.R
Purpose:
Specialised version of Script 05 for metacommunity‑focused BSEMs, visualising paths that include relationships among mediators.
Main operations:
- Builds a graph including predictor‑to‑mediator, mediator‑to‑mediator, and mediator‑to‑response edges
- Applies the same visual encoding as Script 05 (colour for sign/significance, thickness for magnitude)
- Positions nodes with mediators arranged horizontally between predictors and the final response
Outputs:
- PNG file of the path diagram (e.g., diagrama_caminhos_metacommunity.png)
Dependencies
All required R packages are managed via renv. To restore the environment, run:
r
renv::restore()
See 00_Script_Sys_Config_Packages.R for details on package versions and the fixed CRAN snapshot.
Contact
For questions regarding the scripts or data, please contact Dr. Denis S. Nogueira at denis.nogueira@ifmt.edu.br.
