Data from: competition for time: evidence for an overlooked, diversity-maintaining competitive mechanism
Data files
Oct 11, 2023 version files 322.32 MB
-
competition_for_time_data_and_code.zip
-
README.md
Jan 02, 2024 version files 322.33 MB
-
competition_for_time_data_and_code.zip
-
README.md
Mar 14, 2024 version files 359.20 MB
-
competition_for_time_data_and_code.zip
-
README.md
Abstract
Understanding how diversity is maintained in plant communities requires that we first understand the mechanisms of competition for limiting resources. In ecology, there is an underappreciated, but fundamental distinction between systems in which the depletion of limiting resources reduces the growth rates of competitors versus systems in which resource depletion reduces the time available for competitors to grow, a mechanism we call “competition for time.” Importantly, modern community ecology, and our framing of the coexistence problem are built on the implicit assumption that competition reduces the growth rate. However, recent theoretical work suggests competition for time may be the predominant competitive mechanism in a broad array of natural communities, a significant advance given coexistence follows naturally when species compete for time. In this study we first introduce competition for time conceptually using a simple model of interacting species. Then, we perform an experiment in a Mediterranean annual grassland to determine whether competition for time is an important competitive mechanism in a field system. Indeed, we find that species respond to increased competition through reductions in their lifespan rather than their rate of growth. In total, our study suggests competition for time may be overlooked as a mechanism of biodiversity maintenance.
README: Data and code repository supporting "Competition for time: evidence for an overlooked, diversity-maintaining competitive mechanism"
Overview of repository contents
Data and code archive for:
Competition for time: evidence for an overlooked, diversity-maintaining competitive mechanism
by Jacob I. Levine, Stephen W. Pacala, and Jonathan M. Levine
This repository contains data generated from the experiment described in the main manuscript and appendices, as well as code to reproduce all analyses and generate all figures from the text. The repository is divided into three main directories: /code
, which contains all the scripts used to clean data, perform analyses, and generate figures from the manuscript and appendix; /scanned_data
, which contains scanned copies of the original datasheets from the experiment; and /entered_data
, which contains all the digitized raw data, as well as repositories which are populated with results from the analysis and data-cleaning code in /code
. There are two additional directories: /figures
and /tables
, which are to be populated with figures and data tables generated during data analysis.
The scripts in /code
are written so that they can be run one by one, as running the entire analysis takes multiple hours and you may only want to look at a single portion of the analysis. For users who want to run the full analysis again, you can simply run the run_full_analysis.r
script located at the head of the /code
directory. All the scripts in /code
are numbered in the order they should be run if they are to be run individually. There are two sets of numbers, the first divide the scripts into four categories, expressed as directories within /code
: 00-utility
, which includes function definitions, plotting standards, and package management; and 01-data_cleaning
, 02-data_analysis
, and 03-fig_gen
, whose purposes are self-explanatory. Within each of these subdirectories are multiple scripts, again numbered in the order they should be run as each depends on the output of the previous scripts.
All the raw data in /entered_data/raw
is described by the meta_data.xlsx
file, giving descriptions of each data sheet's purpose as well as defining each variable and its units. Thus this README
does not again describe the metadata for each datasheet. The data generated as code output in /altered
and /model
objects do not have an accompanying meta data file, as the variables contained within are defined by the code that generates them.
For details on the design of the experiment and interpretation of the analyses please see the main text and appendices of the manuscript.
Description of the directory structure
All scripts are written in either R
, julia
, or stan
. The analyses for the paper were run using R version 4.2.2, and julia version 1.8.5. Data outputs are either .csv
or .RDS
(model object) files.
Directory structure
├── code
│ ├── 00-utility
│ │ ├── function_utility.R
│ │ ├── head.R
│ │ ├── plot_generation.R
│ │ └── plot_utility.R
│ ├── 01-data_cleaning
│ │ ├── 01_00-plot_locations_cln.r
│ │ ├── 01_01-competitor_densities.r
│ │ ├── 01_02-water_cln.r
│ │ ├── 01_03-allom_rel_cln.r
│ │ ├── 01_04-biomass_samp_cln.r
│ │ ├── 01_05-fecundity_cln.r
│ │ ├── 01_06-biomass_traj_cln.r
│ │ ├── 01_07-focal_positions_cln.r
│ │ ├── 01_08-biomass_max_cln.r
│ │ ├── 01_09-biomass_repro_cln.r
│ │ ├── 01_10-germination_cln.r
│ ├── 02-data_analysis
│ │ ├── 02_00-allometric_analysis.r
│ │ ├── 02_01-water_analysis.r
│ │ ├── 02_02-fecundity_analysis.r
│ │ ├── 02_03-growth_longevity_tradeoff.r
│ │ ├── 02_04-phenomenological_model_fitting.r
│ │ ├── 02_05-phenomenological_model_analysis.r
│ │ ├── 02_06-alphas_phenology.r
│ │ ├── 02_07-coexistence_predictions.r
│ │ ├── 02_08-abrupt_decline.r
│ │ ├── 02_09-basic_analysis.r
│ │ └── stan
│ │ ├── bevertonholt_step1.rds
│ │ ├── bevertonholt_step1.stan
│ │ ├── bh_alpha_exp.rds
│ │ ├── bh_alpha_exp.stan
│ │ ├── bh_alpha_exp_kfold.rds
│ │ ├── bh_alpha_exp_kfold.stan
│ │ ├── bh_exp.rds
│ │ ├── bh_exp.stan
│ │ ├── bh_exp_kfold.rds
│ │ ├── bh_exp_kfold.stan
│ │ ├── bh_gamma.rds
│ │ ├── bh_gamma.stan
│ │ ├── bh_gamma_ACWR.stan
│ │ ├── bh_gamma_PLER.stan
│ │ ├── bh_gamma_kfold.rds
│ │ ├── bh_gamma_kfold.stan
│ │ ├── bh_invert.rds
│ │ ├── bh_invert.stan
│ │ ├── bh_kfold.rds
│ │ ├── bh_kfold.stan
│ │ ├── bh_step1gamma.rds
│ │ ├── bh_step1gamma.stan
│ │ ├── mech_flip_ACWR.rds
│ │ ├── mech_flip_ACWR.stan
│ │ ├── mech_flip_FEMI.rds
│ │ ├── mech_flip_FEMI.stan
│ │ ├── mech_flip_PLER.rds
│ │ ├── mech_flip_PLER.stan
│ │ ├── mech_flip_URLI.rds
│ │ ├── mech_flip_URLI.stan
│ │ ├── mech_gamma.rds
│ │ ├── mech_gamma.stan
│ │ ├── mech_gamma_ACWR.rds
│ │ ├── mech_gamma_ACWR.stan
│ │ ├── mech_gamma_ACWR_kfold.rds
│ │ ├── mech_gamma_ACWR_kfold.stan
│ │ ├── mech_gamma_PLER.rds
│ │ ├── mech_gamma_PLER.stan
│ │ ├── mech_gamma_PLER_kfold.rds
│ │ ├── mech_gamma_PLER_kfold.stan
│ │ ├── mech_gamma_SACO.rds
│ │ ├── mech_gamma_SACO.stan
│ │ ├── mech_gamma_SACO_kfold.rds
│ │ ├── mech_gamma_SACO_kfold.stan
│ │ ├── mech_gamma_SACO_phi.rds
│ │ ├── mech_gamma_SACO_phi.stan
│ │ ├── mech_gamma_URLI.rds
│ │ ├── mech_gamma_URLI.stan
│ │ ├── mech_gamma_URLI_kfold.rds
│ │ ├── mech_gamma_URLI_kfold.stan
│ │ ├── mech_gamma_URLI_phi.rds
│ │ ├── mech_gamma_constant.rds
│ │ ├── mech_gamma_constant.stan
│ │ ├── mech_gamma_kfold.rds
│ │ ├── mech_gamma_kfold.stan
│ │ ├── mech_gamma_null.rds
│ │ ├── mech_gamma_null.stan
│ │ ├── mech_gamma_null_kfold.rds
│ │ ├── mech_gamma_null_kfold.stan
│ │ ├── mech_gamma_phi.rds
│ │ ├── mech_gamma_phi.stan
│ │ ├── mech_gamma_scratch.rds
│ │ ├── mech_gamma_scratch.stan
│ │ ├── mech_invert.rds
│ │ ├── mech_invert.stan
│ │ ├── mech_test.rds
│ │ ├── mech_test.stan
│ │ ├── ricker.rds
│ │ ├── ricker.stan
│ │ ├── ricker_kfold.rds
│ │ └── ricker_kfold.stan
│ ├── 03-fig_gen
│ │ ├── S10.r
│ │ ├── S11.r
│ │ ├── S12.r
│ │ ├── S13.r
│ │ ├── S14.r
│ │ ├── S15.r
│ │ ├── S16.r
│ │ ├── S17.r
│ │ ├── S18.r
│ │ ├── S19.r
│ │ ├── S20.r
│ │ ├── S1.jl
│ │ ├── S2.jl
│ │ ├── S4.jl
│ │ ├── S6.r
│ │ ├── S8.r
│ │ ├── S9.r
│ │ ├── figure2.jl
│ │ ├── figure3.jl
│ │ ├── figure5.r
│ │ ├── figure6.r
│ │ └── figure7.r
│ ├── run_full_analysis.r
│ └── table_gen.R
├── entered_data
│ ├── altered
│ │ ├── W0.rds
│ │ ├── allom_rel_cleaned.csv
│ │ ├── alpha_phenology_data.csv
│ │ ├── biomass_combo_data.csv
│ │ ├── biomass_samp_data.csv
│ │ ├── biomass_traj_data.csv
│ │ ├── coex_subset_bh_exp.csv
│ │ ├── coex_subset_mech.csv
│ │ ├── combo_fecund_data.csv
│ │ ├── competitor_densities.csv
│ │ ├── cont_water_data.csv
│ │ ├── cont_water_data_adj.csv
│ │ ├── cont_water_data_long.csv
│ │ ├── equant_data.csv
│ │ ├── fecundity_data.csv
│ │ ├── floor_data.csv
│ │ ├── focal_positions.csv
│ │ ├── gdata.csv
│ │ ├── germination_data.csv
│ │ ├── location_data.csv
│ │ ├── max_biomass_data.csv
│ │ ├── max_biomass_fecund_data.csv
│ │ ├── mb_data_formodel.csv
│ │ ├── r_theory.csv
│ │ ├── reproduction_data.csv
│ │ ├── tradeoff_data.csv
│ │ ├── transect_water_data.csv
│ │ ├── transect_water_data_forplot.csv
│ │ ├── water_data_long.csv
│ │ └── water_data_wide.csv
│ ├── model_objects
│ │ ├── W0_model.RDS
│ │ ├── acwr_allometric_model.rds
│ │ ├── acwr_exp_model.rds
│ │ ├── allometric_exp_model.rds
│ │ ├── allometric_model.rds
│ │ ├── alpha_phenology.r
│ │ ├── alpha_phenology.rds
│ │ ├── basic_model_growth.rds
│ │ ├── basic_model_time.rds
│ │ ├── growth_model.RDS
│ │ ├── meter_tdr_model.rds
│ │ ├── multilevel_model.rds
│ │ ├── multilevel_model_sumcontrasts.rds
│ │ ├── null_floor_model.rds
│ │ ├── phenom_models
│ │ ├── swc_model.rds
│ │ └── transect_model.RDS
│ └── raw
│ ├── allometry_data_raw.csv
│ ├── allometry_for_biomass_raw.csv
│ ├── competitor_densities_raw.csv
│ ├── dry_biomass_focals_raw.csv
│ ├── dry_biomass_large_raw.csv
│ ├── focal_positions_raw.csv
│ ├── germination_data.csv
│ ├── large_allometry_raw.csv
│ ├── meta_data.xlsx
│ ├── plot_locations.kml
│ ├── plot_outline.kml
│ ├── plot_outline.kmz
│ ├── plot_treatments.csv
│ ├── reproduction_data.csv
│ ├── seed_avgs_raw.csv
│ ├── soil_water_raw.csv
│ ├── soil_water_transects_raw.csv
│ ├── swc_continuous_full_raw.csv
├── figures
├── scanned_data
└── tables
File/folder details
code/
- Description: contains all scripts used to clean and analyze data, and generate figures and tables from the paper. Full descriptions of sub-folders are described below. In general, scripts should be run in the numbered order. The one exception is that the models from
02_00-allometric_analysis.r
are needed for01_06-biomass_traj_cln.r
, so that script should be run out of order if running scripts individually from scratch. - Files
-
run_full_analysis.r
: script to re-run entire analysis. First clears all derived files, so be sure you want to run the full thing again. Takes a long time to complete depending on your machine. -
table_gen.r
: script to generate tables for appendix.
-
/code/00-utility
- Description: Contains "utility" files with function definitions, plotting standards, and package management.
- Files
-
head.R
: Loads common packages and utility files for use in general scripts. -
function_utility.R
: contains function definitions employed in analysis and data cleaning scripts. -
plot_generation.R
: function definitions used to generate figures from main text and appendices. -
plot_utility.R
: defines common plotting conventions to generate figures.
-
/code/01-data_cleaning
- Description: scripts to clean data files from
entered_data/raw
for use in subsequent analyses. - Files
-
01_00-plot_locations_cln.r
: imports.kml
file of plot locations and merges them with plot treatment assignments, saves result toentered_data/altered/location_data.csv
. -
01_01-competitor_densities.r
: calculates the density of competitor species in each plot and saves output toentered_data/altered_competitor_densities.csv
. -
01_02-water_cln.r
: imports raw volumetric soil water content data from point meas., transects, and continuous calibration plot measurements. Cleans data and saves output to:entered_data/altered/water_data_wide.csv
,entered_data/altered/water_data_long.csv
,entered_data/altered/cont_water_data.csv
,entered_data/altered/cont_water_data_long.csv
, andentered_data/altered/transect_water_data.csv
. -
01_03-allom_cln.r
: imports raw allometric data, cleans, calculates derived variables for analysis and saves toentered_data/altered/allom_rel_cleaned.csv
. -
01_04-biomass_samp_cln.r
: imports and cleans biomass sample data from sequential harvests, saves toentered_data/altered/biomass_samp_data.csv
-
01_05-fecundity_cln.r
: imports raw fruit production data and seed average data, calculates individual seed production, and saves output toentered_data/altered/reproduction_data.csv
. -
01_06-biomass_traj_cln.r
: uses allometric models generated in02_00-allometric_analysis.r
and sequential allometric data to estimate the biomass of focal individuals through time. Saves output toentered_data/altered/biomass_traj_data.csv
. -
01_07-focal_positions_cln.r
: cleans focal position raw data, saves toentered_data/altered/focal_positions.csv
. -
01_08-biomass_max_cln.r
: estimates end of season date (data of maximum biomass) from biomass trajectory data, saves output toentered_data/altered/max_biomass_data.csv
. -
01_09-biomass_repro_cln.r
: calculates species growth rates and merges with fecundity data to form full dataset, saves toentered_data/altered/max_biomass_fecund_data.csv
. -
01_10-germination_cln.r
: cleans germination trial data, saves toentered_data/altered/germination_data.csv
.
-
/code/02-data_analysis
- Description: contains scripts to perform the statistical analyses described in the main text and appendix.
- Files
-
02_00-allometric_analysis.r
: fit allometric models to field data and determine those with best fit. Models saved toentered_data/model_objects/allometric_model.rds
,entered_data/model_objects/acwr_allometric_model.rds
. -
02_01-water_analysis.r
: analyze relationships between competition, topography, and soil volumetric water content. -
02_02-fecundity_analysis.r
: assess alternative competitive pathways (competition for time vs. growth-mediated competition), fit Bayesian multilevel models to compare statistical support. -
02_03-growth_longevity_tradeoff.r
: determine whether species in the study follow a tradeoff between biomass growth rate and phenology of the kind predicted to support coexistence. -
02_04-phenomenlogical_model_fitting.r
: fit phenomenological competition models to demographc data, relies on scripts fromcode/02-data_analysis/stan
. -
02_05-phenomenological_model_analysis.r
: compare fit of phenomenological models to mechanistic model from competition for time theory. Also determine whether patterns in parameters match theoretical predictions. -
02_06-alphas_phenology.r
: assess whether patterns in alpha parameters from phenomenological competition models match predictions from theory. -
02_07-coexistence_predictions.r
: generate probabilistic predictions about species coexistence outcomes. -
02_08-abrupt_decline.r
: determine whether species cease growth rapidly or gradually at the end of the growing season, a key assumption of the theoretical model. -
02_09-basic_analysis.r
: a more primitive version of the analysis from02_02-fecundity_analysis.r
, just look at relationship between competition and growth rate vs. growing season length. -
stan/
: containsstan
scripts to fit phenomenological models for analyses.
-
/code/03-fig_gen
- Description: contains scripts to generate each data-figure from the appendix and main text, scripts are names by the figure number, S- figures denote figures from the appendix.
/entered_data
- Description: all digitized data from the paper.
- Files
-
/altered/
: all derived tabular data files generated during data cleaning and analysis. -
/model_objects/
: all model objects generated during cleaning and analysis, saved as.rds
files. -
/raw/
: raw data files, digitized from field data sheets. Metadata described inmeta_data.xlsx
.
-
/figures
- Description: where all figure files are output from scripts in
code/03-fig_gen
.
/scanned_data
- Description: scanned copies of original field data sheets.
/figures
- Description: where all figure files are output from scripts in
code/table_gen
, and from several analysis scripts.
Change log
December 29, 2023
A new version of the repository was uploaded to reflect changes made during the review process for the accompanying manuscript. Here is a summary of the changes made:
- Re-ordered and added new figure generation scripts to reflect changes to supplementary material. New files are:
S1.jl
,S2.jl
,S4.jl
andS20.r
. - Updated the following analysis files to incorporate new methods:
02-data_analysis/02_02-fecundity_analysis.r
, and02-data_analysis/02_08-abrupt_decline.r
March 13, 2024
A new version of the repository was uploaded to reflect changes made during the second round of the review process. Here is a summary of the changes made:
- Re-ordered and added a new figure generation script to reflect changes made to supplementary material. New files are:
S02.jl
. All higher-numberd figure files have been renamed to reflect this change and match the supplement. - Updated all files with relative path implementation to ensure simple portability for other users
- Added
renv
files to promote reproducibility
Methods
Please see the appendix of the associated manuscript for details on methodology and data processing.