Data and code from: Unravelling drivers of forest biodiversity: Contrasting effects of mean environmental conditions, environmental heterogeneity and landscape context
Data files
Nov 05, 2026 version files 4.69 MB
-
01a_data_curation_predictors.R
16.79 KB
-
01b_preparation_responses.R
1.16 KB
-
01c_calculate_deadwood_diversity.R
2.28 KB
-
02a_biodiversity_data_exploration.R
4.69 KB
-
02b_predictors_selection.R
7.43 KB
-
03_run_all_models.R
20.76 KB
-
04_Model_checking_plots.R
5.34 KB
-
05_Manuscript_figures_tables.R
12.50 KB
-
05a_Presentation_figures.R
4.67 KB
-
06_make_figures.R
14.07 KB
-
2018-08-29_A1_JF_Full_Forest_Inventory_korrekted.xlsx
2.06 MB
-
2018-11-05_A1_JF_forest_dw-volume_plot.csv
3.64 KB
-
2018-11-05_A1_JF_forest_inv_ba-plot.csv
23.38 KB
-
2020-06-16_A1_JF_TLS_indicators.csv
421.57 KB
-
2022-03-20_CanopyLoss_Mean.csv
5.53 KB
-
20230109_FinalClassificationActivity_withoutBadWeather_AllNights_toGita.csv
243.12 KB
-
all_dead_wood.csv
220.10 KB
-
B2_plants_preparation.R
999 B
-
B3_beetle_families_preparation.R
2.26 KB
-
B3_hymenoptera_preparation.R
1.25 KB
-
B5_bats_preparation.R
996 B
-
B6_birds_Joao.csv
222.95 KB
-
B6_birds_preparation.R
1.76 KB
-
B8_mammals_preparation.R
4.92 KB
-
B9_fungi_preparation.R
922 B
-
Coleoptera_families_sample_period.csv
419.07 KB
-
community_bats.csv
5.14 KB
-
community_beetles.csv
22.27 KB
-
community_birds.csv
16.70 KB
-
community_fungi.csv
82.90 KB
-
community_hymenoptera.csv
34.73 KB
-
community_mammals.csv
5.36 KB
-
community_plants_FIXED.csv
268.52 KB
-
extract_gam.R
3.31 KB
-
gdm_varImp_bugfix.R
30.24 KB
-
Knuff_ModifiedWindowTrap_CapturedInsectTaxa.csv
322.13 KB
-
lyingdeadwoodvolumes.csv
3.03 KB
-
pairs_helpers.R
645 B
-
predictors_landscape_1.csv
5.22 KB
-
predictors_landscape_10.csv
5.33 KB
-
predictors_landscape_15.csv
5.33 KB
-
predictors_landscape_20.csv
5.34 KB
-
predictors_landscape_5.csv
5.34 KB
-
predictors_local_het.csv
9.74 KB
-
predictors_local_mean.csv
15.78 KB
-
README.md
42 KB
-
SP_builder_species_matrix.csv
43.21 KB
-
SP_parasitoid_species_matrix.csv
34.15 KB
Abstract
Understanding how biodiversity varies under different environmental conditions is one of the central aims of ecology. Increased heterogeneity is generally associated with increased diversity, but dominant conditions tend to have a stronger influence. Site specific conditions are embedded into a landscape context, which adds another layer of complexity to be considered. Due to the rarity of multi-taxon data it remains unclear if resulting patterns of abundance and diversity are similar across taxa. Most European forests are under management and being strongly influenced in both mean conditions and heterogeneity. How different species groups respond to variation in these forest characteristics is therefore crucial for testing ecological theories and designing effective conservation measures. We assessed the effects of environmental conditions on biodiversity of seven taxonomic groups in a temperate mountain forest area in Central Europe. We analysed the responses of biodiversity (species richness, Shannon diversity, and beta diversity) to three groups of environmental variables: local mean conditions (Mean canopy height, elevation, deadwood volume) local heterogeneity (Conifer dominance, gap share, mean slope, structural complexity index, variation of canopy height, Shannon diversity of trees, deadwood diversity), and landscape (Forest cover, Conifers forest share) . Our objectives were to determine which group of variables is most important explaining biodiversity variation, and if environmental conditions have consistent effects on multiple taxonomic groups. One of our findings was that the effects of environmental conditions varied substantially between taxa biodiversity. The proportion of conifers had the largest number of significant effects overall, but the direction varied between taxa. None of the three groups of variables was more relevant in explaining biodiversity. While an increase in local heterogeneity and higher values in the landscape context were associated with increased diversity, an increase in mean conditions was mainly negatively associated with diversity. Synthesis and applications Our results highlight how no single factor affects biodiversity across different taxa in the same way. For management, this means that stand-level interventions, are likely not sufficient to promote the many aspects of biodiversity. Instead, different types of management are likely needed for objective-specific biodiversity conservation at the landscape scale.
Dataset DOI: 10.5061/dryad.sbcc2frq3
Description of the data and file structure
This archive holds the data and R code for the article "Unravelling drivers of forest biodiversity: contrasting effects of mean environmental conditions, environmental heterogeneity and landscape context", Journal of Applied Ecology (manuscript JAPPL-2025-01296). It contains everything needed to reproduce:
- (a) data preparation: from the raw survey and inventory data to the community matrices and predictor tables (see "Limitations" for the parts that came from a GIS database and cannot be re-run from this archive);
- (b) the analysis: GAMs of species richness and Shannon diversity, GDMs of β diversity, deviance partitioning, multicollinearity diagnostics;
- (c) the figures and tables of the paper and its Supporting Information.
Study overview
Seven taxonomic groups were surveyed on 135 one-hectare forest plots of the ConFoBi project (Conservation of Forest Biodiversity in Multiple-use Landscapes of Central Europe) in the Black Forest, Baden-Württemberg, Germany:
| Group | Method | Survey period |
|---|---|---|
| Vascular plants | Cover estimates in six 5 m × 5 m subplots per plot | 2016–2018 |
| Deadwood fungi | Fruiting bodies of macrofungi on deadwood objects, two 280 m2 subplots, two to three visits | 2020 |
| Beetles (families) | Two flight-interception (window) traps, each with a top and bottom collecting unit, five sampling periods | Mar–Aug 2017 |
| Stem-nesting bees and wasps and their parasitoids | Four trap nests per plot | 2020 |
| Birds | 20-min point counts, 50 m radius, about two visits per season | 2017–2021 |
| Bats | Acoustic loggers (two per plot), BatScope classification | May–Oct 2016 and 2017 |
| Terrestrial mammals | Camera traps, five seasons | Spring 2019 – Spring 2021 |
For each plot we compiled environmental predictors in three groups: local mean conditions, local heterogeneity and landscape context. Landscape context was calculated in buffers of 1, 5, 10, 15 and 20 km². We modelled species richness and Shannon diversity (exp H) with generalised additive models (GAMs) and β diversity (Bray–Curtis) with generalised dissimilarity models (GDMs). For each taxon and response, the landscape scale was chosen by AICc (GAMs) or by deviance explained (GDMs). Full sampling protocols are given in the paper (Methods, Biodiversity data).
Workflow and folder structure
The scripts use paths relative to the archive root. To run them, recreate this folder structure (the raw data are supplied as Raw_data.zip, which unpacks to the Raw_data/ folder below):
.
├── Code/ R scripts (see "Code/software")
├── Raw_data/ (a) raw input data, unpacked from Raw_data.zip
│ ├── Biodiversity_data/<subproject folder>/...
│ └── Environmental_data/...
├── Processed_data/
│ ├── Predictors/ local_predictors.csv, landscape_predictors.csv (supplied) + files written by (a)
│ ├── Community_matrices/ written by (a)
│ └── Models/ written by (b)
├── Analysis_data/ (b) analysis-ready tables: community_*.csv, predictors_*.csv (supplied)
└── Figures/ written by (c)
| Step | Script(s) | Reads | Writes |
|---|---|---|---|
| a1 | 01a_data_curation_predictors.R |
Raw_data/Environmental_data/* + ConFoBi GIS database (not public) |
Processed_data/Predictors/local_predictors.csv, landscape_predictors.csv (both supplied; this step cannot be re-run, see Limitations) |
| a2 | 01b_preparation_responses.R, which runs the B*_preparation.R scripts in the required order |
Raw_data/Biodiversity_data/*, Raw_data/Environmental_data/2022-03-20_CanopyLoss_Mean.csv |
Processed_data/Community_matrices/{bats,beetles,birds,fungi,hymenoptera,mammals,plants}.csv, Processed_data/mammals_samples.csv, Processed_data/cover_loss.csv |
| a3 | 01c_calculate_deadwood_diversity.R |
local_predictors.csv, Raw_data/Environmental_data/all_dead_wood.csv |
Processed_data/Predictors/deadwood_diversity.csv |
| a4 | 02a_biodiversity_data_exploration.R |
community matrices | Processed_data/Community_matrices/communities.Rds, exploration figures |
| a5 | 02b_predictors_selection.R |
local_predictors.csv, deadwood_diversity.csv, landscape_predictors.csv |
Processed_data/Predictors/select_pred_list.Rds, correlation figures |
| a6 | Communities | communities.Rds, select_pred_list.Rds |
Analysis_data/community_*.csv, Analysis_data/predictors_*.csv |
| b | 03_run_all_models.R (sources gdm_varImp_bugfix.R) |
Analysis_data/*, local_predictors.csv (plot coordinates) |
model objects (.Rds) and result tables (partition_alpha.csv, partition_beta.csv, vif_table.csv, concurvity_all.csv, concurvity_pairwise.Rds) in the output folder |
| c | 06_make_figures.R; 05_Manuscript_figures_tables.R(sources extract_gam.R); 04_Model_checking_plots.R |
outputs of step b | Figs 1–3, the concurvity figure, Tables 2–3 (LaTeX), Supporting Information figures, model diagnostics |
Steps b and c can be run directly from the supplied files without repeating step a.
General conventions
- All processed and analysis-ready files are comma-separated text files (
.csv, ASCII, decimal point) with one header row. - Raw files are kept in the original format their data owners delivered, because the preparation scripts read them as they are. Several of them are semicolon-separated:
Updated_Plant_Data_ConFoBi_JH_MW_100322.csv,Knuff_ModifiedWindowTrap_CapturedInsectTaxa.csv,20230109_FinalClassificationActivity_withoutBadWeather_AllNights_toGita.csv,B6_birds_Joao.csv,Allcameratrapdata_Sebastian.csvandlyingdeadwoodvolumes.csv. Two forest inventory files and the bat and camera-trap metadata are.xlsxworkbooks. Do not rename the raw files: the scripts address them by name. - plot_id: integer plot identifier (values between 1 and 188; 135 plots; numbers are not consecutive). It is shared by all processed and analysis files and links community and predictor data. Raw files use the string form
CFB001–CFB188, which the scripts convert to integers. - Missing values: the processed and analysis-ready files contain no missing values. A plot absent from a community file was not sampled for that group (see the row counts below). A value of 0 in a community file means the taxon was not recorded on that plot. In the raw files, missing values are empty cells or
NA. - Coordinates (
x,yinlocal_predictors.csv; plot centres): Gauss–Krüger zone 3 (DHDN, EPSG:31467), metres.
Files and variables
1. Analysis-ready files (folder Analysis_data/; inputs to steps b and c)
Community data (7 files)
community_plants_FIXED.csv, community_fungi.csv, community_beetles.csv, community_hymenoptera.csv, community_birds.csv, community_bats.csv, community_mammals.csv
Each file is a plot × taxon matrix with one row per plot. Apart from the identifier and effort columns below, every column is one taxon (species, family or acoustic group, depending on the group). The column header is the taxon name or code, and the cell value is the summed abundance or activity of that taxon on that plot, in the unit given in the table.
sampling_effort(bats, beetles, birds and mammals only; first column): sampling effort on that plot, used as a smooth covariate in the GAMs and as a predictor in the GDMs to account for unequal effort among plots (units in the table).plot_id: plot identifier (first column in fungi, hymenoptera and plants; second column in bats, beetles, birds and mammals).
| File | Rows (plots) | Taxon columns | Taxon columns represent | Unit of values | sampling_effort |
|---|---|---|---|---|---|
community_plants_FIXED.csv |
133 (plots 33 and 118 absent) | 295 | Vascular plant species (Genus_species) |
Mean cover (%) across the six subplots; cover classes were converted to 2.5 %, 15 % and 35 % before averaging (Helbach et al. 2022). Non-integer. | – |
community_fungi.csv |
135 | 281 | Deadwood-inhabiting macrofungal species (Genus_species) |
Number of records, i.e. deadwood objects carrying fruiting bodies of the species, summed over the two subplots and all visits (not the number of fruiting bodies) | – |
community_beetles.csv |
135 | 71 | Beetle families (<family>_sum, e.g. carabidae_sum); unidentified specimens excluded |
Number of individuals, summed over both traps, both collecting units and all five sampling periods | Total trap-unit days (sum of days operated over the four collecting units; 46–612) |
community_hymenoptera.csv |
134 (plot 187 absent) | 121 | 68 nest-building bee and wasp species followed by 53 parasitoid and kleptoparasite taxa (species, genera or families, including two Diptera morphotypes, AnthomyiidaeA, AnthomyiidaeB, and Diptera). Codes are genus initial + species epithet (e.g. O_bicornis) |
Number of brood | – |
community_birds.csv |
135 | 56 | Bird species, coded as the first three letters of the genus and of the species epithet (e.g. par_maj= Parus major; cer_sp, reg_sp = unidentified Certhia / Regulus). Raptors, owls, aquatic, grassland, settlement, wintering and accidental species were removed (see species_to_remove.csv) |
Number of individuals, summed over all point-count visits | Number of point-count visits (4–12) |
community_bats.csv |
135 | 13 | Bat acoustic groups | Number of one-minute intervals with at least one call, summed over all logger-nights | Number of logger-nights (3–39) |
community_mammals.csv |
135 | 14 | Terrestrial mammal species (definitions below) | Number of animals recorded (sum of animals per camera-trap event over all events and seasons; not the number of distinct individuals) | Number of camera-trap nights (207–413) |
Bat acoustic groups (columns of community_bats.csv; BatScope classifications grouped as in 20230901_Species_BClass_Guild_Overview_ALH.xlsx). Calls that could not be assigned to one of these groups (e.g. Eptesicus/Nyctalus/Vespertilio mixed calls, unassigned Pipistrellus calls, "Chiroptera") are not included.
| Column | Group |
|---|---|
Bbar |
Barbastella barbastellus |
Ept_spec |
Eptesicus nilssonii, E. serotinus and Eptesicus spp. |
Hsav |
Hypsugo savii |
M_spec |
Myotis spp. not assigned to another group (incl. M. bechsteinii, M. brandtii, M. capaccinii, M. daubentonii, M. mystacinus and mixed calls among them) |
MemaMalc |
Myotis emarginatus / M. alcathoe |
Mmyo |
Myotis myotis / M. blythii |
Mnat |
Myotis nattereri |
Nyc_spec |
Nyctalus leisleri, N. noctula and Nyctalus spp. |
Plec_spec |
Plecotus auritus, P. austriacus and Plecotus spp. |
Pnat_Pkuh |
Pipistrellus nathusii / P. kuhlii (incl. P. pipistrellus–nathusii calls) |
Ppip |
Pipistrellus pipistrellus |
Ppyg |
Pipistrellus pygmaeus (calls classified by BatScope as Miniopterus schreibersii are also assigned here) |
Vmur |
Vespertilio murinus |
Mammal species (columns of community_mammals.csv): Badger Meles meles; Fox Vulpes vulpes; Chamois Rupicapra rupicapra; Hare Lepus europaeus; Polecat Mustela putorius; Lynx Lynx lynx; Marten Martes martes and M. foina (not distinguishable on camera images); Roe_deer Capreolus capreolus; Red_deer Cervus elaphus; Sika_deer Cervus nippon; Raccoon Procyon lotor; Weasel Mustela sp; Wild_cat Felis silvestris; Wild_boar Sus scrofa. Where two cameras operated on the same plot in the same season, one was randomly retained (set.seed(123) in B8_mammals_preparation.R).
File: predictors_local_mean.csv
Local mean environmental conditions per plot. 135 rows, 9 columns.
plot_id: plot identifierndsm_mean: mean canopy height from the UAV-derived normalised digital surface model (m)gap_share: proportion of the plot area in canopy gaps (0–1)log_dw_vol_all: natural logarithm of total deadwood volume (lying plus standing), in log(m3 ha -1). Plots are 1 ha, so the untransformed value equals the volume per plot (range 4.9–486 m3).avg_altitude: mean elevation (m a.s.l.)cf_share: proportion of coniferous trees in plot basal area (0–1)northness: cosine of aspect (−1 = south-facing, 1 = north-facing)eastness: sine of aspect (−1 = west-facing, 1 = east-facing)avg_slope: mean slope (degrees)
cf_share, gap_share and avg_slope can be interpreted either as mean or as heterogeneity variables. They are in this file by default and are reassigned to the heterogeneity group in the partitioning sensitivity analysis (03_run_all_models.R).
File: predictors_local_het.csv
Local environmental heterogeneity per plot. 135 rows, 5 columns.
plot_id: plot identifierlog_ssci: natural logarithm of the stand structural complexity index (SSCI, dimensionless; Ehbrecht et al. 2017), from terrestrial laser scans, averaged over the scans per plotndsm_sd: standard deviation of canopy height within the plot (m)tree_shannon: Shannon diversity index (H, natural log) of tree species in the forest inventory, based on stem counts (dimensionless)dw_div: deadwood diversity, the Shannon index of deadwood volume across deadwood types (combinations of category, origin, wood type, decay stage and diameter class; dimensionless), calculated with01c_calculate_deadwood_diversity.R
Files: predictors_landscape_1.csv, predictors_landscape_5.csv, predictors_landscape_10.csv, predictors_landscape_15.csv, predictors_landscape_20.csv
Landscape context around each plot, calculated within a circular buffer centred on the plot. The number k in the file name is the buffer area in km² (1, 5, 10, 15 or 20 km²; radii 564, 1262, 1784, 2185 and 2523 m). Each file has 135 rows and 3 columns.
plot_id: plot identifierfc<k>(e.g.fc5): proportion of forest cover within the buffer (0–1), from the Copernicus High Resolution Layer Forest Type 2018 (10 m)landscape_cf_share<k>(e.g.landscape_cf_share5): proportion of coniferous forest in the forested area of the buffer (fcc<k>/fc<k>inlandscape_predictors.csv; 0–1)
File: Processed_data/Predictors/local_predictors.csv
The full table of local plot variables written by 01a_data_curation_predictors.R. It is supplied because (i) step a1 cannot be re-run from this archive, (ii) it is the input to steps a3 and a5, and (iii) 03_run_all_models.R and 04_Model_checking_plots.R take the plot coordinates (x, y) from it for the GDMs and the spatial-autocorrelation tests. 135 rows, 27 columns, sorted by plot_id.
plot_id: plot identifieravg_altitude: mean elevation (m a.s.l.)avg_slope: mean slope (degrees)aspect: mean aspect (degrees clockwise from north)x,y: plot-centre coordinates (m; see General conventions)gap_share: proportion of the plot area in canopy gaps (0–1; UAV canopy model)ndsm_mean,ndsm_sd: mean and standard deviation of canopy height (m; UAV nDSM)tri: mean terrain ruggedness index of the UAV canopy surface modelgap_share_sd: standard deviation of the gap share among 200 × 200-pixel tiles of the plot (0–1)ssci: stand structural complexity index (dimensionless; TLS)enl: effective number of canopy layers (dimensionless; TLS)dbh,dbh_sd: mean and standard deviation of tree diameter at breast height (cm; trees > 7 cm)ba: basal area (m2 per plot = m2 ha -1)tree_sr: number of tree speciestree_shannon: Shannon diversity of tree species (dimensionless)cf_share: coniferous share of plot basal area (0–1)dw_vol_lying,dw_vol_standing: volume of lying and standing deadwood (m3 ha -1)dw_cf_share: coniferous share of standing deadwood, by summed DBH (0–1; not used in the analyses)temp: mean air temperature from plot data loggers, mean of monthly means (°C)precipitation: mean annual precipitation at the plot centre (mm)trems_richness,trems_abundance,trems_shannon: richness, total number and Shannon diversity of tree-related microhabitats (not used in the final models)
File: Processed_data/Predictors/landscape_predictors.csv
The full table of landscape variables written by 01a_data_curation_predictors.R (input to step a5). It is supplied because it was calculated from raster data in the ConFoBi GIS database. 135 rows, 101 columns: plot_id plus 20 variables for each of the five buffer areas. The suffix k = 1, 5, 10, 15, 20 gives the buffer area in km².
fc<k>,fcb<k>,fcc<k>: share of the buffer classified as forest, broadleaved forest and coniferous forest (0–1; Copernicus Forest Type 2018, 10 m)ndvi<k>,ndvi_sd<k>: mean and SD of Sentinel-2 NDVI (dimensionless)precipitation_l<k>,precipitation_l_sd<k>: mean and SD of annual precipitation (mm)terrain_height<k>,terrain_height_sd<k>,terrain_min<k>,terrain_max<k>: mean, SD, minimum and maximum elevation from a 10 m digital terrain model (m)tri<k>: mean terrain ruggedness index (m)residential_share<k>,farmland_share<k>,orchard_share<k>,greenland_share<k>,windthrow_share<k>,waterbodies_share<k>: share of LUBW land-cover classes (settlement and industry; farmland; vineyards and orchards; grassland; windthrow; water bodies; 0–1)lcc_n_types<k>: number of these land-cover classes presentlcc_shannon<k>: Shannon diversity of all LUBW land-cover classes (dimensionless)
2. Raw data (Raw_data.zip; inputs to step a)
Raw_data.zip unpacks to the folder Raw_data/ with the sub-folders and file names expected by the scripts. Each sub-folder name gives the ConFoBi sub-project and the data owner. Variables that the scripts do not use are kept as delivered.
Raw_data/Biodiversity_data/B2_plants_Jan_Helbach/
Updated_Plant_Data_ConFoBi_JH_MW_100322.csv(semicolon-separated; long format):plotID(CFB plot code),variable(species,Genus.species),value(mean cover across subplots, %),blanquet(cover class). The first, unnamed column is a row index.
Raw_data/Biodiversity_data/B3_beetle_families_Anna_Nolan/
Coleoptera_families_sample_period.csv: one row per trap sample.sample_id,plotid,trapid,collection_unit(top/bottom),collect_start,collect_end(dd.mm.yyyy),sampling_period(1–5),unknown_sum(unidentified beetles), then one column per beetle family (<family>_sum, number of individuals). Some specimens sent for DNA analysis are not included.
Raw_data/Biodiversity_data/B3_insect_orders_Anna_Knuff/
Knuff_ModifiedWindowTrap_CapturedInsectTaxa.csv(semicolon-separated): arthropod orders per window-trap sample (Knuff et al. 2019). Used only to add trap samples that contained no beetles (zero rows) to the beetle data, so that sampling effort is complete.Sample_ID; one column per order with the number of individuals (_Larven= larvae);PlotID,TrapID,Sampling_Unit,Collect_start,Collect_end,Sorted_by,Period.
Raw_data/Biodiversity_data/B3_hymenoptera_Nolan_Rappa/
SP_builder_species_matrix.csv: trap-nest corner × species matrix of nest builders.Plot,Corner(NW/SE),plot_corner,total_abundance_nests, then one column per species (number of provisioned brood cells, pooled over the two trap nests at a corner).SP_parasitoid_species_matrix.csv: as above for parasitoids and kleptoparasites.Plot,Corner,Plot_corner, then one column per taxon.
Raw_data/Biodiversity_data/B5_bats_Marlotte_Jonker/
20230109_FinalClassificationActivity_withoutBadWeather_AllNights_toGita.csv(semicolon-separated; one row per logger-night):plot_id,subplot_id(logger),date,X,Y(logger coordinates), the 13 acoustic-group columns (one-minute intervals with calls), and the weather covariatesmin_temp,mean_temp(°C),mean_rain_h(hours with rain),mean_rain__mm,mean_wind_h(hours with strong wind),mean_windspeed(m s⁻¹),mean_relh(%). Nights with minimum temperature < 5 °C, > 3 h of rain (≥ 0.2 mm h⁻¹) or > 3 h of strong wind (≥ 8 m s⁻¹), and nights with battery failure, are already excluded.20230901_Species_BClass_Guild_Overview_ALH.xlsx: documentation (not read by the code). Lookup from BatScope classifications to the acoustic groups. Columns:bat_orginal_batscope_output,count(total one-minute intervals),short_name,b_classification,guild,regroup,final-classification(group used here),Richness_Diversity(groups used in the analysis).
Raw_data/Biodiversity_data/B6_birds_Joao_Pereira/
B6_birds_Joao.csv(semicolon-separated; one row per point-count visit):plot_id,date_surv(dates written with Portuguese and German month abbreviations; parsed inB6_birds_preparation.R),start_time,visit_id, then one column per species (number of individuals seen or heard). Collected by M. Basile (2017–2018), J. Pereira (2019–2021) and helpers (Basile et al. 2020, 2021).species_to_remove.csv: species excluded from the analysis.species(scientific name),abbreviation(column code; empty if the species was not in the data),reason.
Raw_data/Biodiversity_data/B8_mammals_Sebastian_Schwegmann/
CamEvents_Spring19.csv,CamEvents_Aut19.csv,EventsSp20.csv,EventsAu20.csv,EventsSpring2021.csv: one row per camera-trap event and season, as exported from the image-management software (German column names). The script usesORDNER(folder),BILDNAME(image name),DATUM(date, dd.mm.yyyy),ZEIT(time),URSACHE(species or other trigger, in German),ANZTIERE(number of animals) andCamID(camera). The other columns are software metadata.Allcameratrapdata_Sebastian.csv(semicolon-separated): one row per camera deployment.PosID,CamID,PlotID,Position(C, IN, IS),DateSetup,TimeSetup,DateRet,TimeRet,Trapnights(used as sampling effort), plus camera-site habitat variables, which are described inMetadaten_Kamerafallen.xlsx.Metadaten_Kamerafallen.xlsx: documentation (not read by the code). Definitions (in German) of the columns ofAllcameratrapdata_Sebastian.csv.
Raw_data/Biodiversity_data/B9_fungi_Max_Wieners/
CFB_B9_P1_1_occurence_data_2022-11-16_formatted.csv: one row per record (species × deadwood object × visit).Plot_ID,subplot,sample_event_ID,date,taxon_RL(species), then attributes of the deadwood object:dw_tree_gen,dw_tree_fam,dw_tree_ord,dw_tree_class(host taxonomy),dw_pos(LY = lying, ST = standing,dw_l(length, m),dw_rad(radius, cm),dw_moss,dw_bark(moss and bark cover, %),dw_contact(ground contact, %),dw_dec_stage(decay stage I–V).
Raw_data/Environmental_data/
2018-08-29_A1_JF_Full_Forest_Inventory_korrekted.xlsx: full tree inventory. SheetLegendgives the species codes, sheetMetadatagives the survey metadata, and there is one sheet per plot (sheet name = plot number) withName,Number,Date,Species(code),SpeciesText,Diameter(DBH, mm),Height1. Codes 8, 21 and 22 are standing deadwood.2018-11-05_A1_JF_forest_inv_ba-plot.csv: basal area per species group and plot (m2 ha -1), withtotalandcf_share(coniferous share, used ascf_share).2018-11-05_A1_JF_forest_dw-volume_plot.csv:plot_id,dw_volume(standing deadwood volume, m3 ha -1).lyingdeadwoodvolumes.csv(semicolon-separated):PlotID,deadwoodvolume(lying deadwood volume, m3 ha -1).all_dead_wood.csv: one row per deadwood object on line-intersect transects.PlotID;Deadwoodcategory(1 = stump, 2 = lying);Origin(1 = natural, 2 = artificial);Type(1 = hardwood, 2 = softwood);Decaystage(1 = fresh … 5 = almost completely decayed);DBH(cm);transectlength,Lengthskiddingtrail(m);fruiting.body,hollow_trunk(1 = present);comments. Two DBH values are corrected in01c_calculate_deadwood_diversity.R.2020-06-16_A1_JF_TLS_indicators.csv: structural indicators per terrestrial laser scan (several scans per plot;PlotID).SSCIandENLare used; the other columns are point-cloud statistics (MFRAC, height quantileszq*, etc.).Final_TreM_data_complete.xlsx: tree-related microhabitat survey (one row per tree; sheetMeta dataexplains the codes). Read by01abut not used in the final models.2022-03-20_CanopyLoss_Mean.csv:name(plot),mean_loss,mean_loss_with_NA(mean canopy cover loss, 0–1). Read by01b_preparation_responses.R, which writescover_loss.csv(plots with loss > 0.25). Not used in the final analyses.
3. Data not included in this archive (limitations)
- ConFoBi GIS database.
01a_data_curation_predictors.Rreads plot location and terrain (elevation, slope, aspect, coordinates), UAV canopy metrics (gap_share,ndsm_mean,ndsm_sd,tri,gap_share_sd), plot precipitation and all landscape variables from a PostgreSQL/PostGIS database of the ConFoBi project. This database is not publicly accessible. The results of these queries are supplied aslocal_predictors.csvandlandscape_predictors.csv, and all later steps run from these files. The landscape layers were derived from the sources listed under "Access information".
Code/software
All analyses were run in R 4.2.2 (also tested under R 4.3.3). Run each script with the working directory set to the archive root. Exception: 01a_data_curation_predictors.R sets its own working directory (step a1, which cannot be re-run). Required packages:
- Data preparation (a):
vegan,openxlsx,reshape2,tidyverse(dplyr,tidyr),corrplot,data.table; for01aonly:DBI/RPostgreSQL,rpostgis,foreach,doParallel,mgcv,fmsb,ape,gdm,FactoMineR - Analysis (b):
vegan,mgcv,MuMIn,gdm; forgdm_varImp_bugfix.R:pacman,pbapply,parallel,doParallel,foreach - Figures and tables (c):
ggplot2,mgcv,gdm,texreg,visreg,reshape2,viridis; for04:mgcViz,DHARMa,visreg,ape,gstat,fields,nlme
Scripts
Data preparation (a)
01a_data_curation_predictors.R: curates the raw plot, inventory and GIS data intolocal_predictors.csvandlandscape_predictors.csv. Needs the ConFoBi database (see Limitations); the supplied output files replace this step.01b_preparation_responses.R: runs the taxon scripts below in the required order (B5_bats_preparation.Rmust run beforeB2_plants_preparation.RandB6_birds_preparation.R, which use the bat matrix as the reference list of the 135 plots). It also writescover_loss.csv.B2_plants_preparation.R: converts the long-format plant cover data into a plot × species matrix.B3_beetle_families_preparation.R: adds zero-catch samples, computes trap-unit days and pools beetle families per plot.B3_hymenoptera_preparation.R: sums brood cells over trap-nest corners and combines nest builders and parasitoids.B5_bats_preparation.R: pools bat activity per plot and counts logger-nights.B6_birds_preparation.R: parses survey dates, pools counts per plot, counts visits and removes the species inspecies_to_remove.csv.B8_mammals_preparation.R: merges the five seasons of camera-trap events, assigns plots, keeps one camera per plot and season, counts trap nights and pools mammal species per plot. Also writesmammals_samples.csv(cleaned event table).B9_fungi_preparation.R: counts records per species and plot.01c_calculate_deadwood_diversity.R: calculates deadwood diversity (dw_div).02a_biodiversity_data_exploration.R: combines the community matrices intocommunities.Rdsand produces exploratory figures (richness, Shannon diversity, records and effort).02b_predictors_selection.R: derives the final predictors (summed and log-transformed deadwood volume, log SSCI, northness, eastness, landscape coniferous share), checks correlations (|r| < 0.7) and writesselect_pred_list.Rds.pairs_helpers.R: helper functions for pairwise correlation plots of the predictors (used by02b).
Analysis (b)
03_run_all_models.R: full analysis pipeline. It fits the richness and Shannon-diversity GAMs (k = 5thin-plate smooths, log link, REML; Gamma family for Shannon diversity; Poisson, quasi-Poisson or negative binomial for richness depending on the group; the landscape scale is chosen per model by AICc). It fits the β-diversity GDMs (Bray–Curtis, with geographic distance) and computes variable importance by matrix permutation. It partitions the explained deviance among the three predictor groups (unique and shared fractions), with a sensitivity analysis that movescf_share,gap_shareandavg_slopeto the heterogeneity group. Finally, it computes multicollinearity diagnostics (VIF with stepwise removal at VIF > 10; GAM concurvity). Set the path variablesdata_dirandout_dirat the top of the script.gdm_varImp_bugfix.R: patched GDM variable-importance function (gdm.varImp2) used in the paper. If this file is present, the pipeline uses it so that Fig. 2 is reproduced exactly; otherwisegdm::gdm.varImpis used (same method, slightly different permutation values).
Figures and tables (c)
06_make_figures.R: reads the objects written by03_run_all_models.Rand writes each figure as a vector PDF and a 600-dpi PNG: Fig. 1 (effects of predictors on richness and Shannon diversity), Fig. 2 (variable importance for β diversity), Fig. 3 (deviance partitioning) and the supplementary concurvity figure.05_Manuscript_figures_tables.R: LaTeX tables of the GAM results (texreg; Tables 2–3); per-taxon Supporting Information figures of significant GAM effects and GDM variable importance; mean R2 and deviance explained. It also contains an earlier version of Figs 1–2, superseded by06_make_figures.R.extract_gam.R:texregextract method formgcvGAMs (used by05).04_Model_checking_plots.R: model diagnostics (gam.check, DHARMa residuals, partial-effect plots), Moran's I tests of residual spatial autocorrelation, GDM I-spline plots and an exploratory attempt at spatial correlation structures for bat Shannon diversity.05a_Presentation_figures.R: additional figures for a presentation; not needed to reproduce the paper.
How to reproduce
- Unpack
Raw_data.zipand arrange the other files as shown under "Workflow and folder structure". - (a) Run
01b_preparation_responses.R,01c_calculate_deadwood_diversity.R,02a_biodiversity_data_exploration.Rand02b_predictors_selection.Rin this order, then to regenerate the files inAnalysis_data/. - (b) Run
03_run_all_models.R. - (c) Run
06_make_figures.R,05_Manuscript_figures_tables.Rand, optionally,04_Model_checking_plots.R.
Reproducibility notes
- Plot alignment.
03_run_all_models.Rhas anALIGNMENTswitch at the top. With"positional", predictor rows are taken in ascending plot-ID order and paired with the community rows in the order those appear in the file. With"byID", rows are matched byplot_id. The two settings give identical results for six of the seven groups, whose community rows are in ascending plot-ID order. The rows of the plant matrix are not in ascending order, so under"positional"131 of the 133 plant plots are paired with another plot's predictor values;"byID"is the correct pairing. The published Tables 2–3 and Figs 1–2 were produced with"positional", and the published Fig. 3 with"byID". Set the switch accordingly to reproduce a given figure. - Stochastic step. GDM variable importance uses random permutations. A seed is set in the script, but minor numerical differences between runs are expected.
- Fig. 1 effect categories. The significance of each effect is taken directly from the GAMs, while the shape category (monotonic, hump-shaped, etc.) is classified algorithmically in
06_make_figures.R. It may differ in a few cells from the manually assigned categories in the published figure (the manual assignments are in05_Manuscript_figures_tables.R).
Access information
Data were derived from the following sources:
- Biodiversity data collected by ConFoBi sub-projects B2 (vascular plants; Helbach et al. 2022), B3 (beetles, trap-nesting Hymenoptera; Knuff et al. 2019), B5 (bats), B6 (birds; Basile et al. 2020, 2021), B8 (mammals) and B9 (fungi). Environmental data from sub-project A1 (forest inventory, deadwood, TLS) and the ConFoBi tree-microhabitat survey.
- Copernicus Land Monitoring Service, High Resolution Layer Forest Type 2018 (10 m): forest cover and forest type.
- LUBW (Landesanstalt für Umwelt Baden-Württemberg) land-cover classification
- Digital terrain model, 10 m.
- Sentinel-2 NDVI
References cited: Ehbrecht, M. et al. (2017) Agricultural and Forest Meteorology 242: 1–9. Helbach, J. et al. (2022) Ecology and Evolution 12: e8534. Knuff, A.K. et al. (2019) Methods in Ecology and Evolution 10: 1820–1825. Basile, M. et al. (2020) Journal of Environmental Management 264: 110401. Basile, M. et al. (2021) Ecological Indicators 133: 108402.
Citation
Please cite the associated published article and this dataset.
Contact
Carlos M. Landivar Albis, Department of Forest Growth, Silviculture and Genetics, Austrian Research Centre for Forests (BFW), Vienna, Austria. Email: carlos.landivar@bfw.gv.at
