context("check null model lmm")
test_that("lmm - with group", {
dat <- .testNullInputs()
nullmod <- fitNullMod(dat$y, dat$X, dat$cor.mat, group.idx=dat$group.idx, verbose=FALSE)
expect_equal(nullmod$family$family, "gaussian")
expect_true(nullmod$family$mixedmodel)
expect_true(nullmod$hetResid)
expect_true(nullmod$converged)
expect_equivalent(nullmod$workingY, dat$y)
expect_equivalent(nullmod$outcome, dat$y)
expect_equivalent(nullmod$model.matrix, dat$X)
})
test_that("lmm - without group", {
dat <- .testNullInputs()
nullmod <- fitNullMod(dat$y, dat$X, dat$cor.mat, verbose=FALSE)
expect_false(nullmod$hetResid)
expect_true(nullmod$converged)
expect_equivalent(nullmod$workingY, dat$y)
expect_equivalent(nullmod$outcome, dat$y)
expect_equivalent(nullmod$model.matrix, dat$X)
})
test_that("update conditional model", {
dat <- .testNullInputs()
nullmod <- fitNullMod(dat$y, dat$X, dat$cor.mat, group.idx=dat$group.idx, verbose=FALSE)
G <- matrix(rnorm(100, 100,1))
nullmod2 <- updateNullModCond(nullmod, G, covMatList=dat$cor.mat, verbose=FALSE)
nullmod3 <- fitNullMod(dat$y, cbind(dat$X, G), dat$cor.mat, group.idx=dat$group.idx, verbose=FALSE)
expect_equivalent(nullmod2$varComp, nullmod3$varComp, tolerance=1e-5)
expect_equivalent(nullmod2$fixef, nullmod3$fixef, tolerance=1e-5)
expect_equivalent(nullmod2$cholSigmaInv, nullmod3$cholSigmaInv, tolerance=1e-5)
expect_equivalent(nullmod2$varCompCov, nullmod3$varCompCov, tolerance=1e-5)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.