Published October 2, 2025 | Version v7
Working paper Open

Two decades of community responses reveal a consistent increase in species occurrences in south-eastern Pacific rocky shores.

Creators

Contributors

Research group:

Description

Abstract:

Aim: Understanding how diverse communities respond to environmental fluctuations is a central challenge in modern ecology. Here, we assessed how intertidal communities responded to environmental variation over the past 23 years and evaluated the extent to which these responses can be associated with taxonomic relationships, as well as biological and ecological species traits.

Location: Central portion of the Humboldt Upwelling Ecosystem, with 22 rocky shore survey sites spanning eight degrees of latitude (28°S-36°S).

Time period: 2000-2023.

Major Taxa Studied: Intertidal zone communities.

Methods: We used joint species distribution models to integrate quantitative survey data, satellite sea surface temperature (SST) as a proxy for environmental conditions, taxonomic information, and species biological traits along a latitudinal gradient.

Results: Our proxy of environmental variation revealed stronger SST cooling at central sites, whereas sites near 30°S showed trends similar to those at more poleward locations. Taxonomic relationships and individual species traits were weakly associated with their collective responses to SST variability. However, we identified a consistent increase in the occurrence of both macroalgal and invertebrate species across the region. The occurrence of macroalgal species was more sensitive to SST variation than invertebrates, with responses shifting from positive at equatorward sites to increasingly negative at poleward sites. Patterns of species co-occurrence were strongly dependent on spatial scale, particularly among invertebrates.

Main Conclusions: Species occurrences increased across the region, but these responses were not significantly associated with taxonomic relatedness or with easily assigned species traits. This pattern likely reflects comparatively low niche conservatism within these communities in relation to SST responses, while other structuring processes—such as species interactions—are not well captured by the traits examined. As parts of the study region have cooled over the past two decades, our results suggest that the lack of community-wide reorganization reflects the persistence of thermal refugia.

Key words: community assembly; environmental drivers; multi-taxa; species-taxonomy; species-traits; species-responses.

Notes

README

Description

########################################################################################
This repository contains seven R scripts for setting up, fitting and post-processing HMSC analyses of intertidal species. 

Ensure that your “working directory” (setwd) includes the following folders: data, models, and results.

The scripts must be executed in the following order: S0, S1, S2, S3, S4, S5, and S6.
########################################################################################

S0: Data input
The S0 script defines the sampling effort and timing of each survey. It includes the macroalgae and invertebrates abundance datasets, species traits, taxonomy and sea surface temperature (SST) data.

Species abundance (and METADATA)
Running S0 will load two data frames: da1_algae (macroalgae) and da1_invr (invertebrates). Both have the same number of rows and columns, with following variables in columns 1-9:

SITE: All sampled sites (22 levels).
HEIGHT: Intertidal zone (3 levels: HIGH, MID and LOW).
N_CUA: Number of quadrats per survey (50 x 50 cm).
MONTH: Month of survey.
YEAR: Year of survey.
BENCH: Platform at each site (2 levels: 1 and 2).
SOUTHLAT: South Latitude of site.
WESTLONG: West Longitude of site.
SEASON: Season of survey.

The remaining columns contain the species recorded at each survey, depending on the data frame: da1_algae (macroalgae) or da1_invr (invertebrates). 

In da1_algae, species abundances are expressed as percentage cover (%). 

In da1_invr, species abundances are recorded according to mobility described in the species traits data frame (see below):

  • Sessile species: percentage cover (%).
  • Mobile species: number of individuals per quadrat.

########################################################################################

Species Traits and Taxonomy (and METADATA)
Species traits and taxonomy are defined in the data frames algae_tr (macroalgae) and invr_tr (invertebrates). Both data frames share the taxonomic classification but include different sets of traits.

  • algae_tr (macroalgae traits): 

LIFE_CYCLE_MOR: Life cycle (3 levels).
LIFESPAN: Life span (2 levels).
MAX_LENGTH_cm: Maximum length that the species would reach (cm).

  • invr_tr (invertebrates traits): 

TIERING: Tiering (3 levels).
FEEDING: Feeding mechanisms (4 levels).
LARVAL_DEV: Larval development (3 levels).
MAX_SIZE_cm: Maximum length that the species would reach (cm).

Species taxonomy is provided in the objects my.taxonomy_algae (macroalgae) and my.taxonomy_invr (invertebrates).

########################################################################################

Sea Surface Temperature (SST) data (and METADATA)
The data frame da2 contains five environmental predictors with following variables: 

SITE: All sampled sites (22 levels).
LAT: South Latitude of site.
LONG: West Longitude of site.
YEAR: Year of survey.
ANN_ANOM: Standardized annual SST anomaly per site.
ANN_MEAN: Annual mean SST per site.
qFifth: 5th quintile of SST per site.
qFifty: 50th quintile (median) of SST per site.
qNinety5: 95th quintile of SST per site.

########################################################################################

XDATA (and METADATA)
The essential data for HMSC analyses include a XDATA object, which is defined by five variables: 

year: Year of survey.
height: Intertidal zone (3 levels: HIGH, MID and LOW).
season: Season of survey.
ann_anom: Standardized annual SST anomaly per site.
ann_mean: Annual mean of SST per site.

########################################################################################

Setting up for HMSC models
By saving the objects described above in a single data frame (called “raw_data_hmsc”) in your data/ folder, you obtain the inputs required for the HMSC analyses:

1) Y_algae and Y_invr: Matrices of intertidal species abundances (macroalgae and invertebrates, respectively).
2) X_Data: Matrix of environmental predictors.
3) TrData_algae and TrData_invr: Macroalgal and invertebrate traits.
4) my.taxonomy_algae and my.taxonomy_invr: Phylogenetic-taxonomic relationships.
5) studyDesign: Spatiotemporal sampling design of the study.

###################################END#################################################

S1: Define models
To define the HMSC models, start by loading the raw_data_hmsc object:
load("data/raw_data_hmsc.RData")

This will load eight data frames:

1)    First and second: "my.taxonomy_algae" and "my.taxonomy_invr".
Taxonomic classification tables (6 columns): kingdom, phylum, family, genus, species.

2)    studyDesign.
Spatiotemporal sampling design (3 columns): site, bench, year.

3)   TrData_algae and TrData_invr.
Species traits tables:

  • TrData_algae (3 columns): life_cycle, max_length", lifespan".
  • TrData_invr (4 columns): tiering, feeding, larva, max_size.

 4)    XData.
Environmental predictors (4 columns): year, height, ann_anom, ann_mean.

 5)    Y_algae and Y_invr.
Species abundances matrices:

  • Y_algae: 54 macroalgal species.
  • Y_invr: 57 invertebrate species.

########################################################################################

Saving model definitions: Once the objects have been loaded and structured, define and save the initial HMSC models for both presence-absence and abundance of macroalgae and invertebrates. Stored these model objects in the models/ folder so they are available for the subsequent steps (S2-S6), which involve fitting, evaluating, and postprocessing.

########################################################################################

End of S1: At this stage, you have prepared the data, defined the model structures, and saved the base models. Proceed to S2, where the models are fitted.

###################################END#################################################

S2: Check MCMC convergence
Evaluates MCMC convergence of the fitted HMSC models.

Input: fitted models objects.
Output: convergence diagnostics and plots (results/MCMC_convergence.txt and results/MCMC_convergence.pdf).

###################################END#################################################

S3: Evaluate model fit (CV + WAIC)
Computes in-sample fit (MF), cross-validated fit (MFCV) via n-fold CV, and WAIC for the fitted HMSC models across increasing MCMC lengths (matching S2 runs).

Input: fitted models objects (models_thin_*_samples_*_chains_4.Rdata).
Output: MF, MFCV, and WAIC saved to models/MF_thin_*_samples_*_chains_4_nfolds_*.Rdata.
Notes: defaults to 2-fold CV; supports parallel evaluation via nParallel. 

###################################END#################################################

S4: Visualize model fit (explanatory vs. predictive)
Loads the latest model-fit objects (MF/MFCV) and plots in-sample vs. cross-validated performance for each model: Tjur R², R², AUC, and SR².

Input: models/MF_thin_*_samples_*_chains_4_nfolds_*.Rdata (highest available run auto-selected).
Output: results/model_fit_nfolds_<n>.pdf with scatterplots of explanatory vs. predictive power.
Note: defaults to 2-fold CV unless n-folds is changed.

###################################END#################################################

S5: Parameter estimates & variance partitioning
Generates summaries and plots of parameter estimates and variance partitioning, including trait effects and species associations.

Input: fitted models (models_thin_*_samples_*_chains_4.Rdata)
Output:

  • parameter_estimates.pdf (variance partitioning, Beta, Gamma, Omega plots).
  • parameter_estimates.txt (species order/orderings).
  • CSV/XLSX files with numerical estimates (Beta, Gamma, Omega, VP).

###################################END#################################################

S6: Site-specific community responses (CWMR)
Computes community-weighted mean responses (CWMR) per site for each covariate using posterior Beta estimates, for both occurrence and abundance; also summarizes fractions of positively/negatively supported effect (≥0.95).

Input: models/models_thin_100_samples_250_chains_4.Rdata.
Output: site_specific_responses_<model>.RData containing:           

  • CWMR.occurrence, CWMR.abundance.
  • pos.occurrence, pos.abundance, neg.occurrence, neg.abundance.

###################################END#################################################

Files

all_species_algae_v3.csv

Files (1.9 MB)

Name Size Download all
md5:77535a0ce2dec7ca99b4de4257c45250
6.3 kB Preview Download
md5:94e39542127bc91f2892b26bb07ca587
6.4 kB Preview Download
md5:3a6a01f5b5f31cf6e363b8510b24691b
30.7 kB Preview Download
md5:a6d9a4e29b0cfacd20a4af08e3b30933
893.5 kB Preview Download
md5:8aa73245585191b6e7ed523224bcc1f1
891.8 kB Preview Download
md5:0839ee966f8b5b9520aac558ea3f4653
7.5 kB Download
md5:6fdd01830b8f0e7c1c9d8af661966aa2
7.8 kB Download
md5:efdd509817d0d03ceafd9fe716d0bf82
9.9 kB Download
md5:9dc11d2dd353d1cfd142045068cee08a
6.4 kB Download
md5:f40429440d6cf62930eed2326d785f4b
8.3 kB Download
md5:2f728e380e483d5f9ed99e1af2f5fd93
15.7 kB Download
md5:c4ea0f24fb09a8767b6322f7ca138836
3.3 kB Download

Additional details

Dates

Updated
2025-07-17
in review

Software

Programming language
R

References

  • Ovaskainen, O. & Abrego, N. (2020). Joint Species Distribution Modelling. First. Cambridge University Press, Padstow, UK