Running ‘AAAtest-all.R’ [127s/170s]
  Running ‘HSAURtrees.R’ [2s/4s]
  Running ‘REMLdev.R’ [2s/3s]
  Running ‘ST.R’ [2s/4s]
  Running ‘agridat_gotway.R’ [3s/5s]
  Running ‘bootMer.R’ [6s/16s]
  Running ‘boundary.R’ [4s/5s]
  Running ‘confint.R’ [3s/4s]
  Running ‘devCritFun.R’ [2s/3s]
  Running ‘devfunQ.R’ [2s/3s]
  Running ‘drop.R’ [3s/4s]
  Running ‘drop1contrasts.R’ [2s/3s]
  Running ‘dynload.R’ [5s/6s]
  Running ‘elston.R’ [3s/3s]
  Running ‘evalCall.R’ [2s/4s]
  Running ‘extras.R’ [2s/3s]
  Running ‘falsezero_dorie.R’ [2s/4s]
  Running ‘fewlevels.R’ [11s/15s]
  Running ‘getME.R’ [3s/3s]
  Running ‘glmer-1.R’ [4s/4s]
  Running ‘glmerControlPass.R’ [7s/9s]
  Running ‘glmerWarn.R’ [2s/4s]
  Running ‘glmmExt.R’ [7s/11s]
  Running ‘glmmWeights.R’ [6s/8s]
  Running ‘hatvalues.R’ [2s/3s]
  Running ‘is.R’ [2s/4s]
  Running ‘lmList-tst.R’ [2s/3s]
  Running ‘lme4_nlme.R’ [2s/4s]
  Running ‘lmer-0.R’ [2s/5s]
  Running ‘lmer-1.R’ [4s/5s]
  Comparing ‘lmer-1.Rout’ to ‘lmer-1.Rout.save’ ... OK
  Running ‘lmer-conv.R’ [2s/3s]
  Running ‘lmer2_ex.R’ [2s/4s]
  Running ‘methods.R’ [2s/3s]
  Running ‘minval.R’ [2s/4s]
  Running ‘modFormula.R’ [2s/3s]
  Running ‘nbinom.R’ [2s/3s]
  Running ‘nlmer-conv.R’ [2s/3s]
  Running ‘nlmer.R’ [2s/3s]
  Comparing ‘nlmer.Rout’ to ‘nlmer.Rout.save’ ... OK
  Running ‘offset.R’ [3s/4s]
  Running ‘optimizer.R’ [4s/6s]
  Running ‘polytomous.R’ [2s/3s]
  Running ‘prLogistic.R’ [2s/3s]
  Running ‘predict_basis.R’ [3s/4s]
  Running ‘predsim.R’ [3s/5s]
  Running ‘priorWeights.R’ [7s/11s]
  Running ‘priorWeightsModComp.R’ [3s/5s]
  Running ‘profile-tst.R’ [2s/4s]
  Running ‘refit.R’ [19s/30s]
  Running ‘resids.R’ [2s/4s]
  Running ‘respiratory.R’ [7s/11s]
  Running ‘simulate.R’ [4s/7s]
  Running ‘testOptControl.R’ [2s/4s]
  Running ‘test_times.R’ [2s/4s]
  Running ‘testcolonizer.R’ [3s/5s]
  Running ‘testcrab.R’ [8s/13s]
  Running ‘throw.R’ [5s/7s]
  Running ‘utils.R’ [0s/1s]
  Running ‘varcorr.R’ [3s/5s]
  Running ‘vcov-etc.R’ [2s/4s]
Running the tests in ‘tests/boundary.R’ failed.
Complete output:
  > ## In both of these cases boundary fit (i.e. estimate of zero RE
  > ## variance) is *incorrect*. (Nelder_Mead, restart_edge=FALSE) is the
  > ## only case where we get stuck; either optimizer=bobyqa or
  > ## restart_edge=TRUE (default) works
  > 
  > library(lme4)
  Loading required package: Matrix
  > library(testthat)
  > 
  > if(!dev.interactive(orNone=TRUE)) pdf("boundary_plots.pdf")
  > 
  > ## Stephane Laurent:
  > dat <- read.csv(system.file("testdata","dat20101314.csv", package="lme4"))
  > 
  > fit   <- lmer(y ~ (1|Operator)+(1|Part)+(1|Part:Operator), data=dat,
  + 	      control= lmerControl(optimizer="Nelder_Mead"))
  > fit_b <- lmer(y ~ (1|Operator)+(1|Part)+(1|Part:Operator), data=dat,
  + 	      control= lmerControl(optimizer="bobyqa", restart_edge=FALSE))
  > fit_c <- lmer(y ~ (1|Operator)+(1|Part)+(1|Part:Operator), data=dat,
  + 	      control= lmerControl(optimizer="Nelder_Mead", restart_edge=FALSE,
  + 				   check.conv.hess="ignore"))
  boundary (singular) fit: see ?isSingular
  > ## final fit gives degenerate-Hessian warning
  > ## FIXME: use fit_c with expect_warning() as a check on convergence tests
  > ## tolerance=1e-5 seems OK in interactive use but not in R CMD check ... ??
  > stopifnot(all.equal(getME(fit,  "theta") -> th.f,
  + 		    getME(fit_b,"theta"), tolerance=5e-5),
  + 	  all(th.f > 0))
  > 
  > ## Manuel Koller
  > 
  > source(system.file("testdata", "koller-data.R", package="lme4"))
  > ldata <- getData(13)
  > ## old (backward compatible/buggy)
  > fm4  <- lmer(y ~ (1|Var2), ldata, control=lmerControl(optimizer="Nelder_Mead",
  +                                   use.last.params=TRUE),
  +              start=list(theta=1))
  > 
  > fm4b <- lmer(y ~ (1|Var2), ldata,
  +              control = lmerControl(optimizer="Nelder_Mead", use.last.params=TRUE,
  +                                    restart_edge = FALSE,
  +                                    check.conv.hess="ignore", check.conv.grad="ignore"),
  +              start = list(theta=1))
  > ## FIXME: use as convergence test check
  > stopifnot(getME(fm4b,"theta") == 0)
  > fm4c <- lmer(y ~ (1|Var2), ldata, control=lmerControl(optimizer="bobyqa",
  +                                                       use.last.params=TRUE),
  +              start=list(theta=1))
  > stopifnot(all.equal(getME(fm4, "theta") -> th4,
  + 		    getME(fm4c,"theta"), tolerance=1e-4),
  + 	  th4 > 0)
  > 
  > 
  > ## new: doesn't get stuck at edge any more,  but gets stuck somewhere else ...
  > fm5 <- lmer(y ~ (1|Var2), ldata, control=lmerControl(optimizer="Nelder_Mead",
  + 						     check.conv.hess="ignore",
  + 						     check.conv.grad="ignore"),
  + 	    start=list(theta=1))
  > fm5b <- lmer(y ~ (1|Var2), ldata, control=lmerControl(optimizer="Nelder_Mead",
  + 						      restart_edge=FALSE,
  + 						      check.conv.hess="ignore",
  + 						      check.conv.grad="ignore"),
  + 	     start = list(theta = 1))
  > fm5c <- lmer(y ~ (1|Var2), ldata, control=lmerControl(optimizer="bobyqa"),
  + 	     start = list(theta = 1))
  > stopifnot(all.equal(unname(getME(fm5c,"theta")), 0.21067645, tolerance = 1e-7))
  > 					#	 0.21067644264 [64-bit, lynne]
  > 
  > ##{
  >     ## additional stuff for diagnosing Nelder-Mead problems.
  > 
  >     library(optimx)
  >     fm5d <- update(fm5,control=lmerControl(optimizer="optimx",
  +                        optCtrl=list(method="L-BFGS-B")))
  > 
  >     fm5e <- update(fm5, control=lmerControl(optimizer="nloptwrap"))
  > 
  >     mList <- setNames(list(fm4,fm4b,fm4c,fm5,fm5b,fm5c,fm5d,fm5e),
  +                       c("NM/uselast","NM/uselast/norestart","bobyqa/uselast",
  +                         "NM","NM/norestart","bobyqa","LBFGSB","nloptr/bobyqa"))
  >     pp <- profile(fm5c,which=1)
  >     dd <- as.data.frame(pp)
  >     par(las=1,bty="l")
  >     v <- sapply(mList,
  +                 function(x) sqrt(VarCorr(x)[[1]]))
  >     plot(.zeta^2~.sig01, data=dd, type="b")
  >     abline(v=v)
  > 
  >     res <- cbind(VCorr  = sapply(mList, function(x) sqrt(VarCorr(x)[[1]])),
  +                  theta  = sapply(mList, getME,"theta"),
  +                  loglik = sapply(mList, logLik))
  >     res
                          VCorr     theta    loglik
  NM/uselast           3.241314 0.2106738 -1665.824
  NM/uselast/norestart 0.000000 0.0000000 -1667.230
  bobyqa/uselast       3.241353 0.2106764 -1665.824
  NM                   1.250418 0.0800000 -1667.230
  NM/norestart         1.250418 0.0800000 -1667.230
  bobyqa               3.241353 0.2106764 -1665.824
  LBFGSB               3.241361 0.2106770 -1665.824
  nloptr/bobyqa        3.241353 0.2106765 -1665.824
  >     print(sessionInfo(), locale=FALSE)
  R Under development (unstable) (2019-03-28 r76288)
  Platform: x86_64-pc-linux-gnu (64-bit)
  Running under: Debian GNU/Linux buster/sid
  
  Matrix products: default
  BLAS:   /home/hornik/tmp/R.check/r-devel-gcc/Work/build/lib/libRblas.so
  LAPACK: /home/hornik/tmp/R.check/r-devel-gcc/Work/build/lib/libRlapack.so
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] optimx_2018-7.10 testthat_2.0.1   lme4_1.1-21      Matrix_1.2-17   
  
  loaded via a namespace (and not attached):
   [1] Rcpp_1.0.1        lattice_0.20-38   MASS_7.3-51.2     grid_3.7.0       
   [5] R6_2.4.0          nlme_3.1-137      magrittr_1.5      rlang_0.3.3      
   [9] minqa_1.2.4       nloptr_1.2.1      boot_1.3-21       splines_3.7.0    
  [13] numDeriv_2016.8-1 compiler_3.7.0   
  > ##}
  > 
  > ######################
  > library(lattice)
  > ## testing boundary and near-boundary cases
  > 
  > tmpf <- function(i,...) {
  +     set.seed(i)
  +     d <- data.frame(x=rnorm(60),f=factor(rep(1:6,each=10)))
  +     d$y <- simulate(~x+(1|f),family=gaussian,newdata=d,
  +                     newparams=list(theta=0.01,beta=c(1,1),sigma=5))[[1]]
  +     lmer(y~x+(1|f),data=d,...)
  + }
  > sumf <- function(m) {
  +     unlist(VarCorr(m))[1]
  + }
  > if (FALSE) {
  +     ## figuring out which seeds will give boundary and
  +     ## near-boundary solutions
  +     mList <- lapply(1:201,tmpf) # [FIXME tons of messages "theta parameters vector not named"]
  +     ss <- sapply(mList,sumf)+1e-50
  +     par(las=1,bty="l")
  +     hist(log(ss),col="gray",breaks=50)
  +     ## values lying on boundary
  +     which(log(ss)<(-40))   ## 5, 7-13, 15, 21, ...
  +     ## values close to boundary (if check.edge not set)
  +     which(log(ss)>(-40) & log(ss) <(-20))  ## 16, 44, 80, 86, 116, ...
  + }
  > ## diagnostic plot
  > tmpplot <- function(i, FUN=tmpf) {
  +     dd <- FUN(i, devFunOnly=TRUE)
  +     x <- 10^seq(-10,-6.5,length=201)
  +     dvec <- sapply(x,dd)
  +     op <- par(las=1,bty="l"); on.exit(par(op))
  +     plot(x,dvec-min(dvec)+1e-16, log="xy", type="b")
  +     r <- FUN(i)
  +     abline(v = getME(r,"theta"), col=2)
  +     invisible(r)
  + }
  > 
  > ## Case #1: boundary estimate with or without boundary.tol
  > m5  <- tmpf(5)
  theta parameter vector not named: assuming same order as internal vector
  beta parameter vector not named: assuming same order as internal vector
  boundary (singular) fit: see ?isSingular
  > m5B <- tmpf(5,control=lmerControl(boundary.tol=0))
  theta parameter vector not named: assuming same order as internal vector
  beta parameter vector not named: assuming same order as internal vector
  boundary (singular) fit: see ?isSingular
  > stopifnot(getME(m5, "theta")==0,
  +           getME(m5B,"theta")==0)
  > p5 <- profile(m5)  ## bobyqa warnings but results look reasonable
  > xyplot(p5)
  Error in unit(0.5 * showr, "strwidth", list(right)) : 
    no string supplied for 'strwidth/height' unit
  Calls: <Anonymous> ... strip -> do.call -> strip.default -> paste.and.draw -> unit
  Execution halted
Running the tests in ‘tests/profile-tst.R’ failed.
Complete output:
  > library(lme4)
  Loading required package: Matrix
  > library(testthat)
  > library(lattice)
  > 
  > options(nwarnings = 5000)# instead of 50, and then use  summary(warnings())
  > 
  > ### __ was ./profile_plots.R ___
  > fm1 <- lmer(Reaction~ Days + (Days|Subject), sleepstudy)
  > pfile <- system.file("testdata","tprfm1.RData", package="lme4")
  > if(file.exists(pfile)) print(load(pfile)) else withAutoprint({
  +     system.time( tpr.fm1 <- profile(fm1, optimizer="Nelder_Mead") ) ## 5 sec (2018); >= 50 warnings !?
  +     save(tpr.fm1, file= "../../inst/testdata/tprfm1.RData")
  + })
  [1] "tpr.fm1"
  > oo <- options(warn = 2) # {warnings are errors from here on}
  > 
  > if(!dev.interactive(orNone=TRUE)) pdf("profile_plots.pdf")
  > xyplot(tpr.fm1)
  Error in unit(0.5 * showr, "strwidth", list(right)) : 
    no string supplied for 'strwidth/height' unit
  Calls: <Anonymous> ... strip -> do.call -> strip.default -> paste.and.draw -> unit
  Execution halted