R Under development (unstable) (2023-11-03 r85470 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. > if (.Platform$OS.type!="windows") { + library(lme4) + + ## ---------------------------------------------------------------------- + ## test that deviance(REMLfit, REML = FALSE) gives the same answer as + ## the ML objective function at the REML fit + ## ---------------------------------------------------------------------- + set.seed(1) + w <- runif(nrow(sleepstudy)) + fm <- lmer(Reaction ~ Days + (Days | Subject), + sleepstudy, weights = w) + dfun <- update(fm, devFunOnly = TRUE, REML = FALSE) + stopifnot(all.equal(deviance(fm, REML = FALSE), + dfun(getME(fm, "theta")))) + + ## ---------------------------------------------------------------------- + ## TODO: test the opposite case that deviance(MLfit, REML = TRUE) + ## gives the same answer as the REML objective function at the ML fit + ## ---------------------------------------------------------------------- + } > > proc.time() user system elapsed 0.06 0.10 0.15