Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 23, 2025
1 parent 76b30d7 commit 26be0b3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/test-mice.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ test_that("pool_predictions", {
out <- pool_predictions(predictions)
expect_equal(out$Mean, c(29.84661, 25.20021, 23.14022), tolerance = 1e-3)
expect_equal(out$CI_low, c(2.10117, 3.44548, -5.79522), tolerance = 1e-3)

# transformed response
predictions <- lapply(1:5, function(i) {
m <- lm(log1p(bmi) ~ age + hyp + chl, data = mice::complete(imp, action = i))
estimate_means(m, "age")
})
out <- pool_predictions(predictions, transform = TRUE)
expect_equal(out$Mean, c(29.67473, 24.99382, 23.19148), tolerance = 1e-3)
expect_equal(out$CI_low, c(10.58962, 11.13011, 7.43196), tolerance = 1e-3)
})


Expand Down

0 comments on commit 26be0b3

Please sign in to comment.