diff --git a/DESCRIPTION b/DESCRIPTION index 954f9d9b..d8ae12dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -61,6 +61,7 @@ Suggests: MASS, mgcv, mice, + mmrm (>= 0.3.6), multgee, nnet, ordinal, diff --git a/NEWS.md b/NEWS.md index d19e6bac..f6184f0f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # broom.helpers (development version) +**New supported models** + +- Support for `mmrm::mmrm()` models (#228) + **New features** - new `tidy_post_fun` argument in `tidy_plus_plus()` (#235) diff --git a/R/model_get_weights.R b/R/model_get_weights.R index 15df9a07..d3eb6033 100644 --- a/R/model_get_weights.R +++ b/R/model_get_weights.R @@ -4,7 +4,7 @@ #' #' @param model a model object #' @note -#' For class `svrepglm` objects (glm on a survey object with replicate weights), +#' For class `svrepglm` objects (GLM on a survey object with replicate weights), #' it will return the original sampling weights of the data, not the replicate #' weights. #' @export diff --git a/data-raw/DATASET.R b/data-raw/DATASET.R index cbafa9b1..7e9de777 100644 --- a/data-raw/DATASET.R +++ b/data-raw/DATASET.R @@ -50,6 +50,7 @@ supported_models <- "`logitr::logitr()`", "Requires logitr >= 0.8.0", "`multgee::nomLORgee()`", "Experimental support. Use `tidy_multgee()` as `tidy_fun`.", "`multgee::ordLORgee()`", "Experimental support. Use `tidy_multgee()` as `tidy_fun`.", + "`mmrm::mmrm()`", "", "`pscl::zeroinfl()`", "Use `tidy_zeroinfl()` as `tidy_fun`.", "`pscl::hurdle()`", "Use `tidy_zeroinfl()` as `tidy_fun`.", "`betareg::betareg()`", "Use `tidy_parameters()` as `tidy_fun` with `component` argument to control with coefficients to return. `broom::tidy()` does not support the `exponentiate` argument for betareg models, use `tidy_parameters()` instead." # nolint diff --git a/data/supported_models.rda b/data/supported_models.rda index a0517bcb..79219fae 100644 Binary files a/data/supported_models.rda and b/data/supported_models.rda differ diff --git a/man/model_get_weights.Rd b/man/model_get_weights.Rd index e7054891..9da7a2bf 100644 --- a/man/model_get_weights.Rd +++ b/man/model_get_weights.Rd @@ -25,7 +25,7 @@ model_get_weights(model) This function does not cover \code{lavaan} models (\code{NULL} is returned). } \note{ -For class \code{svrepglm} objects (glm on a survey object with replicate weights), +For class \code{svrepglm} objects (GLM on a survey object with replicate weights), it will return the original sampling weights of the data, not the replicate weights. } diff --git a/man/supported_models.Rd b/man/supported_models.Rd index fa3e344d..c6b02a49 100644 --- a/man/supported_models.Rd +++ b/man/supported_models.Rd @@ -42,6 +42,7 @@ Listing of Supported Models \code{MASS::polr()} \tab \cr \code{mgcv::gam()} \tab Use default tidier \code{broom::tidy()} for smooth terms only, or \code{gtsummary::tidy_gam()} to include parametric terms \cr \code{mice::mira} \tab Limited support. If \code{mod} is a \code{mira} object, use \code{tidy_fun = function(x, ...) {mice::pool(x) \%>\% mice::tidy(...)}} \cr + \code{mmrm::mmrm()} \tab \cr \code{multgee::nomLORgee()} \tab Experimental support. Use \code{tidy_multgee()} as \code{tidy_fun}. \cr \code{multgee::ordLORgee()} \tab Experimental support. Use \code{tidy_multgee()} as \code{tidy_fun}. \cr \code{nnet::multinom()} \tab \cr diff --git a/tests/testthat/test-tidy_plus_plus.R b/tests/testthat/test-tidy_plus_plus.R index 204160c9..591777fb 100644 --- a/tests/testthat/test-tidy_plus_plus.R +++ b/tests/testthat/test-tidy_plus_plus.R @@ -911,6 +911,38 @@ test_that("tidy_plus_plus() works with betareg::betareg() models", { expect_equal(nrow(res), 24) }) +test_that("tidy_plus_plus() works with mmrm::mmrm() models", { + skip_on_cran() + skip_if_not_installed("mmrm") + + m1 <- mmrm::mmrm(FEV1 ~ SEX + ARMCD + AVISIT + us(AVISIT | USUBJID), data = mmrm::fev_data) + m2 <- mmrm::mmrm(FEV1 ~ SEX + ARMCD * AVISIT + us(AVISIT | USUBJID), data = mmrm::fev_data) + + expect_error( + res <- m1 %>% tidy_plus_plus(intercept = TRUE), + NA + ) + expect_equal(nrow(res), 9) + + expect_error( + res <- m1 %>% tidy_plus_plus(add_header_rows = TRUE), + NA + ) + expect_equal(nrow(res), 11) + + expect_error( + res <- m2 %>% tidy_plus_plus(intercept = TRUE), + NA + ) + expect_equal(nrow(res), 12) + + expect_error( + res <- m2 %>% tidy_plus_plus(add_header_rows = TRUE), + NA + ) + expect_equal(nrow(res), 15) +}) + test_that("tidy_post_fun argument of `tidy_plus_plus()`", { mod <- lm(Petal.Length ~ Petal.Width + Species, iris)