Closed
Description
From @ToonVanDaele mail:
the colors switch multiple times between green (no emergency) orange (pot. emergency) and red (emergence) although visually there's just a flat line, with no indication of emergence (example Xenopus aevis) . This is probably because the confidence intervals in the middle of the times series are very small and even the slightest upward bend in the additive model will show 'emergence'. I dived into the code a bit. Maybe this effect can be avoided by relaxing the conditions for the lower ci in the 'apply_gam' function (example 0.01 instead of 0).
The solution proposed from @ToonVanDaele to check is to replace:
https://github.com/trias-project/trias/blob/main/R/apply_gam.R#L683
with
.data$lower_ci >= 0.01 & .data$upper_ci > 0 ~ 1
I propose the symmetric condition
.data$lower_ci < 0 & .data$upper_ci <= - 0.01 ~ -1,