tests/testthat/test-mice.impute.jomoImpute.R

context("mice.impute.jomoImpute")

data <- boys[c(1:10, 101:110, 501:510, 601:620, 701:710), ]
type <- c(2, 0, 0, 0, -2, 0, 1, 1, 0)
names(type) <- names(data)

z1 <- mice.impute.jomoImpute(data = data, type = type, format = "native")

test_that("jomoImpute returns native class", {
  expect_is(z1, "mitml")
})

blocks <- make.blocks(list(c("bmi", "chl", "hyp"), "age"))
method <- c("jomoImpute", "pmm")
pred <- make.predictorMatrix(nhanes, blocks)
pred["B1", "hyp"] <- -2
# imp <- mice(nhanes, blocks = blocks, method = method, pred = pred,
#             maxit = 1, seed = 1, print = FALSE)
# z <- complete(imp)
#
# test_that("mice can call jomoImpute", {
#   expect_equal(sum(is.na(z$bmi)), 0)
#   expect_equal(sum(is.na(z$chl)), 0)
# })

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.