DOI: 10.5061/dryad.pg4f4qs1r
title: A unified model explaining the unimodal relationship between productivity and species richness in fish communities

description: Understanding the productivity–diversity relationship is central in
 ecology. While hypotheses exist for explaining positive and negative
 monotonic trends, they never have been combined into one model to account
 for hump-shaped patterns. Here, we propose a unified model integrating the
 more-individuals, biomass-driven competition, and environmental filtering
 hypotheses. Analyzing fish communities along a eutrophication gradient, we
 reconstructed the observed hump-shaped curve between productivity and
 species richness. Two productivity-related variables explained richness:
 community size (positive effect) and zooplanktivorous fish biomass
 (negative effect). Zooplanktivores, overly favored by high productivity,
 likely competed with juvenile stages of other species for zooplankton,
 leading to species exclusions. This offers rare evidence for intensified
 species interactions along a productivity gradient in animal communities.
 Competition-driven loss thus precedes stress-induced losses (e.g.,
 hypoxia), offering potential for early-warning protocols to monitor
 eutrophication.
description: # A unified model explaining the unimodal relationship between
 productivity and species richness in fish communities Dataset DOI:
 [10.5061/dryad.pg4f4qs1r](10.5061/dryad.pg4f4qs1r) ## Description of the
 data and file structure **README — Unimodal, JBE, Covariance Analyses
 (Figures 3–5)** This repository contains scripts and data required to
 reproduce Figures 3–5 from the manuscript. The analyses cover: 1. Unimodal
 and linear regression of fish community metrics versus environmental and
 productivity predictors (Figure 3). 2. Nested regression modeling of
 productivity–richness relationships (Figure 4). 3. Covariance tests across
 biomass gradients for different fish functional groups (Figure 5). ---
 **1. Figure 3 — Unimodal and Linear Regression** **Script:**
 unimodal_and_linear_regression_Figure3.R **Description:**\ Generates
 Figure 3 and supporting appendix figures, exploring linear vs. quadratic
 (unimodal) relationships between fish community metrics and predictors.
 **Input:** * unimodal_and_linear_regression_Figure3.csv — dataset
 containing lake-level observations. **Dataset columns:** | **Column** |
 **Description** | **Transformation** | | :--------- |
 :------------------------ |
 :---------------------------------------------------------------------------------- | | No | Lake/sample ID | – | | lake | Lake code | – | | Chla | Chlorophyll a | log-transformed | | SRic | Fish species richness | log-transformed | | pielou | Species evenness | log-transformed | | NPUE | Abundance per unit effort | log-transformed | | BPUE | Biomass per unit effort | log-transformed | | LogP | Proxy for productivity | Calculated: log(Productivity) = 0.91 \* log(BPUE) - 0.38 \* log(W), W = BPUE / NPUE | **How to use:** 1. Load the R script into R. 2. Run the script from top to bottom. 3. The script fits linear and quadratic models, calculates unimodal peaks, compares models (AIC, ANOVA), and generates scatter plots with regression curves. 4. Produces Figure 3 and appendix plots. **Output:** Plots are generated for the following relationships: | **Response** | **Predictor** | **Description** | | :---------------------- | :---------------------- | :--------------------------------- | | Species Richness (SRic) | Log Productivity (LogP) | Linear & quadratic, peak indicated | | SRic | Biomass (BPUE) | Linear & quadratic | | SRic | Abundance (NPUE) | Linear & quadratic | | SRic | Chlorophyll a (Chla) | Linear & quadratic | | Evenness (pielou) | Log Productivity (LogP) | Linear & quadratic | Each model comparison outputs: * **AIC values** for linear vs. quadratic models * **ANOVA** test between models * **Plots** showing best-fitting curves and peak indicators --- **2. Figure 4 — JBE Models** **Script:** JBEscript-Figure4.R **Description:**\ Reproduces Figure 4 by comparing observed productivity–richness relationships with predictions from nested regression models (JBE, JB, JE, J, B, E). Computes RMSE for quantitative comparison and generates publication-ready figures. **Input:** This script requires three data files in CSV format: * **abun — fish abundance matrix** * **Row names: lake codes.** * **First column No: lake/sample identifier.** * **Remaining columns: species abbreviations.** * **Units: individuals (ind).** * **bio — fish biomass matrix** * **Row names: lake codes.** * **First column No: lake/sample identifier.** * **Remaining columns: species Latin names.** * **Units: grams (g).** * **var — environmental & community summary variables (data frame with lake rows). Important columns:** * **No — lake/sample identifier (numeric)** * **SRic — species richness (mean species count per lake/station)** * **LogP — proxy for productivity, calculated as\ log(Productivity) = 0.91 * log(BPUE) - 0.38 * log(W)\ where W = BPUE / NPUE** * **TP — total phosphorus (mg L⁻¹)** * **TN — total nitrogen (mg L⁻¹)** * **Chla — chlorophyll a (µg L⁻¹)** * **COD — chemical oxygen demand (permanganate-oxalate titration; mg L⁻¹)** * **SD — Secchi depth (m)** * **depth — maximum water depth (m)** * **sup — lake area (km²)** **Script overview:** 1. Import the three CSV files (abun.csv, bio.csv, var.csv).. 2. Build full (lmnbe) and selected (bmnbe) regression models. 3. Generate partial predictions under six scenarios (JBE, JB, JE, J, B, E). 4. Calculate RMSE for model evaluation. 5. Produce Figure 4, showing observed vs. predicted relationships. **How to run:** source("JBEscript-Figure4.R") Set mod &lt;- lmnbe or mod &lt;- bmnbe in the script to reproduce full or selected model. **Output:** * Figure 4 (observed vs. predicted productivity–richness curves) * RMSE values. --- **3. Figure 5 — Covariance Test across Biomass Gradients** **Script:** Covscript-Figure5.R **Description:**\ Calculates the covariance test (U, W, p) for different fish biomass groups (all species, zooplanktivores, piscivores, stocked species) across low, medium, and high lake biomass groups. Visualizes the results using ggplot2. **Input:** * The same three CSV data files (abun.csv, bio.csv, var.csv) as used in Figure 4. **Script overview:** 1. Define biomass groups and compute total biomass per functional group. 2. Define the tcov function to compute U, W, and p for covariance tests. 3. Rank lakes by biomass and split into low, medium, high groups. 4. Compute covariance statistics for all functional groups and biomass classes. 5. Prepare results for plotting (covtest) with significance labels. 6. Generate Figure 5 using ggplot2. **Output:** * Figure 5: U-values of covariance test across biomass gradients, with significance annotations. --- This unified README provides a concise description of the three main scripts, their inputs, outputs, and usage instructions, maintaining consistent style across all analyses.