From c8559daaecc48626f27dd1d80d25bde346cb9776 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 31 Oct 2022 11:23:39 +0100 Subject: Add anova.mhmkin method --- NEWS.md | 2 ++ R/mhmkin.R | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/NEWS.md b/NEWS.md index f14a9939..345cc50c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ - 'R/mhmkin.R': New method for performing multiple hierarchical mkin fits in one function call, optionally in parallel. +- 'R/mhmkin.R': 'anova.mhmkin' for conveniently comparing the resulting fits. + - 'R/illparms.R': New generic to show ill-defined parameters with methods for 'mkinfit', 'mmkin', 'saem.mmkin' and 'mhmkin' objects. - 'R/multistart.R': New method for testing multiple start parameters for hierarchical model fits, with function 'llhist' and new generic 'parplot' for diagnostics, and new generics 'which.best' and 'best' for extracting the fit with the highest likelihood diff --git a/R/mhmkin.R b/R/mhmkin.R index 7f3ff9fa..5cc95253 100644 --- a/R/mhmkin.R +++ b/R/mhmkin.R @@ -33,6 +33,12 @@ mhmkin <- function(objects, backend = "saemix", algorithm = "saem", ...) { UseMethod("mhmkin") } +#' @export +#' @rdname mhmkin +mhmkin.mmkin <- function(object, ...) { + mhmkin(list(object), ...) +} + #' @export #' @rdname mhmkin mhmkin.list <- function(objects, backend = "saemix", @@ -190,3 +196,13 @@ update.mhmkin <- function(object, ..., evaluate = TRUE) { if(evaluate) eval(call, parent.frame()) else call } + +#' export +anova.mhmkin <- function(object, ..., + method = c("is", "lin", "gq"), test = FALSE, model.names = "auto") { + if (identical(model.names, "auto")) { + model.names <- paste(rownames(object), "-", colnames(object)) + } + rlang::inject(anova(!!!(object), method = method, test = test, model.names = model.names)) +} + -- cgit v1.2.1