R/param_range_limits.R

Defines functions upper_limit lower_limit

Documented in lower_limit upper_limit

#' Limits for the range of predictions
#'
#' Range limits truncate model predictions to a specific range of values,
#' typically to avoid extreme or unrealistic predictions.
#'
#' @inheritParams Laplace
#' @examples
#' lower_limit()
#' upper_limit()
#' @name range_limits
#' @export

#' @rdname range_limits
#' @export
lower_limit <- function(range = c(-Inf, Inf), trans = NULL) {
  new_quant_param(
    type = "double",
    range = range,
    inclusive = c(TRUE, FALSE),
    trans = trans,
    label = c(lower_limit = "Lower Limit"),
    finalize = NULL
  )
}

#' @rdname range_limits
#' @export
upper_limit <- function(range = c(-Inf, Inf), trans = NULL) {
  new_quant_param(
    type = "double",
    range = range,
    inclusive = c(FALSE, TRUE),
    trans = trans,
    label = c(upper_limit = "Upper Limit"),
    finalize = NULL
  )
}

Try the dials package in your browser

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

dials documentation built on April 12, 2025, 1:46 a.m.