R/get_predictions_lmrob_base.R

Defines functions get_predictions_lmrob_base

get_predictions_lmrob_base <- function(model, fitfram, ci.lvl, ...) {

  if (!is.null(ci.lvl) && !is.na(ci.lvl))
    ci <- "confidence"
  else
    ci <- "none"

  prdat <- stats::predict(
    model,
    newdata = fitfram,
    type = "response",
    interval = ci,
    level = ci.lvl,
    ...
  )

  # get predicted values, on link-scale
  fitfram$predicted <- prdat[, "fit"]

  if (ci == "none") {
    fitfram$conf.low <- NA
    fitfram$conf.high <- NA
  } else {
    fitfram$conf.low <- prdat[, "lwr"]
    fitfram$conf.high <- prdat[, "upr"]
  }

  fitfram
}

Try the ggeffects package in your browser

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

ggeffects documentation built on Sept. 12, 2024, 7:41 a.m.