Skip to content

Commit

Permalink
mmrm() models (#229)
Browse files Browse the repository at this point in the history
* support for mmrm::mmrm()

fix #228

* Update DESCRIPTION

* mmrm updates

* NEW update

* update suppported_models.rda

* typo in doc

* update doc

---------

Co-authored-by: Daniel Sjoberg <[email protected]>
  • Loading branch information
larmarange and ddsjoberg authored Nov 30, 2023
1 parent 90224d6 commit 457c028
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Suggests:
MASS,
mgcv,
mice,
mmrm (>= 0.3.6),
multgee,
nnet,
ordinal,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/model_get_weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions data-raw/DATASET.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified data/supported_models.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/model_get_weights.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/supported_models.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions tests/testthat/test-tidy_plus_plus.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 457c028

Please sign in to comment.