In a zero-inflated GAM (ziplss
), I'm getting a warning when 1) I use new data and 2) the count portion has categorical variables that are NOT in the zero-inflation portion. There's a warning for every categorical variable not represented in the zero-inflation part.
Here's a reproducible example:
library(mgcv)
library(glmmTMB)
data(Salamanders)
Salamanders$x <- rnorm(nrow(Salamanders), 0, 10)
zipgam <- gam(list(count ~ spp * mined + s(x) + s(site, bs = "re"),
~ spp),
data = Salamanders, family = ziplss, method = "REML")
preds.response <- data.frame(Predict = predict(zipgam, type = "response"))
nd <- data.frame(x = 0, spp = "GP", mined = "yes", site = Salamanders$site[1])
nd$pred <- predict(zipgam, newdata = nd, exclude="site")
I haven't seen this mentioned anywhere, which is odd and tells me that I'm likely doing something wrong (otherwise this would be available in search results). Would appreciate any insight.
Salamander
? This isn't reproducible if we don't have that object. – Gavin SimpsonglmmTMB
package. Question edited and is now fully reproducible. – user2602640