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 > > set.seed(1) > DyestuffWithOffset <- within(Dyestuff, { + offset <- rnorm(length(Yield)) + Yield <- Yield + offset + }) > > testFormula <- function(formula, data) { + print(summary(fm <- lmer(formula, data, control=lmerControl(optimizer="bobyqa")))) + print(summary(rm <- rlmer(formula, data, rho.e = cPsi, rho.b = cPsi, init = lmerNoFit))) + ranef.fm <- ranef(fm, condVar=FALSE) + stopifnot(all.equal(coef(fm), coef(rm), tolerance = 1e-3, check.attributes = FALSE), + all.equal(fixef(fm), fixef(rm), tolerance = 1e-3, check.attributes = FALSE), + all.equal(ranef.fm , ranef(rm), tolerance = 1e-2, check.attributes = FALSE), + all.equal(fitted(fm) , fitted(rm), tolerance = 1e-3, check.attributes = FALSE), + all.equal(predict(fm) , predict(rm), tolerance = 1e-3, check.attributes = FALSE)) + invisible(list(fm, rm)) + } > > testFormula(Yield ~ offset(offset) + (1 | Batch), DyestuffWithOffset) Linear mixed model fit by REML ['lmerMod'] Formula: Yield ~ offset(offset) + (1 | Batch) Data: data Control: lmerControl(optimizer = "bobyqa") REML criterion at convergence: 319.7 Scaled residuals: Min 1Q Median 3Q Max -1.4117 -0.7634 0.1418 0.7792 1.8296 Random effects: Groups Name Variance Std.Dev. Batch (Intercept) 1764 42.00 Residual 2451 49.51 Number of obs: 30, groups: Batch, 6 Fixed effects: Estimate Std. Error t value (Intercept) 1527.50 19.38 78.8 Robust linear mixed model fit by DAStau Formula: formula Data: data Scaled residuals: Min 1Q Median 3Q Max -1.4249 -0.7476 0.1632 0.7990 1.8314 Random effects: Groups Name Variance Std.Dev. Batch (Intercept) 1764 42.00 Residual 2475 49.75 Number of obs: 30, groups: Batch, 6 Fixed effects: Estimate Std. Error t value (Intercept) 1527.6 19.4 78.73 Robustness weights for the residuals: All 30 weights are ~= 1. Robustness weights for the random effects: [1] 1 1 1 1 1 1 Rho functions used for fitting: Residuals: eff: classic sig: classic Random Effects, variance component 1 (Batch): eff: classic vcp: classic > > > proc.time() user system elapsed 3.03 0.25 3.28