From 71cca32070257a0dd92514e69c5978fc8afed8fe Mon Sep 17 00:00:00 2001 From: Klaus Holst Date: Wed, 20 Dec 2023 16:15:33 +0100 Subject: [PATCH] fixing another issue in the unit test and varcomp function --- R/lmers.R | 2 +- tests/testthat/test-inference.R | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/R/lmers.R b/R/lmers.R index a94fe822..eddc709a 100644 --- a/R/lmers.R +++ b/R/lmers.R @@ -57,7 +57,7 @@ varcomp <- function(x, profile=TRUE, ...) { } else if (inherits(x, "lmerMod")) { coefs <- lme4::fixef(x) varcomp <- lme4::VarCorr(x)[[1]][, ] - resvar <- attributes(VarCorr(x))$sc^2 + resvar <- attributes(lme4::VarCorr(x))$sc^2 pr <- confint(x) ## Profile likelihood intervals } else { stop("unrecognized model object") diff --git a/tests/testthat/test-inference.R b/tests/testthat/test-inference.R index 8dd3f267..90cf5f8c 100644 --- a/tests/testthat/test-inference.R +++ b/tests/testthat/test-inference.R @@ -313,10 +313,9 @@ test_that("Random slope model", { dd <- mets::fast.reshape(dw) dd$num <- dd$num+runif(nrow(dd),0,0.2) dd0 <- dd[-c(1:2*3),] - library(lme4) + ##l <- lme4::lmer(y~ 1+num +(1+num|id),dd,REML=FALSE) l <- nlme::lme(y ~ 1+num, random=~1+num|id, data=dd, method="ML") - ##l0 <- lmer(y~ 1+num +(1+num|id),dd,REML=FALSE) - sl0 <- lava:::varcomp(l) + sl <- lava:::varcomp(l) d <- mets::fast.reshape(dd,id="id") d0 <- mets::fast.reshape(dd0,id="id")