tests/testthat/test-pool.r.squared.R

context("pool.r.squared")

data(nhanes)
imp <- mice::mice(nhanes, maxit = 2, m = 2, seed = 10, print = FALSE)
fit_mira <- with(data = imp, exp = lm(chl ~ age + bmi))
fit_mipo <- mice::pool(fit_mira)

test_that("pool.r.squared mira", {
  result <- as.vector(pool.r.squared(fit_mira, adjusted = FALSE)[1, ])
  expect_equal(length(result), 4L)
})

test_that("r.squared mipo", {
  result <- as.vector(pool.r.squared(fit_mipo, adjusted = FALSE)[1, ])
  expect_equal(length(result), 4L)
})

Try the mice package in your browser

Any scripts or data that you put into this service are public.

mice documentation built on June 7, 2023, 5:38 p.m.