R Under development (unstable) (2023-11-12 r85514 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(robustlmm) Loading required package: robustlmm Loading required package: lme4 Loading required package: Matrix > > checkEquality <- function(cW, rW, tolerance = 1e-8) { + stopifnot( + all.equal( + coef(cW), + coef(rW), + tolerance = tolerance, + check.attributes = FALSE + ), + all.equal( + fixef(cW), + fixef(rW), + tolerance = tolerance, + check.attributes = FALSE + ), + all.equal( + ranef(cW) , + ranef(rW), + tolerance = 100 * tolerance, + check.attributes = FALSE + ), + all.equal( + fitted(cW) , + fitted(rW), + tolerance = tolerance, + check.attributes = FALSE + ), + all.equal( + predict(cW) , + predict(rW), + tolerance = tolerance, + check.attributes = FALSE + ), + all.equal( + coef(summary(cW)) , + coef(summary(rW)), + tolerance = 100 * tolerance, + check.attributes = FALSE + ) + ) + } > > testBattery <- function(formula, data, tolerance) { + nobs <- nrow(data) + + test <- function(weights) { + cW <- lmer(formula, data, weights = weights) + rW <- + rlmer( + formula, + data, + weights = weights, + rho.e = cPsi, + rho.b = cPsi, + init = lmerNoFit + ) + checkEquality(cW, rW, tolerance) + } + + test(rep(2, nobs)) + test(rep(0.5, nobs)) + + set.seed(133) + test(runif(nobs)) + test(rexp(nobs)) + } > > testBattery(Yield ~ 1 | Batch, Dyestuff, 1e-8) Warning message: Detected very small weights (observation 19). You may encounter issues due to numerical instability. > > # Skip these to speed up tests > #testBattery(diameter ~ (1 | plate) + (1 | sample), > # Penicillin, 1e-6) > #testBattery(Reaction ~ Days + (Days | Subject), sleepstudy, 1e-5) > > # testBattery(y ~ service * dept + studage + lectage + > # (1 | s) + (1 | d), InstEval) > > proc.time() user system elapsed 3.37 0.26 3.62