DOI: 10.5061/dryad.8gtht76wc
title: A hierarchical model for eDNA fate and transport dynamics accommodating low concentration samples

description: Environmental DNA (eDNA) sampling is an increasingly important tool for
 answering ecological questions and informing aquatic species management;
 however, several factors currently limit the reliability of ecological
 inference from eDNA sampling. Two particular challenges are 1) determining
 species source location(s) and 2) accurately and precisely measuring low
 concentration eDNA samples in the presence of multiple sources of
 ecological and measurement variability. The recently introduced eDNA
 Integrating Transport and Hydrology (eDITH) model provides a framework for
 relating eDNA measurements to source locations in riverine networks, but
 little empirical work has been done to test and refine model assumptions
 or accommodate low concentration samples, that can be systematically
 undermeasured. To better understand eDNA fate and transport dynamics and
 our ability to reliably quantify low concentration samples, we developed a
 hierarchical model and used it to evaluate a fate and transport
 experiment. Our model addresses several low concentration challenges by
 modeling the number of copies in each PCR replicate as a latent variable
 with a count distribution and conditioning detection and quantification on
 replicate copy number. We provide evidence that the eDNA removal rate
 declined through time, estimating that over 80% of eDNA was removed over
 the first 10 meters, traversed in 41 seconds. After this initial period of
 rapid decay, eDNA decayed slowly with consistent detection through our
 farthest site 1 km from the release location, traversed in 67.8 minutes.
 Our model further allowed us to detect extra-Poisson variation in the
 allocation of copies to replicates. We extended our hierarchical model to
 accommodate a continuous effect of inhibitors and used our model to
 provide evidence for the inhibitor hypothesis and explore the potential
 implications. While our model is not a panacea for all challenges faced
 when quantifying low-concentration eDNA samples, it provides a framework
 for a more complete accounting of uncertainty.
description: # A Hierarchical Model for eDNA Fate and Transport Dynamics Accommodating
 Low Concentration Samples
 [https://doi.org/10.5061/dryad.8gtht76wc](https://doi.org/10.5061/dryad.8gtht76wc) ## Description of the data and file structure The field data are located in greenhollow_techrep 12_4_2.csv on Dryad. Metadata for greenhollow_techrep 12_4_2.csv is in green hollow metadata.csv on Dryad. **Empirical Analysis** 1\. The data are in greenhollow_techrep 12_4_23. 2\. The nimble release model files are "Release NimModel X.R", where X is one of the four models: PL, Exponential, Inhibitor PL, and Inhibitor Exponential. 3\. Custom MCMC functions (inhibitor models only) are in "State Samplers.R". 4\. Test scripts to run 1 chain for each model are in "Run X.R". 5\. Scripts to run multiple chains in parallel for each model are in "Run X Parallel.R". 6\. The multi-chain posteriors from 5 above are stored in "S1.R", "S1b.R", "S2.R", and "S2b.R", which correspond to Inhibitor PL, Inhibitor Exponential, PL, and Exponential. These posteriors are plotted in .pdf files with the same names. 7\. The script to process the multi-chain posteriors is "Process Models.R". 8\. Scripts to run 1 chain for each model to compute conditional WAIC are in "Run X WAIC conditional.R" 9\. Output from the WAIC scripts from 8 are "output_WAIC_conditional_X.R". 10\. Scripts to run 1 chain for each model to compute WAIC at the sample level are in "Run X WAIC reduced.R" 11\. Output from the reduced WAIC scripts from 10 are "output_WAIC_reduced_X.R". 12\. The script to process the WAIC results is "Process WAIC.R". 13\. The script to do posterior predictive checks is "PP Checks.R". 14\. The file to plot the raw data is "Plot Cq shift.R". 15\. The model file for the cooler models is "Cooler NimModel.R" 16\. The script to run the cooler models is "Run Cooler.R". 17\. The MCMC samples from the cooler model are in "CoolerFit.RData". 18\. The file to process the cooler MCMC samples is "Process Cooler.R". 19\. .jpg files are produced in the files used for processing. **Simulation** 1\. Test scripts to simulate data and fit models are "testscript X.R", where X is one of the four models: PL, Exponential, Inhibitor PL, and Inhibitor Exponential. 2\. Data simulators for the null and inhibitor models are "sim.data.R" and "sim.data.inhibitor.R". 3\. The nimble model files are "Release NimModel X.R". 4\. Custom MCMC functions (inhibitor models only) are in "State Samplers.R". 5\. The code used to simulate data used in Simulation Study 1 is "Simulate Datasets X", where X is S1-S4. S1=inhibitor PL, S2=inhibitor exponential, S3=null PL, S4=null exponential. 6\. The simulate data sets are "SX_datasets.RData", where X=1-4. 7\. Files to fit the model for each simulated data set in parallel are "Run Parallel Inhibitor SX.R", for X in 1,2, and "Run Parallel SX.R" for X in 3,4. 8\. The files in 7 store the posteriors in the folders "Sims_SX". 100 data sets x 3 chains x 4 models. 9\. The files to process the simulation posteriors are in "Process Sims SX.R". 10\. Files in 9 produce plots and tables for each model, "SX.summary.RData". 11\. After 10, the file to combine results across these models is "Combine Scenario Results.R". This is just used to make a table. Changes dated on 5t Nov 2024: The data are unchanged. We made changes to the analysis code to accommodate reviewer requests. Broadly, 1) we modified the power law process model so it is defined at a distance of 0, 2) we modified how WAIC is computed and 3) we removed simulation study B. ## Code/Software All files used for data analysis and resulting files (posteriors, etc.) are in the "Empirical Analysis" folder on Zenodo. All files used for simulation analyses are in the "Simulation Analysis" folder on Zenodo, as are all simulation results (posteriors, etc.).