Skip to contents

The following learners are available for continuous outcomes:

Details

  • lnr_mean

  • lnr_earth

  • lnr_gam

  • lnr_glm

  • lnr_glmer

  • lnr_glmnet

  • lnr_lm

  • lnr_lmer

  • lnr_ranger

  • lnr_rf

  • lnr_xgboost

See ?density_learners to learn more about using conditional density estimation in nadir.

lnr_mean is generally provided only for benchmarking purposes to compare other learners against to ensure correct specification of learners, since any prediction algorithm should (in theory) out-perform just using the mean of the outcome for all predictions.

If you'd like to build a new learner, we recommend reading the source code of several of the learners provided with {nadir} to get a sense of how they should be specified.

A learner, as {nadir} understands them, is a function which takes in `data`, a `formula`, possibly `...`, and returns a function that predicts on its input `newdata`.

A simple example is reproduced here for ease of reference:

Examples

if (FALSE) { # \dontrun{
 lnr_glm <- function(data, formula, ...) {
  model <- stats::glm(formula = formula, data = data, ...)

  return(function(newdata) {
    predict(model, newdata = newdata, type = 'response')
  })
  }
} # }