Hi Gavin!
I have noticed that in some cases smooth_estimates() can disagree with predict(m, type = "terms") when fitting models with bam using discrete = TRUE.
library("tidyverse")
library("mgcv")
library("gratia")
m1 <- bam(price ~ s(color, clarity, bs = "re"), data = diamonds, discrete = FALSE)
bind_cols(smooth_estimates(m1), predict(m1, smooth_estimates(m1), type = "terms"))
m2 <- bam(price ~ s(color, clarity, bs = "re"), data = diamonds, discrete = TRUE)
bind_cols(smooth_estimates(m2), predict(m2, smooth_estimates(m2), type = "terms"))
In the first model, .estimate is identical to s(color,clarity), but in the second model it is not.
Hi Gavin!
I have noticed that in some cases
smooth_estimates()can disagree withpredict(m, type = "terms")when fitting models with bam usingdiscrete = TRUE.In the first model,
.estimateis identical tos(color,clarity), but in the second model it is not.