How can I model era-specific climate effects using a brms SEM

Hi everyone,

I’m using the brms package to build a structural equation model (SEM) examining potential body size shifts in response to climate change across elevation. My dataset includes body size, average temperature, precipitation, and humidity; elevation; species; sex; and a categorical variable for era (historical vs. contemporary). I also incorporate a phylogenetic covariance matrix into the SEM. The dataset is large (~12,000 records), and I’ve had no convergence issues so far.

Below is my current model structure. The variable Era influences the climate variables to capture temporal shifts in climate, while Elevation influences the climate variables to represent spatial variation. I include interactions between Elevation and Era in the three climate paths, as changes in climate variables over time have occurred at varying magnitudes across elevations. Consequently, we expect body size shifts to vary across space.

temp.mod <- bf ( temperature ~ Elevation * Era)
precip.mod <- bf ( precipitation ~ Elevation * Era)
humid.mod <- bf ( humidity ~ temperature  + precipitation + Elevation * Era)
svl.mod <- bf ( Body Size ~ temperature + precipitation + humidity +  Era + Elevation
                (1 + Sex | Species) + (1 | gr(phylo, cov = A)))

brm(
  temp.mod + 
  precip.mod + 
  humid.mod + 
  svl.mod +
    set_rescor(FALSE),
  family = gaussian(),  
  data = Sal_Micro,
  data2 = list(A = A)
….)

In previous work, I ran a similar SEM on just the historical data (removing Era) and found that substantial effects of climate on body size. However, in the current model, the effects of climate on body size are very weak. I suspect this may stem from how correlations between climate variables change over time (see correlation matrices below). These shifts suggest that climate variables have changed at different rates and directions across elevations, which may be muddying/diluteing the results of my SEM. For instance…

  • In the historical data, temperature and precipitation were moderately correlated (r = 0.39), but in the contemporary data, this correlation is much weaker (r = 0.07).

  • Similarly, temperature and humidity were negatively correlated historically but are now positively correlated.

I’d appreciate feedback on whether my model structure is appropriate for addressing my research question. Would it make sense to:

1.) Add Era as a grouping variable?

2.) Run separate SEMs for each time period? – though this limits our ability to test for differing body size responses to climate change over space (Elevation * Era)

3.) Include interactions between Elevation, Era, and climate variables in the Body Size path?

Open to other ideas and suggestions. Thanks in advance for your insights!

1 Like

Hello @FlemingJM and welcome!

I do not have much experience with SEMs in brms or otherwise but here are a couple of more general thoughts:

Letting the influence of sex vary by species with out adding sex as a population level predictor is an odd specification for me (but perhaps it does something sensible that I am not aware of). The influence of sex is also not constrained by phylogeny in your model, which may or may not be realistic.

In trying to determine which coefficients should be era-specific, it might help to switch to index notation:

temperature ~ 0 + Era + Era:Elevation

instead of

temperature ~ Elevation * Era

This would help you move from fitting two separate models, one for each era, to fitting one appropriately specified model for both.