DOI: 10.5061/dryad.x3ffbg7w0
title: Time-varying flow-ecology relationships for an endangered fish population: Longfin Smelt in the San Francisco Estuary

description: Major estuaries globally are experiencing steep changes in hydrology and
 ecosystem dynamics. However, connecting alteration of river flow regimes
 to fish population dynamics remains a challenge, partly due to the
 untested assumption that flow regimes, fish dynamics, and the resulting
 flow-ecology relationships are stationary (i.e., with no systematic
 changes in mean or variance over time). Here, we studied the endangered
 population segment of the Longfin Smelt (Spirinchus thaleichthys) in the
 San Francisco Estuary, which depends on seasonal river flows to reproduce.
 We used extensive biomonitoring data (1980-2020) and two time-series
 modeling techniques, Multivariate Autoregressive State-Space models
 (MARSS) and Dynamic Linear models (DLM), to understand how population
 dynamics respond to interannual flow variation, and whether flow-ecology
 relationships have changed over time. MARSS outputs showed that population
 trajectories are best explained by a combination of lateral and vertical
 dimensions of habitat structure, i.e., whether individuals were collected
 in channels vs. shoals, and in pelagic vs. benthic environments. In turn,
 DLM models revealed time-varying, but often positive effects of flow on
 young-of-the-year abundance in shallow channel and shoal habitats, but no
 consistent relationships for older individuals (age-1+), likely due other
 drivers of survival between age-0 and age-1+. Finally, we found that
 inferences from the two modeling approaches converged only in about 30% of
 the cases. Divergence in the sign and/or magnitude of flow effects
 suggests that time-averaged approaches may oversimplify non-stationary
 relationships between the environment and fish population dynamics. From a
 conservation standpoint, the gradually weakening but positive flow-ecology
 relationship (as opposed to a step change in the relationship) suggests it
 may still be possible to reverse the steep population declines of Longfin
 Smelt through a combination of flow and habitat restoration actions. While
 we focused on a particular endangered population, our quantitative
 approach is transferable to other taxa and geographies, and could help
 inform management of flow-dependent resources in systems strongly affected
 by non-stationarity. We contend that time-varying flow-ecology
 relationships are needed to capture ecological realism, and could help
 design more effective conservation strategies in fast-changing
 environments.
description: # Reference
 Information ## Provenance for this README * File name:
 README_Dataset-LFS-models_v1.0.0.txt * Authors: Parsa Saffarinia * Other
 contributors: Albert Ruhi, Stephanie Carlson, Jim Hobbs * Date created:
 2024-11-06 ## Dataset Version and Release History * Current Version: *
 Number: 2.0.0 * Date: 2026-01-09 * Persistent identifier:
 10.5061/dryad.x3ffbg7w0 * Summary of changes: see Change Log * Embargo
 Provenance: n/a * Scope of embargo: n/a * Embargo period: n/a ## Dataset
 Attribution and Usage * Dataset Title: Data for the article
 "Time-varying flow-ecology relationships for an endangered fish
 population: Longfin Smelt in the San Francisco Estuary" * Persistent
 Identifier: 10.5061/dryad.x3ffbg7w0 * Dataset Contributors: * Creators:
 Parsa Saffarinia, James Hobbs, Stephanie Carlson, and Albert Ruhi * Date
 of Issue: n/a * Publisher: n/a * License: Use of these data is covered by
 the following license: * Title: CC0 1.0 Universal (CC0 1.0) *
 Specification:
 [https://creativecommons.org/publicdomain/zero/1.0/deed.en](https://creativecommons.org/publicdomain/zero/1.0/deed.en); the authors respectfully request to be contacted by researchers interested in the re-use of these data so that the possibility of collaboration can be discussed. * Suggested Citations: * Dataset citation: &gt; Saffarinia, P, Hobbs, J.A., Carlson, S.M., and Ruhi, A. 2025. “Time-varying flow-ecology relationships for an endangered fish population: Longfin Smelt in the San Francisco Estuary”, Dryad, Dataset * Corresponding publication: &gt; Saffarinia, P, Hobbs, J.A., Carlson, S.M., and Ruhi, A. 2025. “Time-varying flow-ecology relationships for an endangered fish population: Longfin Smelt in the San Francisco Estuary, Ecological Applications. Contact Information * Name: Parsa Saffarinia * Affiliations: Department of Environmental Science, Policy, and Management, University of California, Berkeley; Department of Biology, California State University, Chico * ORCID ID: [https://orcid.org/0000-0003-3114-1458](https://orcid.org/0000-0003-3114-1458) * Email: [psaffarinia@csuchico.edu](mailto:psaffarinia@csuchico.edu) * Address: e-mail preferred --- # Additional Dataset Metadata ## Acknowledgements * Funding sources: PS was supported by the Delta Stewardship Council, California Sea Grant, and the California State Water Contractors through a Delta Science Fellowship R/SF-116. --- # Methodological Information * Methods of data collection/generation: see manuscript for details # Units and Missing Data Unless otherwise noted, units of measure are as follows:\ • Outflow, inflow: cubic feet per second • Depth (Secchi): meters (m)\ •CPUE (Catch per Unit Effort): number of Longfin Smelt captured per trawl tow, standardized by gear type (midwater or otter trawl), representing relative abundance. • Slopes, coefficients, and indices: unitless or standardized values derived from model outputs\ •“NA” values in all datasets indicate data not available (missing measurement or model output). # Data and File Overview ## Summary Metrics * File count: 29 * Total file size: 870 KB * Range of individual file sizes: 430 B - 195 KB * File formats: .csv, .R ## Table of Contents * 1_fit_LFS_MARSS_spatial_groupings.R * 2_fit_LFS_MARSS_flow_covariate_models.R * 3_fit_LFS_DLM_multivariate_flow_models.R * 4_fit_LFS_DLM_multivariate_lagged_flow_models.R * 5_plot_LFS_MARSS_states_and_DLM_slopes.R * 6_calculate_time_averaged_DLM_slopes.R * 7_plot_LFS_CPUE_vs_outflow.R * 8_calculate_LFS_TheilSen_trends_and_CV.R * 9_plot_LFS_TheilSen_trends_and_CV.R * 10_plot_LFS_FMWT_index_vs_outflow.R * annual_average_deltawide_flow_jan_june.csv * annual_averages_secchi_baywide_filtered.csv * dayflow_from_DLM.csv * DLM_slopes_age_0_averaged.csv * DLM_slopes_age_0.csv * DLM_slopes_age_1_averaged.csv * DLM_slopes_age_1_lagged_averaged.csv * DLM_slopes_age_1_laggedflow.csv * DLM_slopes_age_1.csv * marss_DLM_covariate_coefficients.csv * marss_out_age0_annualav_50percent_years_sampled_70_percent_zeros.csv * marss_out_age1plus_annualav_50percent_years_sampled_70_percent_zeros.csv * MWT_OT_site_complete.csv * z6_states_age0.csv * z6_states_age1_.csv * MWT_OT_site_thielsen.csv * theil_sen_cv_results_V2.csv * LONSME_FMWT_Indicies.csv * daily_mean_out_jan_jun_cfs.csv Setup --- * Recommended software/tools: RStudio 2022.10.31; R version 4.2.2 --- # File/Folder Details ## Details for: 1_fit_LFS_MARSS_spatial_groupings.R * Description: an R Source File which contains code to run MARSS models for age-0 and age-1+ groups of Longfin Smelt. Data for Longfin Smelt CPUE was extracted from Bay Study ([https://wildlife.ca.gov/Conservation/Delta/Bay-Study](https://wildlife.ca.gov/Conservation/Delta/Bay-Study)) and the DeltaFish package ([https://delta-stewardship-council.github.io/deltafish/](https://delta-stewardship-council.github.io/deltafish/)). This code tests our 6 hypotheses for trends in Longfin Smelt across the San Francisco Estuary. With AIC testing, hypothesis 6 (midwater/otter trawl and channel/shoal specific trends) is determined as the best model and those states are extracted for further analysis. The following scripts (1-6) are numbered in the order that they should be run. See manuscript for details. * Format(s): .R * Size(s): 24 KB * Dimensions: N/A ## Details for: 2_fit_LFS_MARSS_flow_covariate_models.R * Description: an R Source File which contains code to run MARSS models with a covariate matrix (flow) for age-0, age-1+, and 1+ with one-year lagged flow. These MARSS models use extracted states from the first MARSS models (step 1) which determined the most support for hypothesis 6 (channel/shoal & gear-specific trends). Building upon the first model, these MARSS models use a covariate matrix of flow to determine the effect of flow on the habitat and gear structured Longfin Smelt CPUE states. See manuscript for details. * Format(s): .R * Size(s): 34 KB * Dimensions: N/A ## Details for: 3_fit_LFS_DLM_multivariate_flow_models.R * Description: an R Source File which contains code to run multivariate DLMS using calculated states from the first MARSS models which found habitat (channel/shoal) and gear type (otter/midwater trawl) as best in explaining trends in Longfin Smelt CPUE. Outflow is used in the models to test for the strength of the time-varying relationship between outflow and Longfin Smelt. * Format(s): .R * Size(s): 24 KB * Dimensions: N/A ## Details for: 4_fit_LFS_DLM_multivariate_lagged_flow_models.R * Description: an R Source File which contains code to run multivariate DLMS using calculated states from the first MARSS models which found habitat (channel/shoal) and gear type (otter/midwater trawl) as best in explaining trends in Longfin Smelt CPUE. One-year lagged outflow is used in the models to test for the strength of the time-varying relationship between outflow and Longfin Smelt through delayed effects for age 1+ * Format(s): .R * Size(s): 14 KB * Dimensions: N/A ## Details for: 5_plot_LFS_MARSS_states_and_DLM_slopes.R * Description: an R Source File which contains code to plot outflow, MARSS states calculated by the first marss model, and DLM slopes with confidence intervals (age-0, age-1+, and age-1+ with lagged outflow). To run this code, all of the DLMs from steps 3 and 4 (from files "3_fit_LFS_DLM_multivariate_flow_models.R" and "4_fit_LFS_DLM_multivariate_lagged_flow_models.R") need to be in the working environment. * Format(s): .R * Size(s): 6 KB * Dimensions: N/A ## Details for: 6_calculate_time_averaged_DLM_slopes.R * Description: an R Source File which contains code to calculate a "time-averaged" DLM slope where all slopes calculated in the DLM (steps 3 and 4) are averaged so there is one value to compare results to the MARSS model with C-matrix. * Format(s): .R * Size(s): 12 KB * Dimensions: N/A ## Details for: 7_plot_LFS_CPUE_vs_outflow.R * Description: an R Source File which contains code to plot Longfin Smelt CPUE of all ages against outflow and adds a trendline to the datapoints. * Format(s): .R * Size(s): 3 KB * Dimensions: N/A ## Details for: 8_calculate_LFS_TheilSen_trends_and_CV.R * Description: an R Source File which contains code to calculate Theil-Sen trends, means, significance, and coefficient of variation (CV) for CPUE data. * Format(s): .R * Size(s): 6 KB * Dimensions: N/A ## Details for: 9_plot_LFS_TheilSen_trends_and_CV.R * Description: an R Source File which contains code to plot Theil-Sen trends, means, coefficient of variation (CV), and linear models examining the relationship between Theil-Sen and CV for CPUE data. * Format(s): .R * Size(s): 12 KB * Dimensions: N/A ## Details for: 10_plot_LFS_FMWT_index_vs_outflow.R * Description: an R Source File which reads Longfin Smelt Fall Midwater Trawl (FMWT) index data and January–June outflow summaries, and fits and plots the relationship between the FMWT index and outflow across three time periods (pre-clam invasion, pre-pelagic organism decline (POD), and post-POD). The script creates stanza-specific scatterplots and regression models for the FMWT index versus current and lagged outflow. See manuscript for details. * Format(s): .R * Size(s): 6 KB * Dimensions: N/A ## Details for: annual_average_deltawide_flow_jan_june.csv * Description: a comma-delimited file containing annual averages of modeled flow from the CDFW DAYFLOW ([https://data.cnra.ca.gov/dataset/dayflow](https://data.cnra.ca.gov/dataset/dayflow)) dataset for months of january-june. See manuscript for details. * Format(s): .csv * Size(s): 10 KB * Dimensions: 52 rows x 5 columns * Variables: * Calendar_Year: Calendar year of flow * Mean_outflow_CY: Averaged flow from january-june of each year for outflow * Mean_inflow_CY: Averaged flow from january-june of each year for inflow * Water_year: Water year of flow * Mean_outflow_WY: Averaged flow from january-june of each year for outflow, by water year * Full dataset is available at [https://data.cnra.ca.gov/dataset/dayflow](https://data.cnra.ca.gov/dataset/dayflow) ## Details for: annual_averages_secchi_baywide_filtered.csv * Description: a comma-delimited file containing annual averages for secchi measured in the BayStudy dataset separated by channel and shoal habitat. See manuscript for details. * Format(s): .csv * Size(s): 2 KB * Dimensions: 79 rows x 3 columns * Variables: * Year: Calendar year * ChanShoal: channel or shoal values (1 or 2) * annual_average: averaged secchi value by channel and shoal ## Details for: dayflow_from_DLM.csv * Description: a comma-delimited file containing transformed annual averages of outflow from the dayflow dataset. See manuscript for details. * Format(s): .csv * Size(s): 980 B * Dimensions: 42 rows x 2 columns * Variables: * Mean_outflow: transformed outflow from dayflow dataset * Year: corresponding year for each outflow value ## Details for: DLM_slopes_age_0_averaged.csv * Description: a comma-delimited file containing age-0 Longfin Smelt time-averaged DLM slopes for each group: channel, shoal, midwater trawl, otter trawl. * Format(s): .csv * Size(s): 430 B * Dimensions: 5 rows x 7 columns * Variables: * ChanShoal: a value of 1 or 2 for channel and shoal sites * gear: midwater trawl or otter trawl * DLM_slope: the average DLM slope across all timesteps * DLM_SE: standard error for DLM slope across all timesteps * Lower_95CI: lower 95% CI for DLM slope across all timesteps * Upper_95CI: upper 95% CI for DLM slope across all timesteps ## Details for: DLM_slopes_age_0.csv * Description: a comma-delimited file containing calculated slopes for age-0 Longfin Smelt from the DLM. See manuscript for details. * Format(s): .csv * Size(s): 16 KB * Dimensions: 165 rows x 8 columns * Variables: * Year: Year of sample * ChanShoal: channel or shoal by a 1 or 2 value * gear: midwater trawl or otter trawl * DLM_slope: calculated DLM slope at each timestep * DLM_SE: calculated DLM standard error at each timestep * Lower_95CI: lower 95% confidence interval per timestep * Upper_95CI: upper 95% confidence interval per timestep ## Details for: DLM_slopes_age_1_averaged.csv * Description: a comma-delimited file containing age-1+ Longfin Smelt time-averaged DLM slopes for each group: channel, shoal, midwater trawl, otter trawl. . See manuscript for details. * Format(s): .csv * Size(s): 455 B * Dimensions: 5 rows x 7 columns * Variables: * ChanShoal: a value of 1 or 2 for channel and shoal sites * gear: midwater trawl or otter trawl * DLM_slope: the average DLM slope across all timesteps * DLM_SE: standard error for DLM slope across all timesteps * Lower_95CI: lower 95% CI for DLM slope across all timesteps * Upper_95CI: upper 95% CI for DLM slope across all timesteps ## Details for: DLM_slopes_age_1_lagged_averaged.csv * Description: a comma-delimited file containing age-1+ Longfin Smelt time-averaged DLM slopes with one year lagged outflow for each group: channel, shoal, midwater trawl, otter trawl. . See manuscript for details. * Format(s): .csv * Size(s): 451 B * Dimensions: 5 rows x 7 columns * Variables: * ChanShoal: a value of 1 or 2 for channel and shoal sites * gear: midwater trawl or otter trawl * DLM_slope: the average DLM slope across all timesteps * DLM_SE: standard error for DLM slope across all timesteps * Lower_95CI: lower 95% CI for DLM slope across all timesteps * Upper_95CI: upper 95% CI for DLM slope across all timesteps ## Details for: DLM_slopes_age_1_laggedflow.csv * Description: a comma-delimited file containing calculated slopes for age-1+ Longfin Smelt with one year lagged outflow from the DLM. See manuscript for details. * Format(s): .csv * Size(s): 17 KB * Dimensions: 165 rows x 8 columns * Variables: * Year: Year of sample * ChanShoal: channel or shoal by a 1 or 2 value * gear: midwater trawl or otter trawl * DLM_slope: calculated DLM slope at each timestep * DLM_SE: calculated DLM standard error at each timestep * Lower_95CI: lower 95% confidence interval per timestep * Upper_95CI: upper 95% confidence interval per timestep ## Details for: DLM_slopes_age_1.csv * Description: a comma-delimited file containing calculated slopes for age-1+ Longfin Smelt from the DLM. See manuscript for details. * Format(s): .csv * Size(s): 17 KB * Dimensions: 165 rows x 8 columns * Variables: * Year: Year of sample * ChanShoal: channel or shoal by a 1 or 2 value * gear: midwater trawl or otter trawl * DLM_slope: calculated DLM slope at each timestep * DLM_SE: calculated DLM standard error at each timestep * Lower_95CI: lower 95% confidence interval per timestep * Upper_95CI: upper 95% confidence interval per timestep ## Details for: marss_DLM_covariate_coefficients.csv * Description: a comma-delimited file containing outputs from all MARSS models with covariates and DLMs for all age classes. DLM outputs are averaged at all timesteps to facilitate comparison with MARSS outputs. See manuscript for details. * Format(s): .csv * Size(s): 2 KB * Dimensions: 13 rows x 11 columns * Variables: * ChanShoal: a value of 1 or 2 for channel and shoal sites * gear: midwater trawl or otter trawl * ageclass: 0, 1, or 1_cont, which is age 1+ fish with lagged outflow * X: a grouping factor for analysis * DLM_slope: the average DLM slope across all timesteps * DLM_SE: standard error for DLM slope across all timesteps * Lower_95CI_DLM: lower 95% CI for DLM slope across all timesteps * Upper_95CI_DLM: upper 95% CI for DLM slope across all timesteps * marss_coefficient: MARSS coefficient for each group * LowerCI_marss: lower 95% confidence interval for MARSS model * UpperCI_marss: upper 95% confidence interval for MARSS model ## Details for: marss_out_age0_annualav_50percent_years_sampled_70_percent_zeros.csv.csv * Description: a comma-delimited file containing annual averages of Longfin Smelt CPUE for age-0 fish paired with relevant variables for MARSS analysis. See manuscript for details. * Format(s): .csv * Size(s): 137 KB * Dimensions: 1897 rows x 9 columns * Variables: * Year: year of sample * Station: station sample was collected in Bay Study dataset * Bay: embayment category * ChanShoal: channel and shoal delinated by a 1 or 2. * Region: regions within the Estuary as defined by CDFW * Gear: midwater trawl or otter trawl * CPUE: annual average of CPUE * Region_combined: combined region category that avoided convergence errors ## Details for: marss_out_age1plus_annualav_50percent_years_sampled_70_percent_zeros.csv * Description: a comma-delimited file containing annual averages of Longfin Smelt CPUE for age-1+ fish paired with relevant variables for MARSS analysis. See manuscript for details. * Format(s): .csv * Size(s): 138 KB * Dimensions: 1897 rows x 9 columns * Variables: * Year: year of sample * Station: station sample was collected in Bay Study dataset * Bay: embayment category * ChanShoal: channel and shoal delinated by a 1 or 2. * Region: regions within the Estuary as defined by CDFW * Gear: midwater trawl or otter trawl * CPUE: annual average of CPUE * Region_combined: combined region category that avoided convergence errors ## Details for: MWT_OT_site_complete.csv * Description: a comma-delimited file containing raw values of interest imported from Deltafish ([https://delta-stewardship-council.github.io/deltafish/](https://delta-stewardship-council.github.io/deltafish/)) package to use from the Bay Study dataset. See manuscript for details. * Format(s): .csv * Size(s): 199 KB * Dimensions: 1389 rows x 15 columns * Variables: * Year: year of sample * Station: station sample was collected in Bay Study dataset * Bay: embayment category * gear_chanshoal: a combination of gear and channel/shoal categories to test in first MARSS model * ChanShoal: channel and shoal delinated by a 1 or 2. * Region: regions within the Estuary as defined by CDFW * gear_embayment: a combination of the gear and embayment categories to test in first MARSS model * gear_region: a combination of the gear and embayment catefories to test in first MARSS model * Gear: midwater trawl or otter trawl * CPUE: annual average of CPUE * Region_combined: combined region category that avoided convergence errors * embayment: embayments as defined in the Bay Study dataset * estuary: one estuary trend defined to test in the first MARSS model * StationGear: a combination of stations and gear types to test in the first MARSS model ## Details for: z6_states_age0.csv, z6_states_age1_.csv * Description: a comma-delimited file containing the extracted calculated states for age-0 Longfin Smelt from the best MARSS model testing for trends. The best model was hypothesis 6, which explained trends structuredby gear type and habitat (channel or shoal). See manuscript for details. * Format(s): .csv * Size(s): 7 KB * Dimensions: 165 rows x 5 columns * Variables: * gear_channelshoal: grouping of gear and habitat type. * Year: sample year * states: extracted states from MARSS model * ageclass: delinates age of fish in MARSS model ## Details for: MWT_OT_site_thielsen.csv * Description: a comma-delimited file containing the CPUE values and associated station data for calculating Theil-Sen trends. See manuscript for details. * Format(s): .csv * Size(s): 199 KB * Dimensions: 1389 rows x 15 columns * Variables: * Year: year of sample * Station: station sample was collected in Bay Study dataset * Bay: embayment category * gear_chanshoal: a combination of gear and channel/shoal categories * ChanShoal: channel and shoal delinated by a 1 or 2. * Region: regions within the Estuary as defined by CDFW * gear_embayment: a combination of the gear and embayment categories * gear_region: a combination of the gear and embayment catefories * Gear: midwater trawl or otter trawl * CPUE: annual average of CPUE * Region_combined: combined region category that avoided convergence errors * embayment: embayments as defined in the Bay Study dataset * estuary: one estuary trend defined to test in the first MARSS model * StationGear: a combination of stations and gear types --- ## Details for: theil_sen_cv_results_V2.csv * Description: a comma-delimited file containing the extracted Theil-Sen slopes, intercepts, and CVs by station combination. See manuscript for details. * Format(s): .csv * Size(s): 3 KB * Dimensions: 49 rows x 5 columns * Variables: * Station: Station from Bay Study dataset * gear_chanshoal: gear and channel/shoal combination for each datapoint * Trend: Theil-Sen trend * Intercept: Intercept from Theil-Sen model * CV: calculated coefficient of variation ## Details for: LONSME_FMWT_Indicies.csv * Description: a comma-delimited file containing Longfin Smelt Fall Midwater Trawl (FMWT) index values by year, with monthly indices for September–December and the annual FMWT index used in the flow-index analyses. See manuscript for details. * Format(s): .csv * Size(s): 1 KB * Dimensions: 56 rows x 6 columns * Variables: * yr: calendar year * sep: September FMWT index * oct: October FMWT index * nov: November FMWT index * dec: December FMWT index * FMWT_index: summed or composite FMWT index used in the analyses ## Details for: daily_mean_out_jan_jun_cfs.csv * Description: a comma-delimited file containing January–June daily mean outflow summaries used to relate outflow to the Longfin Smelt FMWT index. Outflow is measured in cubic feet per second (cfs) and summarized at the water-year scale. See manuscript for details. * Format(s): .csv * Size(s): 4 KB * Dimensions: 57 rows x 6 columns * Variables: * Unnamed: 0: row index * Water_Year: water year corresponding to the January–June period * mu: mean daily outflow (cfs) from January–June * sd: standard deviation of daily outflow (cfs) from January–June * sum: summed daily outflow (cfs) from January–June * logsum: natural-log-transformed summed outflow