The way predict.mboost
handles this use case is that you must add the new identifiers as levels to the factor variable used in constructing the brandom
base learner for the random effect. Then, you specify the new data, assigning the grouping variable to the new data data.frame
as a factor variable with the same levels as the grouping variable used in constructing the model fit.
e.g.,
gammod <- gamboost(resp ~ bbs(x1) + bols(x2) + brandom(x3), data = data)
newdat <- data.frame(x1 = sample(x1min:x1max, n), x2 = sample(x2min:x2max, n),
x3 = as.factor(sample(x3min:m3max),
levels = levels(data$x3))
predictions <- predict(gammod, type = "response", newdata = newdat)