Running ‘AAAtest-all.R’ [132s/177s]
  Running ‘HSAURtrees.R’ [2s/4s]
  Running ‘REMLdev.R’ [2s/3s]
  Running ‘ST.R’ [2s/3s]
  Running ‘agridat_gotway.R’ [3s/5s]
  Running ‘bootMer.R’ [6s/16s]
  Running ‘boundary.R’ [8s/11s]
  Running ‘confint.R’ [3s/4s]
  Running ‘devCritFun.R’ [2s/3s]
  Running ‘devfunQ.R’ [2s/4s]
  Running ‘drop.R’ [3s/4s]
  Running ‘drop1contrasts.R’ [2s/4s]
  Running ‘dynload.R’ [0s/1s]
  Running ‘elston.R’ [3s/4s]
  Running ‘evalCall.R’ [2s/4s]
  Running ‘extras.R’ [2s/3s]
  Running ‘falsezero_dorie.R’ [2s/3s]
  Running ‘fewlevels.R’ [11s/16s]
  Running ‘getME.R’ [3s/5s]
  Running ‘glmer-1.R’ [4s/7s]
  Running ‘glmerControlPass.R’ [7s/11s]
  Running ‘glmerWarn.R’ [2s/3s]
  Running ‘glmmExt.R’ [7s/9s]
  Running ‘glmmWeights.R’ [6s/10s]
  Running ‘hatvalues.R’ [2s/3s]
  Running ‘is.R’ [3s/4s]
  Running ‘lmList-tst.R’ [4s/6s]
  Running ‘lme4_nlme.R’ [2s/4s]
  Running ‘lmer-0.R’ [3s/4s]
  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/2s]
  Running ‘methods.R’ [2s/3s]
  Running ‘minval.R’ [2s/3s]
  Running ‘modFormula.R’ [2s/3s]
  Running ‘nbinom.R’ [2s/3s]
  Running ‘nlmer-conv.R’ [2s/3s]
  Running ‘nlmer.R’ [2s/4s]
  Comparing ‘nlmer.Rout’ to ‘nlmer.Rout.save’ ... OK
  Running ‘offset.R’ [3s/5s]
  Running ‘optimizer.R’ [4s/5s]
  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/10s]
  Running ‘priorWeightsModComp.R’ [2s/4s]
  Running ‘profile-tst.R’ [32s/60s]
  Running ‘refit.R’ [19s/30s]
  Running ‘resids.R’ [2s/4s]
  Running ‘respiratory.R’ [7s/10s]
  Running ‘simulate.R’ [4s/7s]
  Running ‘testOptControl.R’ [2s/4s]
  Running ‘test_times.R’ [2s/3s]
  Running ‘testcolonizer.R’ [3s/5s]
  Running ‘testcrab.R’ [8s/14s]
  Running ‘throw.R’ [5s/8s]
  Running ‘utils.R’ [0s/1s]
  Running ‘varcorr.R’ [3s/4s]
  Running ‘vcov-etc.R’ [2s/4s]
Running the tests in ‘tests/modFormula.R’ failed.
Complete output:
  > library(lme4)
  Loading required package: Matrix
  > library(testthat)
  > 
  > .get.checkingOpts <- lme4:::.get.checkingOpts
  > stopifnot(identical(
  +     .get.checkingOpts(
  +     c("CheckMe", "check.foo", "check.conv.1", "check.rankZ", "check.rankX"))
  +     , c("check.foo", "check.rankZ")))
  > 
  > lmod <- lFormula(Reaction ~ Days + (Days|Subject), sleepstudy)
  > devfun <- do.call(mkLmerDevfun, lmod)
  > opt <- optimizeLmer(devfun)
  > cc <- lme4:::checkConv(attr(opt,"derivs"), opt$par, ctrl = lmerControl()$checkConv,
  +                 lbound=environment(devfun)$lower)
  > fm1 <- mkMerMod(environment(devfun), opt, lmod$reTrms, fr = lmod$fr,
  +                 lme4conv=cc)
  > fm2 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
  > 
  > ## basic equivalence
  > fm1C <- fm1
  > fm1C@call <- fm2@call
  > expect_equal(fm2,fm1C)
  > expect_equal(range(residuals(fm1)),c(-101.1789,132.5466),tolerance=1e-6)
  > expect_is(model.frame(fm1),"data.frame")
  > ## formulae
  > expect_equal(formula(model.frame(fm1)),Reaction ~ Days + Subject) ## fixed only
  Error: formula(model.frame(fm1)) not equal to Reaction ~ Days + Subject.
  formulas differ in contents
  Execution halted
Running the tests in ‘tests/refit.R’ failed.
Complete output:
  > #### Testing  refit()
  > #### ----------------
  > 
  > library(lme4)
  Loading required package: Matrix
  > set.seed(101)
  > 
  > ## for each type of model, should be able to
  > ##  (1) refit with same data and get the same answer,
  > ##     at least structurally (small numerical differences
  > ##     are probably unavoidable)
  > ##  (2) refit with simulate()d data
  > 
  > getinfo <- function(x) {
  +   c(fixef(x), logLik(x), unlist(ranef(x)), unlist(VarCorr(x)))
  + }
  > 
  > dropterms <- function(x) {
  +     attr(x@frame,"terms") <- NULL
  +     x
  + }
  > 
  > if (getRversion() >= "3.0.0") {
  +     attach(system.file("testdata", "lme-tst-fits.rda", package="lme4"))
  + } else {
  +     ## saved fits are not safe with old R versions; just re-compute ("cheat"!):
  + 
  +     fit_sleepstudy_2 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
  + 
  +     cbpp$obs <- factor(seq(nrow(cbpp)))
  +     ## intercept-only fixed effect
  +     fit_cbpp_0 <- glmer(cbind(incidence, size-incidence) ~ 1 + (1|herd),
  +                         cbpp, family=binomial)
  +     ## include fixed effect of period
  +     fit_cbpp_1 <- update(fit_cbpp_0, . ~ . + period)
  +     if(FALSE) ## include observation-level RE
  +         fit_cbpp_2 <- update(fit_cbpp_1, . ~ . + (1|obs))
  +     ## specify formula by proportion/weights instead
  +     fit_cbpp_3 <- update(fit_cbpp_1, incidence/size ~ period + (1 | herd), weights = size)
  + }
  > 
  > 
  > ## LMM
  > fm1 <- fit_sleepstudy_2
  > fm1R <- refit(fm1, sleepstudy$Reaction)
  > fm1S <- refit(fm1, simulate(fm1)[[1]])
  > 
  > stopifnot(all.equal(getinfo(fm1 ),
  +                     getinfo(fm1R), tolerance = 6e-3),
  +           all.equal(getinfo(fm1 ),
  +                     getinfo(fm1S), tolerance = 0.5) # <- simulate()
  +           )
  > 
  > if(FALSE) { ## show all differences
  +     sapply(slotNames(fm1), function(.)
  +         all.equal( slot(fm1,.), slot(fm1R,.), tolerance=0))
  + }
  > 
  > if (getRversion() >= "3.4.0") {
  +     ## differences: FALSE for resp, theta, u, devcomp, pp, optinfo?
  +     ## FIXME: this isn't actually tested in any way ...
  +     sapply(slotNames(fm1),
  +            function(.) isTRUE(all.equal( slot(fm1,.), slot(fm1R,.), tolerance= 1.5e-5)))
  +     str(fm1 @ optinfo)
  +     str(fm1R@ optinfo)
  + }
  List of 7
   $ optimizer: chr "bobyqa"
   $ control  :List of 1
    ..$ iprint: int 0
   $ derivs   :List of 2
    ..$ gradient: num [1:3] -5.99e-06 -3.89e-06 -1.33e-05
    ..$ Hessian : num [1:3, 1:3] 37.2 27.6 -12.8 27.6 415.7 ...
   $ conv     :List of 2
    ..$ opt : int 0
    ..$ lme4: list()
   $ feval    : int 98
   $ warnings : list()
   $ val      : num [1:3] 0.9667 0.0152 0.2309
  List of 7
   $ optimizer: chr "bobyqa"
   $ control  :List of 1
    ..$ iprint: int 0
   $ derivs   :List of 2
    ..$ gradient: num [1:3] -1.10e-05 -3.70e-05 -2.91e-05
    ..$ Hessian : num [1:3, 1:3] 37.1 27.3 -12.6 27.3 413.3 ...
   $ conv     :List of 2
    ..$ opt : int 0
    ..$ lme4: list()
   $ feval    : int 97
   $ warnings : list()
   $ val      : num [1:3] 0.9713 0.0148 0.2319
  > 
  > fm1ML <- refitML(fm1)
  > stopifnot(
  +     all.equal(getinfo(fm1), getinfo(fm1ML), tolerance=0.05)# 0.029998
  + )
  > 
  > 
  > ## binomial GLMM (two-column)
  > gm1 <- fit_cbpp_1
  > gm1R <- refit(gm1, with(cbpp, cbind(incidence,size-incidence)))
  > 
  >  sim1Z <- simulate(gm1)[[1]]
  >  sim1Z[4,] <- c(0,0)
  >  (gm1. <- refit(gm1, sim1Z)) # earlier gave Error:  ... PIRLS ... failed ...
  Generalized linear mixed model fit by maximum likelihood (Laplace
    Approximation) [glmerMod]
   Family: binomial  ( logit )
  Formula: cbind(incidence, size - incidence) ~ (1 | herd) + period
     Data: cbpp
       AIC      BIC   logLik deviance df.resid 
  156.3864 166.5131 -73.1932 146.3864       51 
  Random effects:
   Groups Name        Std.Dev.
   herd   (Intercept) 0.3556  
  Number of obs: 56, groups:  herd, 15
  Fixed Effects:
  (Intercept)      period2      period3      period4  
      -1.1980      -0.9414      -1.7120      -1.9900  
  > 
  > all.equal(getinfo(gm1), getinfo(gm1R), tolerance=0) # to see it --> 5.52e-4
  [1] "Mean relative difference: 5.524803e-05"
  > # because glmer() uses Laplace approx. (? -- still, have *same* y !)
  > stopifnot(all.equal(getinfo(gm1), getinfo(gm1R), tolerance = 1e-4))
  > 
  > gm1S <- refit(gm1, simulate(gm1)[[1]])
  >           all.equal(getinfo(gm1), getinfo(gm1S), tolerance=0) # to see:
  [1] "Mean relative difference: 0.1992717"
  > stopifnot(all.equal(getinfo(gm1), getinfo(gm1S), tolerance = 0.4))
  > 
  > ## binomial GLMM (prob/weights)
  > formula(gm2 <- fit_cbpp_3)
  incidence/size ~ period + (1 | herd)
  > ## glmer(incidence/size ~ period + (1 | herd), cbpp, binomial, weights=size)
  > gm2R <- refit(gm2,  with(cbpp, incidence/size))
  >           all.equal(getinfo(gm2), getinfo(gm2R), tolerance= 0)
  [1] "Mean relative difference: 5.524803e-05"
  > stopifnot(all.equal(getinfo(gm2), getinfo(gm2R), tolerance= 6e-4))
  > 
  > ## FIXME: check on Windows == 2015-06: be brave
  > gm2S <- refit(gm2, simulate(gm2)[[1]])
  >           all.equal(getinfo(gm2), getinfo(gm2S), tolerance=0)# 0.17 .. upto 0.28
  [1] "Mean relative difference: 0.1674963"
  > stopifnot(all.equal(getinfo(gm2), getinfo(gm2S), tolerance=0.40))
  > 
  > ## from Alexandra Kuznetsova
  > set.seed(101)
  > Y <- matrix(rnorm(1000),ncol=2)
  > d <- data.frame(y1=Y[,1],  x=rnorm(100), f=rep(1:10,10))
  > fit1 <- lmer(y1 ~ x+(1|f),data=d)
  > fit2 <- refit(fit1, newresp = Y[,2], rename.response=TRUE)
  singular fit
  > ## check, but ignore terms attribute of model frame ...
  > tools::assertWarning(refit(fit1, newresp = Y[,2], junk=TRUE))
  singular fit
  > if (isTRUE(all.equal(fit1,fit2))) stop("fit1 and fit2 should not be equal")
  > ## hack number of function evaluations
  > u2 <- update(fit2)
  singular fit
  > fit2@optinfo$feval <- u2@optinfo$feval <-  NA
  > 
  > d1 <- dropterms(fit2)
  > d2 <- dropterms( u2 )
  > ## They are not "all equal", but mostly :
  > for (i in slotNames(d1)) {
  +     ae <- all.equal(slot(d1,i), slot(d2,i))
  +     cat(sprintf("%10s: %s\n", i, if(isTRUE(ae)) "all.equal"
  + 		else paste(ae, collapse="\n  ")))
  + }
        resp: Component "REML": Mean relative difference: 1
          Gp: all.equal
        call: all.equal
       frame: all.equal
       flist: all.equal
        cnms: all.equal
       lower: all.equal
       theta: all.equal
        beta: all.equal
           u: all.equal
     devcomp: Component "cmp": Mean relative difference: 0.001259665
    Component "dims": Mean relative difference: 1
          pp: all.equal
     optinfo: Component "derivs": Component "Hessian": Mean relative difference: 0.001951209
  >           all.equal(getinfo(d1), getinfo(d2),  tolerance = 0)# -> 0.00126
  [1] "Mean relative difference: 0.001259665"
  > stopifnot(all.equal(getinfo(d1), getinfo(d2),  tolerance = 0.005))
  > 
  > 
  > ## Bernoulli GLMM (specified as factor)
  > if (requireNamespace("mlmRev")) {
  +     data(Contraception, package="mlmRev")
  +     gm3 <- glmer(use ~ urban + age + livch + (1|district),
  +                  Contraception, binomial)
  +     gm3R <- refit(gm3, Contraception$use)
  +     gm3S <- refit(gm3, simulate(gm3)[[1]])
  +     stopifnot(all.equal(getinfo(gm3 ),
  +                         getinfo(gm3R), tolerance = 1e-5),# 64b_Lx: 7.99e-7
  +               all.equal(getinfo(gm3 ),
  +                         getinfo(gm3S), tolerance = 0.05) # <- simulated data
  +               )
  +     cat("gm3: glmer(..):\n"        ); print(getinfo(gm3))
  +     cat("gm3R: refit(*, y):\n"     ); print(getinfo(gm3R))
  +     cat("gm3S: refit(*, sim.()):\n"); print(getinfo(gm3S))
  + 
  +     data(Mmmec, package="mlmRev")
  +     if (lme4:::testLevel() > 1) {
  +         gm4 <- glmer(deaths ~ uvb + (1|region), data=Mmmec,
  +                      family = poisson,
  +                      offset = log(expected))
  +         ## FIXME: Fails to converge (with larger maxit: "downdate .. not pos.def..")
  +         try( gm4R <- refit(gm4, Mmmec $ deaths) )
  +         try( gm4S <- refit(gm4, simulate(gm4)[[1]]) )
  +         if(FALSE) { ## FIXME (above)
  +             cat("gm4R: refit(*,y):\n" ); print( getinfo(gm4R) )
  +             cat("gm4S: refit(*,y):\n" ); print( getinfo(gm4S) )
  +             stopifnot(all.equal(getinfo(gm4),getinfo(gm4R),tolerance=6e-5))
  +         }
  +     }
  + }
  Loading required namespace: mlmRev
  gm3: glmer(..):
             (Intercept)                 urbanY                    age 
           -1.689648e+00           7.329785e-01          -2.659398e-02 
                  livch1                 livch2                livch3+ 
            1.109125e+00           1.376341e+00           1.345184e+00 
                          district.(Intercept)1  district.(Intercept)2 
           -1.206808e+03          -7.220005e-01          -3.575875e-02 
   district.(Intercept)3  district.(Intercept)4  district.(Intercept)5 
            2.044601e-01           1.868071e-01           5.634614e-02 
   district.(Intercept)6  district.(Intercept)7  district.(Intercept)8 
           -2.179315e-01          -1.353718e-01           1.129183e-01 
   district.(Intercept)9 district.(Intercept)10 district.(Intercept)11 
           -2.217344e-01          -3.697112e-01          -7.015678e-01 
  district.(Intercept)12 district.(Intercept)13 district.(Intercept)14 
           -8.622141e-02           1.222621e-01           6.063261e-01 
  district.(Intercept)15 district.(Intercept)16 district.(Intercept)17 
           -4.131587e-02           5.485478e-01          -1.342503e-01 
  district.(Intercept)18 district.(Intercept)19 district.(Intercept)20 
           -7.848690e-02           1.147564e-01           1.941322e-01 
  district.(Intercept)21 district.(Intercept)22 district.(Intercept)23 
            6.611580e-03          -3.635335e-01          -1.559713e-01 
  district.(Intercept)24 district.(Intercept)25 district.(Intercept)26 
           -4.485272e-01           1.967991e-01           2.229938e-02 
  district.(Intercept)27 district.(Intercept)28 district.(Intercept)29 
           -4.594845e-01          -3.447620e-01          -1.154311e-01 
  district.(Intercept)30 district.(Intercept)31 district.(Intercept)32 
            4.292048e-01           2.856120e-01          -3.855215e-01 
  district.(Intercept)33 district.(Intercept)34 district.(Intercept)35 
           -7.997610e-02           7.178664e-01           2.303981e-01 
  district.(Intercept)36 district.(Intercept)37 district.(Intercept)38 
           -8.824630e-02           3.139336e-01          -1.852200e-01 
  district.(Intercept)39 district.(Intercept)40 district.(Intercept)41 
            4.597711e-01           1.367467e-01           3.113380e-01 
  district.(Intercept)42 district.(Intercept)43 district.(Intercept)44 
            2.056840e-01           4.871337e-01          -2.696609e-01 
  district.(Intercept)45 district.(Intercept)46 district.(Intercept)47 
           -1.540283e-01           5.620842e-01           2.053678e-01 
  district.(Intercept)48 district.(Intercept)49 district.(Intercept)50 
            4.299505e-01          -1.840547e-01           2.983444e-01 
  district.(Intercept)51 district.(Intercept)52 district.(Intercept)53 
            4.857832e-02           1.952726e-01          -1.277345e-01 
  district.(Intercept)54 district.(Intercept)55 district.(Intercept)56 
           -3.158415e-01           5.792750e-01          -4.203320e-01 
  district.(Intercept)57 district.(Intercept)58 district.(Intercept)59 
            2.276786e-01          -3.941215e-01          -3.940916e-01 
  district.(Intercept)60               district 
           -5.392089e-01           2.123661e-01 
  gm3R: refit(*, y):
             (Intercept)                 urbanY                    age 
           -1.689668e+00           7.329852e-01          -2.659443e-02 
                  livch1                 livch2                livch3+ 
            1.109155e+00           1.376366e+00           1.345200e+00 
                          district.(Intercept)1  district.(Intercept)2 
           -1.206808e+03          -7.219962e-01          -3.575811e-02 
   district.(Intercept)3  district.(Intercept)4  district.(Intercept)5 
            2.044510e-01           1.868026e-01           5.634807e-02 
   district.(Intercept)6  district.(Intercept)7  district.(Intercept)8 
           -2.179278e-01          -1.353677e-01           1.129167e-01 
   district.(Intercept)9 district.(Intercept)10 district.(Intercept)11 
           -2.217294e-01          -3.696966e-01          -7.015443e-01 
  district.(Intercept)12 district.(Intercept)13 district.(Intercept)14 
           -8.621756e-02           1.222608e-01           6.063205e-01 
  district.(Intercept)15 district.(Intercept)16 district.(Intercept)17 
           -4.131538e-02           5.485359e-01          -1.342449e-01 
  district.(Intercept)18 district.(Intercept)19 district.(Intercept)20 
           -7.848435e-02           1.147553e-01           1.941288e-01 
  district.(Intercept)21 district.(Intercept)22 district.(Intercept)23 
            6.611222e-03          -3.635239e-01          -1.559657e-01 
  district.(Intercept)24 district.(Intercept)25 district.(Intercept)26 
           -4.485103e-01           1.967968e-01           2.229769e-02 
  district.(Intercept)27 district.(Intercept)28 district.(Intercept)29 
           -4.594727e-01          -3.447546e-01          -1.154258e-01 
  district.(Intercept)30 district.(Intercept)31 district.(Intercept)32 
            4.291999e-01           2.856088e-01          -3.855105e-01 
  district.(Intercept)33 district.(Intercept)34 district.(Intercept)35 
           -7.997605e-02           7.178542e-01           2.303934e-01 
  district.(Intercept)36 district.(Intercept)37 district.(Intercept)38 
           -8.824510e-02           3.139249e-01          -1.852122e-01 
  district.(Intercept)39 district.(Intercept)40 district.(Intercept)41 
            4.597644e-01           1.367460e-01           3.113310e-01 
  district.(Intercept)42 district.(Intercept)43 district.(Intercept)44 
            2.056753e-01           4.871267e-01          -2.696533e-01 
  district.(Intercept)45 district.(Intercept)46 district.(Intercept)47 
           -1.540280e-01           5.620804e-01           2.053638e-01 
  district.(Intercept)48 district.(Intercept)49 district.(Intercept)50 
            4.299435e-01          -1.840452e-01           2.983398e-01 
  district.(Intercept)51 district.(Intercept)52 district.(Intercept)53 
            4.857553e-02           1.952703e-01          -1.277327e-01 
  district.(Intercept)54 district.(Intercept)55 district.(Intercept)56 
           -3.158305e-01           5.792671e-01          -4.203199e-01 
  district.(Intercept)57 district.(Intercept)58 district.(Intercept)59 
            2.276751e-01          -3.941079e-01          -3.940821e-01 
  district.(Intercept)60               district 
           -5.391997e-01           2.123554e-01 
  gm3S: refit(*, sim.()):
             (Intercept)                 urbanY                    age 
           -1.897945e+00           7.142998e-01          -1.162013e-02 
                  livch1                 livch2                livch3+ 
            1.357753e+00           1.250502e+00           1.436866e+00 
                          district.(Intercept)1  district.(Intercept)2 
           -1.172638e+03          -1.406919e-01           1.618161e-01 
   district.(Intercept)3  district.(Intercept)4  district.(Intercept)5 
           -6.633219e-02          -5.371319e-02          -4.118995e-01 
   district.(Intercept)6  district.(Intercept)7  district.(Intercept)8 
            2.609803e-01           8.645504e-02           1.745469e-01 
   district.(Intercept)9 district.(Intercept)10 district.(Intercept)11 
           -7.760334e-02           3.889742e-02           1.799640e-01 
  district.(Intercept)12 district.(Intercept)13 district.(Intercept)14 
           -2.097896e-02           2.228891e-01           1.027556e-01 
  district.(Intercept)15 district.(Intercept)16 district.(Intercept)17 
            1.526925e-02           1.763649e-01           2.560543e-01 
  district.(Intercept)18 district.(Intercept)19 district.(Intercept)20 
           -1.550392e-01          -7.953582e-02           7.920560e-02 
  district.(Intercept)21 district.(Intercept)22 district.(Intercept)23 
            3.627990e-02          -1.622685e-01           8.548077e-02 
  district.(Intercept)24 district.(Intercept)25 district.(Intercept)26 
            2.675691e-01          -3.431987e-01          -3.213991e-02 
  district.(Intercept)27 district.(Intercept)28 district.(Intercept)29 
           -5.870719e-02           8.619520e-02          -2.398112e-01 
  district.(Intercept)30 district.(Intercept)31 district.(Intercept)32 
            4.561844e-02          -1.031565e-01          -6.172499e-02 
  district.(Intercept)33 district.(Intercept)34 district.(Intercept)35 
           -8.453722e-02           1.718962e-01           1.512799e-02 
  district.(Intercept)36 district.(Intercept)37 district.(Intercept)38 
           -1.418778e-01           1.848377e-01           1.025693e-01 
  district.(Intercept)39 district.(Intercept)40 district.(Intercept)41 
           -9.354545e-02          -2.407277e-01           1.106225e-01 
  district.(Intercept)42 district.(Intercept)43 district.(Intercept)44 
            1.128131e-01           2.998593e-02           3.143826e-03 
  district.(Intercept)45 district.(Intercept)46 district.(Intercept)47 
            6.795768e-02          -1.909057e-01          -2.157674e-04 
  district.(Intercept)48 district.(Intercept)49 district.(Intercept)50 
            2.073983e-01           1.455592e-02           1.414515e-01 
  district.(Intercept)51 district.(Intercept)52 district.(Intercept)53 
           -3.021403e-01           1.992135e-01           2.187249e-01 
  district.(Intercept)54 district.(Intercept)55 district.(Intercept)56 
            9.578345e-03           9.194540e-02           1.296031e-01 
  district.(Intercept)57 district.(Intercept)58 district.(Intercept)59 
           -7.596195e-02          -2.338646e-01          -3.432809e-01 
  district.(Intercept)60               district 
           -2.392261e-01           8.320507e-02 
  > 
  > ## ----------------------------------------------------------------------
  > ## issue: #231, http://ms.mcmaster.ca/~bolker/misc/boot_reset.html
  > ## commits: 1a34cd0, e33d698, 53ce966, 7dbfff1, 73aa1bb, a693ba9, 8dc8cf0
  > ## ----------------------------------------------------------------------
  > 
  > formGrouse <- TICKS ~ YEAR + scale(HEIGHT) + (1 | BROOD) + (1 | INDEX) + (1 | LOCATION)
  > gmGrouse <- glmer(formGrouse, family = "poisson", data = grouseticks)
  > set.seed(105)
  > simTICKS <- simulate(gmGrouse)[[1]]
  > newdata <- transform(grouseticks, TICKS = simTICKS)
  > gmGrouseUpdate <- update(gmGrouse, data = newdata)
  > gmGrouseRefit  <-  refit(gmGrouse, newresp = simTICKS)
  > 
  > all.equal(bet.U <- fixef(gmGrouseUpdate),
  +           bet.R <- fixef(gmGrouseRefit), tolerance = 0)
  [1] "Mean relative difference: 4.750005e-05"
  > all.equal(th.U <- getME(gmGrouseUpdate, "theta"),
  +           th.R <- getME(gmGrouseRefit,  "theta"), tolerance = 0)
  [1] "Mean relative difference: 8.491328e-06"
  > all.equal(dev.U <- deviance(gmGrouseUpdate),
  +           dev.R <- deviance(gmGrouseRefit),	tolerance = 0)
  [1] "Mean relative difference: 1.837542e-06"
  > stopifnot(
  +     all.equal(bet.U, bet.R, tolerance = 4e-5), # saw 1.0e-5
  +     all.equal( th.U,  th.R, tolerance = 4e-5), # saw 1.2e-5
  +     all.equal(dev.U, dev.R, tolerance = 2e-5)) # saw 4.6e-6
  Error: bet.U and bet.R are not equal:
    Mean relative difference: 4.750005e-05
  Execution halted