Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmrm() models #229

Merged
merged 10 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading