From d6bfba0d210bf64faa4370bf849b2106e1b560f9 Mon Sep 17 00:00:00 2001 From: Vincent Arel-Bundock Date: Tue, 10 Dec 2024 18:15:33 -0500 Subject: [PATCH] df.residual methods --- NAMESPACE | 3 +++ R/methods.R | 22 ++++++++++++++++++++-- man/posterior_draws.Rd | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 407673516..73dad083b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -5,6 +5,9 @@ S3method(coef,hypotheses) S3method(coef,marginalmeans) S3method(coef,predictions) S3method(coef,slopes) +S3method(df.residual,comparisons) +S3method(df.residual,predictions) +S3method(df.residual,slopes) S3method(get_coef,afex_aov) S3method(get_coef,betareg) S3method(get_coef,bracl) diff --git a/R/methods.R b/R/methods.R index 749a974b7..1cbc560c3 100644 --- a/R/methods.R +++ b/R/methods.R @@ -1,7 +1,7 @@ #' @noRd #' @export vcov.comparisons <- function(object, ...) { - attr(object, "jacobian") %*% attr(object, "vcov") %*% t(attr(object, "jacobian")) + attr(object, "jacobian") %*% attr(object, "vcov") %*% t(attr(object, "jacobian")) } @@ -60,4 +60,22 @@ coef.predictions <- coef.comparisons #' @export #' @noRd -coef.hypotheses <- coef.comparisons \ No newline at end of file +coef.hypotheses <- coef.comparisons + + +#' @export +#' @noRd +df.residual.comparisons <- function(x, ...) { + out <- tryCatch(stats::df.residual(attr(x, "model")), error = function(e) NULL) + return(out) +} + + +#' @export +#' @noRd +df.residual.predictions <- df.residual.comparisons + + +#' @export +#' @noRd +df.residual.slopes <- df.residual.comparisons diff --git a/man/posterior_draws.Rd b/man/posterior_draws.Rd index 71b906322..1cf96588e 100644 --- a/man/posterior_draws.Rd +++ b/man/posterior_draws.Rd @@ -2,11 +2,11 @@ % Please edit documentation in R/get_draws.R \name{posterior_draws} \alias{posterior_draws} -\title{alias to \code{get_draws()} for backward compatibility with JJSS} +\title{alias to \code{get_draws()} for backward compatibility with JSS} \usage{ posterior_draws(x, shape = "long") } \description{ -alias to \code{get_draws()} for backward compatibility with JJSS +alias to \code{get_draws()} for backward compatibility with JSS } \keyword{internal}