R/SL.bayesglm.R

Defines functions predict.SL.bayesglm SL.bayesglm

Documented in predict.SL.bayesglm SL.bayesglm

# bayesglm{arm}
# Bayesian generalized linear regression

SL.bayesglm <- function(Y, X, newX, family, obsWeights, ...){
  .SL.require('arm')
  fit.glm <- arm::bayesglm(Y ~ ., data = X, family = family, weights = obsWeights)
  pred <- predict(fit.glm, newdata = newX, type = "response")
  fit <- list(object = fit.glm)
  out <- list(pred = pred, fit = fit)
  class(out$fit) <- c("SL.bayesglm")
  return(out)
}

predict.SL.bayesglm <- function(object, newdata, ...){
  .SL.require('arm')
  pred <- predict(object = object$object, newdata = newdata, type = "response")
  return(pred)
}

Try the SuperLearner package in your browser

Any scripts or data that you put into this service are public.

SuperLearner documentation built on July 26, 2023, 6:05 p.m.