Human disturbance and the magnitude and predictability of phenotypic divergence
Supplementary material: a step-by-step reproducible analysis
0.1 About this supplement
This computational supplement accompanies the manuscript:
Human disturbance and the magnitude and predictability of phenotypic divergence.
Authors removed for double-anonymous review.
It documents every analytical step, from data import to final figures, in a reproducible Quarto book. All code is written in R and all models are fitted with brms using the cmdstanr backend.
0.1.1 Reproduce the analysis in order
Start with the prepared data, calculate the effect sizes, build the dependency objects, check the model grid, and create the figures. Each chapter states its input, action, and saved output.
0.2 Tutorial map
| Step | Chapter | Main output |
|---|---|---|
| 1 | Prepare the data | Clean analysis data |
| 2 | Calculate lnM | Effect sizes and sampling variances |
| 3 | Check the data | Descriptive tables and plots |
| 4 | Build dependency objects | Sampling and phylogenetic matrices |
| 5 | Run the model grid | Fitted models and summaries |
| 6 | Create final figures | Publication figures |
| 7 | Record the environment | Versions, files, and render checks |
Quick route: use the saved files in Rdata/ and render the book.
Full route: rebuild each saved file in chapter order. Model fitting requires more time and memory than rendering the saved results.
0.3 The PROCEED database
The analyses use the PROCEED v6.2 database of rates of evolutionary and phenotypic change. Each row represents one contrast between two populations or time points, with the raw summary statistics (means, standard deviations, sample sizes) needed to compute \(\ln M\).
0.4 Purpose of lnM
The effect size used in this book is \(\ln M\), which records the magnitude of divergence between two groups without retaining direction. Its formula and SAFE calculation are given in Section 3.1.
0.5 Location-scale meta-regression
The central statistical framework is location-scale meta-regression implemented in brms. Each model has the conceptual form:
bf(
yi_lnM_safe ~ moderator + random_effects,
sigma ~ moderator
)The location submodel contains coefficients for the expected value of \(\ln M\). The scale submodel contains coefficients for the residual standard deviation, \(\sigma_{\ln M}\).
One independent model per moderator. No multi-moderator model is fitted. Each model uses the rows with complete data for its moderator.
0.6 Random effects
Every main model includes:
(1 | ref_id)- non-independence among contrasts from the same reference.(1 | gr(sp_ncbi, cov = A))- phylogenetic relatedness among species.(1 | gr(es_id_model, cov = V))- known sampling variance from SAFE estimates, using the brms known-variance trick with aconstant(1)prior on the corresponding SD.
sys_id (study system) is used only in sensitivity analyses. It is highly associated with ref_id and sp_ncbi.
0.7 Saved files and reproducibility
Long computations are saved as .rds files in Rdata/. The book reads these files by default, so a normal render does not refit models. To rebuild files, follow the full route in the Reproducibility chapter.
- Effect sizes: set
recompute_effect_sizes <- TRUEin02_lnm_effect_sizes.qmd. - Models: set
refit_models <- TRUEin05_location_scale_model_grid.qmd.
Package versions, the CmdStan version, and the git commit are recorded in Section 19.1.