R Under development (unstable) (2023-11-02 r85465 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require(lme4) Loading required package: lme4 Loading required package: Matrix > # sorry for fitting yet another sleepstudy model in the tests > m <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) > ST <- getME(m, "ST")$Subject > > # copied from vince dorie's simmer.R in arm: > dimension <- nrow(ST) > T <- ST > diag(T) <- rep(1, dimension) > S <- diag(diag(ST), dimension) > > vc0 <- getME(m, 'sigma')^2*tcrossprod(T %*% S) > vc1 <- VarCorr(m)$Subject[,] > dimnames(vc0) <- dimnames(vc1) > > all.equal(vc0, vc1, tolerance = 1e-6) [1] TRUE > > proc.time() user system elapsed 1.90 0.17 2.03