Global trend and random smooths do not match in HGAM

Ultimately, I did some reading and found out that I need to use the conditions argument in the conditional_effects() function and set the grouping factor to NA. This post helped me get an answer.

I did this :

test <- conditional_effects(
  modA2, method = "fitted",
  robust = FALSE, re_formula = NULL,
  effects = "Zcumul_xp",
  conditions = data.frame(predator_id = NA)
 )

And now I think I have the proper trend :

Maxime