R/deviance.R

Defines functions deviance.SLOPE

Documented in deviance.SLOPE

#' Model deviance
#'
#' @param object an object of class `'SLOPE'`.
#' @param ... ignored
#'
#' @return For Gaussian models this is twice the residual sums of squares. For
#'   all other models, two times the negative loglikelihood is returned.
#' @export
#'
#' @seealso [SLOPE()]
#' @family SLOPE-methods
#'
#' @examples
#' fit <- SLOPE(heart$x, heart$y, family = "binomial")
#' deviance(fit)
deviance.SLOPE <- function(object, ...) {
  deviance_ratio <- object$deviance_ratio
  null_deviance <- object$null_deviance

  (1 - deviance_ratio) * null_deviance
}

Try the SLOPE package in your browser

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

SLOPE documentation built on July 2, 2025, 9:07 a.m.