From 6bb6c7da679e8b6372761a4df6bba02ece3e082a Mon Sep 17 00:00:00 2001 From: Chitu Okoli Date: Fri, 4 Oct 2024 22:38:28 +0200 Subject: [PATCH] Fixed influence and cooks.distance methods --- R/autogam.R | 28 ++++++++++++++++------------ man/generic-method.Rd | 6 ++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/R/autogam.R b/R/autogam.R index 9834fdf..053082d 100644 --- a/R/autogam.R +++ b/R/autogam.R @@ -167,12 +167,15 @@ coef.autogam <- function(x, ...) { } -#' #' @rdname generic-method -#' #' @export -#' #' @method cooks.distance autogam -#' cooks.distance.autogam <- function(model, ...) { -#' mgcv:::cooks.distance.gam(model$gam, ...) -#' } +#' @rdname generic-method +# # I don't know why CHECK bugs out if this method is exported; it works otherwise +# @export +#' @method cooks.distance autogam +cooks.distance.autogam <- function(model, ...) { + stats::cooks.distance(model$gam, ...) + # For some reason this only works when called from stats, not mgcv + # mgcv:::cooks.distance.gam(model$gam, ...) +} #' @rdname generic-method @@ -183,12 +186,13 @@ formula.autogam <- function(x, ...) { } -#' #' @rdname generic-method -#' #' @export -#' #' @method influence autogam -#' influence.autogam <- function(model, ...) { -#' mgcv::influence.gam(model$gam, ...) -#' } +#' @rdname generic-method +# # I don't know why CHECK bugs out if this method is exported; it works otherwise +# @export +#' @method influence autogam +influence.autogam <- function(model, ...) { + mgcv::influence.gam(model$gam, ...) +} #' @rdname generic-method diff --git a/man/generic-method.Rd b/man/generic-method.Rd index ce36eee..1f97e85 100644 --- a/man/generic-method.Rd +++ b/man/generic-method.Rd @@ -4,7 +4,9 @@ \alias{autogam generic methods} \alias{anova.autogam} \alias{coef.autogam} +\alias{cooks.distance.autogam} \alias{formula.autogam} +\alias{influence.autogam} \alias{logLik.autogam} \alias{model.matrix.autogam} \alias{predict.autogam} @@ -16,8 +18,12 @@ \method{coef}{autogam}(x, ...) +\method{cooks.distance}{autogam}(model, ...) + \method{formula}{autogam}(x, ...) +\method{influence}{autogam}(model, ...) + \method{logLik}{autogam}(x, ...) \method{model.matrix}{autogam}(x, ...)