Anthony W
Anthony W

Reputation: 1327

GBM poisson regression confidence intervals

If I have a gbm poisson regression model as follows:

# My data
set.seed(0)
df <- data.frame(count = rpois(100,1),
                 pred1 = rnorm(100, 10, 1), 
                 pred2 = rnorm(100, 0, 1), 
                 pred3 = rnorm(100, 0, 1))

# My Split
split <- initial_split(df)

# My model
library(gbm)
m <- gbm(
  formula = count ~ .,
  distribution ="poisson",
  data = training(split))

And I make a prediction:

# My prediction
p <- predict(m, 
             n.trees=m$n.trees, 
             testing(split), 
             type="response")

I'd like to generate some confidence intervals around the values of p. I cannot seem to find a way of doing this when I use m to predict on the test data set or a new dataset (where the predictor variables have identical underlying distributions).

Upvotes: 1

Views: 196

Answers (0)

Related Questions