In a previous question (Generate a predicted count distribution from a ZINB model of class glmmTMB) I asked how to generate a predicted count distribution for a zero-inflated negative binomial model of class "glmmTMB". One solution that I have since found to that question is the function simulate.glmmTMB (https://www.rdocumentation.org/packages/glmmTMB/versions/0.2.3/topics/simulate.glmmTMB). However, I want to do the simulation on test data to validate a model for predictive ability and I only see how to run simulations on the same data used to fit the model.
In the example below, how could I simulate outcomes for the newdata data frame?
library(glmmTMB)
data("bioChemists", package = "pscl")
zinb <- glmmTMB(art ~ fem + mar + kid5 + phd + ment, ziformula = ~ ., data =
bioChemists, family = nbinom2(link = "log"))
sim_1 <- simulate(zinb) #works as expected
#make new dataframe
newdata = unique(bioChemists[,c("fem","mar","kid5","phd","ment")])
sim_2 <- simulate(zinb, newdata = newdata) #ignores newdata