R/get_predictions_generic.R

Defines functions get_predictions_generic

get_predictions_generic <- function(model, fitfram, linv, ...) {

  if (!requireNamespace("prediction", quietly = TRUE)) {
    stop("You need to install package `prediction` first to compute adjusted predictions.", call. = FALSE)
  }

  prdat <-
    prediction::prediction(
      model,
      data = fitfram,
      type = "response",
      ...
    )

  # copy predictions
  fitfram$predicted <- prdat$fitted

  # No CI
  fitfram$conf.low <- NA
  fitfram$conf.high <- NA

  fitfram
}
javifar/ggeffects documentation built on Jan. 21, 2022, 12:04 a.m.