Skip to content

Commit

Permalink
fixing another issue in the unit test and varcomp function
Browse files Browse the repository at this point in the history
  • Loading branch information
kkholst committed Dec 20, 2023
1 parent 36d9a98 commit 71cca32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/lmers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test-inference.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 71cca32

Please sign in to comment.