[R-sig-ME] lme4: qqmath.ranef.mer fails for lmer model with more than one random-effects term for a given grouping factor

Gerrit Eichner gerr|t@e|chner @end|ng |rom m@th@un|-g|e@@en@de
Wed May 15 14:01:44 CEST 2019

Dear lme4-experts,

for an lmer model with more than one random-effects term for a
given grouping factor as in the following example taken from
qqmath.ranef.mer's help page

fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject),

"caterpillar plots" of the random effects applying dotplot,
i.e., dotplot.ranef.mer, to the result of a call to ranef
with condVar = TRUE appear as expected:

dotplot(ranef(fm2, condVar = TRUE))

But trying the analogue for the respective Q-Q plots using qqmath,
i.e., qqmath.ranef.mer, throws an error:

qqmath(ranef(fm2, condVar = TRUE))

Error in seq_len(d[1]) :
   argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(d[1]) : first element used of 'length.out' argument

Does anyone happen to already have a work-around for this?

(It appears to me that the problem originates in the structure
of the postVar attribute of ranef(fm2, condVar = TRUE) in contrast
to its structure of ranef(fm1, condVar = TRUE) where fm1 <-
lmer(Reaction ~ Days + (Days|Subject), sleepstudy).)

Thanks for any hints.

  Best regards  --  Gerrit

PS: sessionInfo()

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] ggplot2_3.1.1   lattice_0.20-38 lme4_1.1-21     Matrix_1.2-17

loaded via a namespace (and not attached):
  [1] Rcpp_1.0.1       magrittr_1.5     splines_3.5.3    MASS_7.3-51.3
  [5] tidyselect_0.2.5 munsell_0.5.0    colorspace_1.4-1 R6_2.4.0
  [9] rlang_0.3.4      minqa_1.2.4      plyr_1.8.4       dplyr_0.8.0.1
[13] tools_3.5.3      grid_3.5.3       gtable_0.3.0     nlme_3.1-137
[17] withr_2.1.2      assertthat_0.2.1 lazyeval_0.2.2   tibble_2.1.1
[21] crayon_1.3.4     purrr_0.3.2      nloptr_1.2.1     glue_1.3.1
[25] labeling_0.3     compiler_3.5.3   pillar_1.3.1     scales_1.0.0
[29] boot_1.3-20      pkgconfig_2.0.2

Dr. Gerrit Eichner                   Mathematical Institute, Room 212
gerrit.eichner using math.uni-giessen.de   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104          Arndtstr. 2, 35392 Giessen, Germany

More information about the R-sig-mixed-models mailing list