Skip to content

Commit

Permalink
Fix mice issues (#977)
Browse files Browse the repository at this point in the history
* Fix mice issues

* fix tests
  • Loading branch information
strengejacke authored Dec 2, 2024
1 parent 39a456c commit 8e78b12
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: insight
Title: Easy Access to Model Information for Various Model Objects
Version: 1.0.0.1
Version: 1.0.0.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down Expand Up @@ -160,7 +160,7 @@ Suggests:
metafor,
metaplus,
mgcv,
mice,
mice (>= 3.17.0),
mlogit,
mmrm,
modelbased,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Bug fixes

* Fixed issued due to latest *mice* updates.

* Fixed typo in `get_parameters.glmmadmb()`, which was erroneously renamed into
`get_parameters.glmmTMBadmb()`.

Expand Down
4 changes: 2 additions & 2 deletions R/get_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ get_parameters.mipo <- function(x, ...) {
stringsAsFactors = FALSE
)
# check for ordinal-alike models
if ("y.level" %in% colnames(s)) {
out$Response <- as.vector(s$y.level)
if (!is.null(x$pooled) && "y.level" %in% colnames(x$pooled)) {
out$Response <- as.vector(x$pooled$y.level)
}
text_remove_backticks(out)
}
Expand Down
4 changes: 2 additions & 2 deletions R/get_statistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -1549,8 +1549,8 @@ get_statistic.mipo <- function(x, ...) {
stringsAsFactors = FALSE
)
# check for ordinal-alike models
if ("y.level" %in% colnames(s)) {
params$Response <- as.vector(s$y.level)
if (!is.null(x$pooled) && "y.level" %in% colnames(x$pooled)) {
params$Response <- as.vector(x$pooled$y.level)
}
out <- text_remove_backticks(params)
attr(out, "statistic") <- find_statistic(x)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-mipo.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ test_that("param", {
out2 <- get_statistic(pooled)
out1$Estimate <- round(out1$Estimate, 4)
out2$Statistic <- round(out2$Statistic, 4)
expect_equal(out1$Response, c("6", "6", "6", "8", "8", "8"))
expect_equal(out2$Response, c("6", "6", "6", "8", "8", "8"))
expect_snapshot(out1)
expect_snapshot(out2)
expect_identical(find_parameters(pooled), list(conditional = c("(Intercept)", "disp", "hp")))
Expand Down

0 comments on commit 8e78b12

Please sign in to comment.