2
$\begingroup$

Suppose I have the following mboost::gamboost model:

gamboost(resp ~ bbs(x1) + bols(x2) + brandom(x3), data = data)

Suppose I have data I'd like to score, but that comes from new groups (i.e., new values of grouping variable x3). How do I use predict.gamboost for this prediction task?

$\endgroup$

1 Answer 1

1
$\begingroup$

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)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.