GAMM in brms: issues with low ESS and correlation between intercept and fixed effect slope

Dear All,

I’m quite new to Bayesian statistics and brms and would appreciate some help with some (hopefully not too stupid) questions.

Background: I am working with some facial expression data. In the experiment, two groups of participants watched six brief videos (2 positive, 2 negative, 2 neutral), and the intensity of facial affect was recorded during the task. As a result, I have three facial affect intensity time series for each participant. The facial affect intensity values are bounded between 0 and 1. Total N = 134 (control N = 64, patient N = 70).

The facial expression data has a non-linear relationship with time, so I thought a GAMM with zero-one inflated beta family would be a good option. I am interested in an interaction between group and video category:

res_1 <- brm(data = data2,
             family = zero_one_inflated_beta(),
             bf(facial_affect ~ 1 +
                  group*video +
                  s(time, by = interaction(group,video), bs = "cr", k = 15) + 
                  (1 | ID)))

Question 1: The duration of the videos varies, and therefore so does the length of the facial affect times series. The longest time series is 161 time points and the shortest is 123 time points. Is this a problem with GAMMs?

Question 2: I keep running into low bulk and tail ESS with the intercept and group.

Family: zero_one_inflated_beta 
  Links: mu = logit; phi = identity; zoi = identity; coi = identity 
Formula: facial_affect ~ 1 + group * video + s(time, by = interaction(group, video), bs = "cr", k = 15) + (1 | ID) 
   Data: data2 (Number of observations: 110524) 
  Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
         total post-warmup draws = 4000

Smoothing Spline Hyperparameters:
                                             Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
sds(stimeinteractiongroupvideoAN.negative_1)     0.02      0.01     0.00     0.04 1.00     1102
sds(stimeinteractiongroupvideoHC.negative_1)     0.01      0.01     0.00     0.03 1.00     1167
sds(stimeinteractiongroupvideoAN.neutral_1)      0.02      0.01     0.01     0.03 1.00     1273
sds(stimeinteractiongroupvideoHC.neutral_1)      0.02      0.01     0.01     0.04 1.00     1556
sds(stimeinteractiongroupvideoAN.positive_1)     0.10      0.03     0.07     0.17 1.01     1048
sds(stimeinteractiongroupvideoHC.positive_1)     0.06      0.02     0.04     0.11 1.00     1144
                                             Tail_ESS
sds(stimeinteractiongroupvideoAN.negative_1)     1515
sds(stimeinteractiongroupvideoHC.negative_1)     1072
sds(stimeinteractiongroupvideoAN.neutral_1)      1897
sds(stimeinteractiongroupvideoHC.neutral_1)      1862
sds(stimeinteractiongroupvideoAN.positive_1)     1834
sds(stimeinteractiongroupvideoHC.positive_1)     1868

Multilevel Hyperparameters:
~ID (Number of levels: 134) 
              Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept)     0.75      0.05     0.66     0.84 1.02      384      768

Regression Coefficients:
                                         Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept                                   -3.31      0.09    -3.48    -3.12 1.01      230      395
groupHC                                     -0.01      0.13    -0.26     0.24 1.01      202      367
videoneutral                                 0.06      0.01     0.04     0.08 1.00     3037     2972
videopositive                                0.34      0.01     0.32     0.36 1.00     4017     2989
groupHC:videoneutral                         0.03      0.02    -0.00     0.07 1.00     2998     3040
groupHC:videopositive                        0.27      0.02     0.24     0.30 1.00     3994     2467
stime:interactiongroupvideoAN.negative_1    -0.01      0.00    -0.02    -0.00 1.00     3804     3071
stime:interactiongroupvideoHC.negative_1    -0.03      0.00    -0.03    -0.02 1.00     4893     3544
stime:interactiongroupvideoAN.neutral_1     -0.02      0.01    -0.05    -0.00 1.00     2189     2628
stime:interactiongroupvideoHC.neutral_1     -0.01      0.01    -0.04     0.01 1.00     2149     2709
stime:interactiongroupvideoAN.positive_1     0.04      0.00     0.03     0.04 1.00     4575     3758
stime:interactiongroupvideoHC.positive_1     0.06      0.00     0.06     0.07 1.00     4448     3275

Further Distributional Parameters:
    Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
phi    16.49      0.10    16.29    16.68 1.00     8862     2882
zoi     0.37      0.00     0.37     0.37 1.01     8463     2184
coi     0.00      0.00     0.00     0.00 1.00     6242     2576

I’ve tweaked the priors, but that doesn’t seem to do much to help. I’ve tried simplifying the model by removing the interaction from the smooth term and the fixed effects entirely, but that doesn’t fix the issue. Removing all fixed effects and the interaction seems to make the intercept ESS issue worse. Increasing the number of iterations helps a little but doesn’t remove the problem. I also tried analysing facial affect from just one video only in case the different durations was causing the problems, but the low ESS issue was still there. Does anyone have ideas what could be causing this or how to address it?

Question 3: The pairs plot shows quite strong correlations between the fixed effect slopes and also between the group slope and the intercept. I tried analysing data from just one video with only group as a fixed effect and still ended up with high correlation between group slope and the intercept.


Does this mean there is multicollinearity happening, or is there something else wrong?

I suspect my questions might be related, but I can’t figure out what the underlying cause is. Any ideas would be greatly appreciated!

Thank you, and apologies for the very long post!

  • Operating System: MacOS
  • brms Version: 2.22.0

This might not be a gamm problem but an issue with the zero-one inflated Beta. You are currently not relating its other parameters (coi,zoi) to your predictors but doing so might make matters worse.

You could try fitting the same model with ordbetareg instead:

library(ordbetareg)

res_1 <- ordbetareg(data = data2,
             bf(facial_affect ~ 1 +
                  group*video +
                  s(time, by = interaction(group,video), bs = "cr", k = 15) + 
                  (1 | ID))) 
             ...

with a quick check, it looks like it adopts the handling of smooth terms from brms so it should work with your model formula.

Thank you for the suggestion! I tried using ordbetareg instead but the low ESS and correlations in the pairs plots persist. I did also get a warning that there were several transitions after warmup that exceeded maximum treedepth when using ordbetareg. I’m not sure what to make of that one.

I’m worried that it might be something I’m doing wrong or something odd is happening with my data.

Does every group watch every video? See here the first code chunk and explanation right below.

For the most part yes. There were three participants who didn’t watch all of them because there was an issue with the task.

Thank you! I will have a look at it.