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(abalone$x, abalone$y, family = "poisson")
#' 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 June 10, 2022, 1:05 a.m.