Running examples in ‘VetResearchLMM-Ex.R’ failed
The error most likely occurred in:

> ### Name: Examp2.4.2.2
> ### Title: Examp2.4.2.2 from Duchateau, L. and Janssen, P. and Rowlands, G.
> ###   J. (1998)._Linear Mixed Models. An Introduction with applications in
> ###   Veterinary Research_. International Livestock Research Institute.
> ### Aliases: Examp2.4.2.2
> ### Keywords: datasets
> 
> ### ** Examples
> 
> #-------------------------------------------------------------
> ## Example 2.4.2.2 p-64
> #-------------------------------------------------------------
> # PROC MIXED DATA=ex125 METHOD=ML;
> # CLASS drug dose region;
> # MODEL pcv=drug dose drug*dose;
> # RANDOM region drug*region;
> # RUN;
> # 
> # PROC MIXED DATA=ex125 METHOD=REML;
> # CLASS drug dose region;
> # MODEL pcv=drug dose drug*dose;
> # RANDOM region drug*region;
> # RUN;
>  
>  
> library(lme4)
Loading required package: Matrix
> str(ex125)
'data.frame':	24 obs. of  4 variables:
 $ Region: int  1 1 1 1 2 2 2 2 3 3 ...
 $ Drug  : Factor w/ 2 levels "BERENIL","samorin": 1 1 2 2 1 1 2 2 1 1 ...
 $ dose  : Factor w/ 2 levels "h","l": 1 2 1 2 1 2 1 2 1 2 ...
 $ Pcv   : num  22.6 21.8 19.1 16.4 29 28.8 25.3 18.2 24 23.7 ...
> 
> fm2.4 <- lme4::lmer(formula = Pcv ~ dose*Drug + (1|Region/Drug), data=ex125, REML = FALSE)
> summary(fm2.4)
Linear mixed model fit by maximum likelihood  ['lmerMod']
Formula: Pcv ~ dose * Drug + (1 | Region/Drug)
   Data: ex125

     AIC      BIC   logLik deviance df.resid 
   111.9    120.1    -48.9     97.9       17 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-1.87406 -0.56556  0.09217  0.76983  1.27213 

Random effects:
 Groups      Name        Variance Std.Dev.
 Drug:Region (Intercept) 0.3225   0.5679  
 Region      (Intercept) 4.2924   2.0718  
 Residual                1.7470   1.3217  
Number of obs: 24, groups:  Drug:Region, 12; Region, 6

Fixed effects:
                  Estimate Std. Error t value
(Intercept)        25.4500     1.0297  24.716
dosel              -1.1667     0.7631  -1.529
Drugsamorin        -3.9667     0.8306  -4.776
dosel:Drugsamorin  -3.1833     1.0792  -2.950

Correlation of Fixed Effects:
            (Intr) dosel  Drgsmr
dosel       -0.371              
Drugsamorin -0.403  0.459       
dsl:Drgsmrn  0.262 -0.707 -0.650
> anova(fm2.4)
Analysis of Variance Table
          Df Sum Sq Mean Sq F value
dose       1  45.65   45.65 26.1305
Drug       1 135.39  135.39 77.4955
dose:Drug  1  15.20   15.20  8.7008
> 
> fm2.5 <- lme4::lmer(formula = Pcv ~ dose*Drug + (1|Region/Drug), data=ex125, REML = TRUE)
> summary(fm2.5)
Linear mixed model fit by REML ['lmerMod']
Formula: Pcv ~ dose * Drug + (1 | Region/Drug)
   Data: ex125

REML criterion at convergence: 92.4

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-1.71077 -0.51628  0.08414  0.70276  1.16129 

Random effects:
 Groups      Name        Variance Std.Dev.
 Drug:Region (Intercept) 0.387    0.6221  
 Region      (Intercept) 5.151    2.2695  
 Residual                2.096    1.4479  
Number of obs: 24, groups:  Drug:Region, 12; Region, 6

Fixed effects:
                  Estimate Std. Error t value
(Intercept)        25.4500     1.1280  22.562
dosel              -1.1667     0.8359  -1.396
Drugsamorin        -3.9667     0.9098  -4.360
dosel:Drugsamorin  -3.1833     1.1822  -2.693

Correlation of Fixed Effects:
            (Intr) dosel  Drgsmr
dosel       -0.371              
Drugsamorin -0.403  0.459       
dsl:Drgsmrn  0.262 -0.707 -0.650
> anova(fm2.5)
Analysis of Variance Table
          Df Sum Sq Mean Sq F value
dose       1  45.65   45.65 21.7755
Drug       1 135.39  135.39 64.5796
dose:Drug  1  15.20   15.20  7.2507
> 
> library(lmerTest)

Attaching package: ‘lmerTest’

The following object is masked from ‘package:lme4’:

    lmer

The following object is masked from ‘package:stats’:

    step

> 
> fm2.6 <- lmerTest::lmer(formula = Pcv ~ dose*Drug + (1|Region/Drug), data=ex125, REML = FALSE)
> summary(fm2.6)
Linear mixed model fit by maximum likelihood t-tests use Satterthwaite
  approximations to degrees of freedom [lmerMod]
Formula: Pcv ~ dose * Drug + (1 | Region/Drug)
   Data: ex125

     AIC      BIC   logLik deviance df.resid 
   111.9    120.1    -48.9     97.9       17 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-1.87406 -0.56556  0.09217  0.76983  1.27213 

Random effects:
 Groups      Name        Variance Std.Dev.
 Drug:Region (Intercept) 0.3225   0.5679  
 Region      (Intercept) 4.2924   2.0718  
 Residual                1.7470   1.3217  
Number of obs: 24, groups:  Drug:Region, 12; Region, 6

Fixed effects:
                  Estimate Std. Error      df t value Pr(>|t|)    
(Intercept)        25.4500     1.0297  9.8500  24.716 3.43e-10 ***
dosel              -1.1667     0.7631 12.0000  -1.529 0.152229    
Drugsamorin        -3.9667     0.8306 14.1820  -4.776 0.000285 ***
dosel:Drugsamorin  -3.1833     1.0792 12.0000  -2.950 0.012151 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) dosel  Drgsmr
dosel       -0.371              
Drugsamorin -0.403  0.459       
dsl:Drgsmrn  0.262 -0.707 -0.650
> anova(fm2.6)

 *** caught segfault ***
address 19561348, cause 'memory not mapped'

Traceback:
 1: unique.default(Lind)
 2: unique(Lind)
 3: sort(unique(Lind))
 4: stopifnot(length(theta) > 0L, length(Lind) > 0L, all(sort(unique(Lind)) ==     seq_along(theta)))
 5: .Object$initialize(...)
 6: initialize(value, ...)
 7: initialize(value, ...)
 8: methods::new(def, ...)
 9: (function (...) {    methods::new(def, ...)})(Zt = <S4 object of class "dgCMatrix">, theta = c(1, 1), Lambdat = <S4 object of class "dgCMatrix">,     Lind = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,     2L, 2L, 2L, 2L, 2L, 2L), n = 24L, X = c(1, 1, 1, 1, 1, 1,     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,     1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0,     0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,     0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0))
10: do.call(merPredD$new, c(reTrms[c("Zt", "theta", "Lambdat", "Lind")],     n = nrow(X), list(X = X)))
11: (function (fr, X, reTrms, REML = TRUE, start = NULL, verbose = 0,     control = lmerControl(), ...) {    p <- ncol(X)    rho <- new.env(parent = parent.env(environment()))    rho$pp <- do.call(merPredD$new, c(reTrms[c("Zt", "theta",         "Lambdat", "Lind")], n = nrow(X), list(X = X)))    REMLpass <- if (REML)         p    else 0L    rho$resp <- if (missing(fr))         mkRespMod(REML = REMLpass, ...)    else mkRespMod(fr, REML = REMLpass)    devfun <- mkdevfun(rho, 0L, verbose = verbose, control = control)    if (is.null(start) && all(reTrms$cnms == "(Intercept)") &&         length(reTrms$flist) == length(reTrms$lower) && !is.null(y <- model.response(fr))) {        v <- sapply(reTrms$flist, function(f) var(ave(y, f)))        v.e <- var(y) - sum(v)        if (!is.na(v.e) && v.e > 0) {            v.rel <- v/v.e            if (all(v.rel >= reTrms$lower^2))                 rho$pp$setTheta(sqrt(v.rel))        }    }    if (length(rho$resp$y) > 0)         devfun(rho$pp$theta)    rho$lower <- reTrms$lower    devfun})(fr = list(Pcv = c(22.6, 21.8, 19.1, 16.4, 29, 28.8, 25.3, 18.2, 24, 23.7, 19.5, 16, 27.7, 26.3, 21.9, 16.6, 28.3, 23.3, 25.2, 19.3, 21.1, 21.8, 17.9, 16.3), dose = c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), Drug = c(1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L),     Region = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,     4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L)), X = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0), reTrms = list(Zt = <S4 object of class "dgCMatrix">,     theta = c(1, 1), Lind = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,     1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L), Gp = c(0L, 12L,     18L), lower = c(0, 0), Lambdat = <S4 object of class "dgCMatrix">,     flist = list(`Drug:Region` = c(1L, 1L, 7L, 7L, 2L, 2L, 8L,     8L, 3L, 3L, 9L, 9L, 4L, 4L, 10L, 10L, 5L, 5L, 11L, 11L, 6L,     6L, 12L, 12L), Region = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,     3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L,     6L)), cnms = list(`Drug:Region` = "(Intercept)", Region = "(Intercept)"),     Ztlist = list(`1 | Drug:Region` = <S4 object of class "dgCMatrix">,         `1 | Region` = <S4 object of class "dgCMatrix">)), REML = FALSE,     wmsgs = character(0), start = NULL, verbose = 0L, control = list(        optimizer = "bobyqa", restart_edge = TRUE, boundary.tol = 1e-05,         calc.derivs = TRUE, use.last.params = FALSE, checkControl = list(            check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",             check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",             check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",             check.scaleX = "warning", check.formula.LHS = "stop"),         checkConv = list(check.conv.grad = list(action = "warning",             tol = 0.002, relTol = NULL), check.conv.singular = list(            action = "ignore", tol = 1e-04), check.conv.hess = list(            action = "warning", tol = 1e-06)), optCtrl = list()))
12: do.call(mkLmerDevfun, c(lmod, list(start = start, verbose = verbose,     control = control)))
13: lme4::lmer(formula = Pcv ~ dose * Drug + (1 | Region/Drug), data = ex125,     REML = FALSE, contrasts = list(dose = "contr.SAS", Drug = "contr.SAS"))
14: eval(expr, envir, enclos)
15: eval(call, envir = ff)
16: doTryCatch(return(expr), name, parentenv, handler)
17: tryCatchOne(expr, names, parentenv, handlers[[1L]])
18: tryCatchList(expr, classes, parentenv, handlers)
19: tryCatch(eval(call, envir = ff), error = function(e) {    tryCatch(eval(call, envir = sf), error = function(e) {        tryCatch(eval(call, envir = pf), error = function(e) {            eval(call, envir = ff2)        })    })})
20: updateModel(model, mf.final = mf.final, change.contr = change.contr)
21: rhoInit(rho, model, change.contr)
22: calcANOVA(model = object, ddf = ddf, type = type)
23: doTryCatch(return(expr), name, parentenv, handler)
24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
25: tryCatchList(expr, classes, parentenv, handlers)
26: tryCatch({    calcANOVA(model = object, ddf = ddf, type = type)}, error = function(e) {    NULL})
27: .local(object, ...)
28: anova(fm2.6)
29: anova(fm2.6)
An irrecoverable exception occurred. R is aborting now ...