This learner provides fitting procedures for bayesian generalized linear models (GLMs) from ar using bayesglm.fit. The GLMs fitted in this way can incorporate independent normal, t, or Cauchy prior distribution for the coefficients.

Format

An R6Class object inheriting from Lrnr_base.

Value

A learner object inheriting from Lrnr_base with methods for training and prediction. For a full list of learner functionality, see the complete documentation of Lrnr_base.

Parameters

  • intercept = TRUE: A logical specifying whether an intercept term should be included in the fitted null model.

  • ...: Other parameters passed to bayesglm.fit. See it's documentation for details.

Examples

data(cpp_imputed)
covars <- c(
  "apgar1", "apgar5", "parity", "gagebrth", "mage", "meducyrs", "sexn"
)
outcome <- "haz"
task <- sl3_Task$new(cpp_imputed,
  covariates = covars,
  outcome = outcome
)
# fit and predict from a bayesian GLM
bayesglm_lrnr <- make_learner(Lrnr_bayesglm)
bayesglm_fit <- bayesglm_lrnr$train(task)
bayesglm_preds <- bayesglm_fit$predict(task)