[R] [effects] Wrong xlevels in effects plot for mixed effects model when multiline = TRUE

Gerrit Eichner gerr|t@e|chner @end|ng |rom m@th@un|-g|e@@en@de
Mon Nov 9 14:06:08 CET 2020

Dear list members,

I observe a strange/wrong graphical output when I set the xlevels
in (e. g.) allEffects for an lmer model and plot the effects with
multiline = TRUE. I have compiled a reprex for which you need the
lmer model and the environment in which the model was fitted. They
are contained in the zip file at
After unpacking the following should work:

m <- readRDS("m.rds")   # The lmer-model.
G1 <- readRDS("G1.rds") # Environment in which the model
                          # was fitted; needed by alaEffects.
summary(m) # Just to see the model.

aE <- allEffects(m, xlevels = list(gProt = 1:6 * 30))
                      # Non-default values for xlevels.

plot(aE)                      # Fine.
plot(aE, x.var = "Age")       # Fine.
plot(aE, lines = list(multiline = TRUE))  # Fine.

plot(aE, lines = list(multiline = TRUE),
       x.var = "Age")        # Nonsense.

Anybody any idea about the reason, my mistake, or a
workaround? Thx for any hint!

   Regards  --  Gerrit

  > sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

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] effects_4.2-0 carData_3.0-4

loaded via a namespace (and not attached):
   [1] Rcpp_1.0.5       lattice_0.20-41  MASS_7.3-53      grid_4.0.2 
   [6] nlme_3.1-149     survey_4.0       estimability_1.3 minqa_1.2.4 
[11] Matrix_1.2-18    boot_1.3-25      splines_4.0.2    statmod_1.4.34 
[16] tools_4.0.2      survival_3.2-3   yaml_2.2.1       compiler_4.0.2 
[21] mitools_2.4      insight_0.9.5    nnet_7.3-14

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-help mailing list