Home > database >  interpretation of ranef dotplot - random slopes variable centered at zero? R
interpretation of ranef dotplot - random slopes variable centered at zero? R

Time:03-02

I have an generalized mixed effects model such as the following:

library(lme4)
mod1<-glmer(resp~var1 (var1||group1) (1|group2), family=binomial, data=testdata,
             control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=2e6)),nAGQ=0)



     AIC      BIC   logLik deviance df.resid 
  1112.4   1140.6   -550.2   1100.4      814 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.8083 -0.9033 -0.5787  0.9235  1.7280 

Random effects:
 Groups   Name        Variance Std.Dev.
 group2   var1        0.0000   0.0000  
 group2.1 (Intercept) 0.2059   0.4538  
 group1   var1        0.0000   0.0000  
 group1.1 (Intercept) 0.1071   0.3272  
Number of obs: 820, groups:  group2, 74; group1, 7

Fixed effects:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  1.08061    0.35577   3.037 0.002387 ** 
var1        -0.08115    0.02308  -3.516 0.000438 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
     (Intr)
var1 -0.900

When I look at ranef plot, the var 1 which I modeled as a random slope is centered around 0. I haven't been able to find any similar looking ranef plots, I haven't been able to dwell too deep into mixed effect models as my background is not really mathematical heavy. I am not sure what to think of this plot, what does it mean in terms of var 1?

lattice::dotplot(ranef(mod1,which="group1", condVar=TRUE))

enter image description here

my data is

testdata<-structure(list(group2 = c(27, 27, 27, 27, 27, 27, 27, 27, 27, 
27, 27, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 
5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 
10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 16, 
16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 
19, 19, 19, 19, 19, 19, 19, 56, 56, 56, 56, 56, 56, 56, 56, 56, 
56, 56, 56, 56, 56, 56, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 
65, 65, 65, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 66, 66, 
66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 
67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 
68, 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 
69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 
71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 
72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 74, 74, 74, 74, 74, 
74, 74, 74, 74, 74, 74, 74, 74, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
3, 3, 3, 3, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 
63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 62, 62, 
62, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 
61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 
59, 58, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 21, 
21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 
23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 
26, 26, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 
9, 9, 9, 9, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 
14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 
53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 
54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 
55, 55, 55, 55, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 
50, 50, 50, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 30, 30, 
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 
31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 33, 33, 33, 35, 35, 
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 37, 37, 37, 
37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 39, 39, 39, 39, 39, 39, 
39, 39, 39, 39, 39, 39, 39, 39, 41, 41, 41, 41, 41, 41, 41, 41, 
41, 41, 41, 41, 41, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 45, 
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 20, 20, 20, 
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 28, 28, 28, 28, 
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 47, 47, 47, 47, 47, 
47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 32, 32, 32, 32, 32, 
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 34, 34, 34, 
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 36, 
36, 36, 36, 36, 36, 36, 36, 36, 38, 38, 38, 38, 38, 38, 38, 38, 
38, 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 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1), var1 = c(18.8679622641132, 
18.8679622641132, 21.2132034355964, 20.976176963403, 20.7364413533277, 
19.2353840616713, 19.2353840616713, 19.2353840616713, 19.2353840616713, 
19.2353840616713, 19.2353840616713, 18.8679622641132, 18.8679622641132, 
18.8679622641132, 15.8113883008419, 15.8113883008419, 15.8113883008419, 
20.976176963403, 20.976176963403, 20.976176963403, 22.9128784747792, 
22.9128784747792, 22.9128784747792, 22.9128784747792, 22.9128784747792, 
22.9128784747792, 22.9128784747792, 22.9128784747792, 22.9128784747792, 
22.9128784747792, 22.9128784747792, 22.9128784747792, 17.606816861659, 
18.1659021245849, 18.1659021245849, 18.1659021245849, 18.1659021245849, 
18.1659021245849, 17.0293863659264, 17.0293863659264, 17.0293863659264, 
21.095023109729, 21.095023109729, 21.095023109729, 20.2484567313166, 
20.2484567313166, 22.9128784747792, 22.9128784747792, 18.4390889145858, 
22.9128784747792, 22.9128784747792, 22.9128784747792, 20.976176963403, 
20.7364413533277, 20.7364413533277, 20.7364413533277, 20.7364413533277, 
20.7364413533277, 18.3030052177231, 17.8885438199983, 17.8885438199983, 
14.142135623731, 20.4939015319192, 20.4939015319192, 20.4939015319192, 
20.7364413533277, 20.7364413533277, 18.8414436814168, 20.7364413533277, 
20.7364413533277, 20.7364413533277, 20.2484567313166, 20.1246117974981, 
20.1246117974981, 20, 20, 20, 20, 20.976176963403, 17.606816861659, 
19.2353840616713, 19.7484176581315, 20.4939015319192, 20.4939015319192, 
20.2484567313166, 20.2484567313166, 20.2484567313166, 13.1909059582729, 
16.9705627484771, 10.4880884817015, 11.4891252930761, 11.8743420870379, 
11.8743420870379, 11.8743420870379, 11.8743420870379, 9.48683298050514, 
11.4017542509914, 11.4017542509914, 11.4017542509914, 12.6491106406735, 
11.4017542509914, 11.4017542509914, 16.9115345252878, 9.53939201416946, 
12.6491106406735, 11.4891252930761, 11.1803398874989, 14.0356688476182, 
14.0356688476182, 14.0356688476182, 14.0356688476182, 14.0356688476182, 
14.0356688476182, 14.0356688476182, 14.0356688476182, 14.5258390463339, 
10.0995049383621, 12.1243556529821, 15.4272486205415, 11.1803398874989, 
10.4403065089106, 9.64365076099295, 9.64365076099295, 11.7473401244707, 
11.7473401244707, 11.7473401244707, 13.7840487520902, 10.4880884817015, 
10.4880884817015, 11.8743420870379, 11.8743420870379, 11.8743420870379, 
11.8743420870379, 11.8743420870379, 11.8743420870379, 11.8743420870379, 
11.8743420870379, 11.8743420870379, 11.8743420870379, 11.8743420870379, 
11.8743420870379, 11.8743420870379, 11.8743420870379, 11.8743420870379, 
14.4913767461894, 14.4913767461894, 14.4913767461894, 14.4913767461894, 
14.4913767461894, 14.4913767461894, 14.4913767461894, 14.4913767461894, 
14.4913767461894, 14.4913767461894, 16.1245154965971, 12.8840987267251, 
8.24621125123532, 8.83176086632785, 14.0712472794703, 17.8044938147649, 
17.8044938147649, 17.8044938147649, 17.8044938147649, 17.8044938147649, 
17.8044938147649, 17.8044938147649, 17.8044938147649, 17.8044938147649, 
11.8321595661992, 9.59166304662544, 14.8660687473185, 13.0384048104053, 
11.8743420870379, 13.3790881602597, 13.3790881602597, 13.3790881602597, 
13.3790881602597, 15.4272486205415, 12.0415945787923, 12.0415945787923, 
13.0384048104053, 13.0384048104053, 13.114877048604, 7.14142842854285, 
7.14142842854285, 7.14142842854285, 7.14142842854285, 7.14142842854285, 
7.14142842854285, 9.64365076099295, 9.64365076099295, 9.64365076099295, 
6.70820393249937, 6.32455532033676, 6.32455532033676, 16.5227116418583, 
5.56776436283002, 6.70820393249937, 7.81024967590665, 9.21954445729289, 
9.21954445729289, 9.53939201416946, 9.32737905308882, 9.4339811320566, 
9.4339811320566, 7.28010988928052, 8.12403840463596, 8.12403840463596, 
9.89949493661167, 9.4339811320566, 9.4339811320566, 9.4339811320566, 
9.4339811320566, 9.4339811320566, 9.4339811320566, 9.4339811320566, 
9.4339811320566, 10.2469507659596, 10, 9.53939201416946, 15.556349186104, 
13.7113092008021, 12.4096736459909, 12.9614813968157, 16.1554944214035, 
16.1554944214035, 16.1554944214035, 16.1554944214035, 16.1554944214035, 
16.1554944214035, 16.1554944214035, 16.1554944214035, 16.1554944214035, 
12.6491106406735, 12.6491106406735, 11.6189500386223, 11.6189500386223, 
11.6189500386223, 11.6189500386223, 11.6189500386223, 11.6189500386223, 
11.6189500386223, 11.6189500386223, 11.6189500386223, 11.6189500386223, 
9.69535971483266, 12.6491106406735, 14.4913767461894, 12.1655250605964, 
8.94427190999916, 8.94427190999916, 8.94427190999916, 8.94427190999916, 
8.94427190999916, 8.36660026534076, 18.7082869338697, 18.7082869338697, 
18.7082869338697, 19.8746069143518, 19.8746069143518, 19.8746069143518, 
15.1657508881031, 17.1755640373177, 17.1755640373177, 17.1755640373177, 
17.1755640373177, 17.1755640373177, 18.1659021245849, 15.1657508881031, 
15.1657508881031, 15.1657508881031, 19.8746069143518, 22.4722050542442, 
19.8746069143518, 19.8746069143518, 19.8746069143518, 19.8746069143518, 
19.8746069143518, 19.8746069143518, 21.9089023002066, 23.8746727726266, 
21.9089023002066, 21.9089023002066, 21.9089023002066, 14.4913767461894, 
11.6189500386223, 17.464249196573, 17.464249196573, 17.464249196573, 
17.464249196573, 23.0217288664427, 23.6643191323985, 5.47722557505166, 
18.8414436814168, 23.6643191323985, 18.3030052177231, 18.3030052177231, 
18.3030052177231, 16.431676725155, 16.431676725155, 16.431676725155, 
16.431676725155, 16.431676725155, 16.431676725155, 16.7332005306815, 
16.7332005306815, 16.7332005306815, 18.4390889145858, 18.4390889145858, 
13.4164078649987, 25.0998007960223, 13.9642400437689, 21.095023109729, 
21.095023109729, 21.095023109729, 21.095023109729, 21.095023109729, 
16.1245154965971, 16.1245154965971, 23.6643191323985, 23.6643191323985, 
23.6643191323985, 22.8035085019828, 22.8035085019828, 22.8035085019828, 
10.2469507659596, 9.32737905308882, 9.32737905308882, 9.38083151964686, 
9.89949493661167, 11.9582607431014, 9.79795897113271, 7.14142842854285, 
11.9582607431014, 12.4096736459909, 12.4096736459909, 12.4096736459909, 
9.79795897113271, 9.32737905308882, 9.32737905308882, 9.32737905308882, 
12.2882057274445, 8.94427190999916, 10.4880884817015, 10.4880884817015, 
10.4880884817015, 10.4880884817015, 10.4880884817015, 9.9498743710662, 
9.9498743710662, 12, 8.94427190999916, 8.66025403784439, 9.74679434480896, 
6.92820323027551, 6, 6, 6, 6.70820393249937, 6.70820393249937, 
7.87400787401181, 7.87400787401181, 7.93725393319377, 8.42614977317636, 
8.24621125123532, 7.48331477354788, 7.74596669241483, 7.74596669241483, 
7.74596669241483, 9.4339811320566, 5, 9.8488578017961, 9.8488578017961, 
9.8488578017961, 9.8488578017961, 9.8488578017961, 6.85565460040104, 
9.53939201416946, 9.53939201416946, 9.53939201416946, 9.59166304662544, 
9.38083151964686, 9.38083151964686, 9.38083151964686, 12.2474487139159, 
9.79795897113271, 9.79795897113271, 9.79795897113271, 9.79795897113271, 
10.4880884817015, 10.0498756211209, 9.38083151964686, 9.53939201416946, 
8.30662386291807, 8.30662386291807, 10.7238052947636, 10.7238052947636, 
10.7238052947636, 5.8309518948453, 10.9544511501033, 9.32737905308882, 
9, 7.74596669241483, 10.2469507659596, 10.2469507659596, 10.2469507659596, 
10.2469507659596, 10.2469507659596, 4.47213595499958, 4.47213595499958, 
4.47213595499958, 4.47213595499958, 4.47213595499958, 4.47213595499958, 
7.61577310586391, 7.61577310586391, 7.61577310586391, 7.61577310586391, 
7.61577310586391, 11.9582607431014, 11.9582607431014, 11.9582607431014, 
8.48528137423857, 6.70820393249937, 8.48528137423857, 8.48528137423857, 
8.48528137423857, 7.14142842854285, 7.14142842854285, 13, 13, 
8.42614977317636, 8.94427190999916, 10.295630140987, 9.64365076099295, 
10.3923048454133, 11.3137084989848, 8.18535277187245, 11.2694276695846, 
9.32737905308882, 9.32737905308882, 9.2736184954957, 8.36660026534076, 
8.36660026534076, 9.8488578017961, 8.77496438739212, 5.91607978309962, 
9.05538513813742, 9.05538513813742, 8.24621125123532, 9.53939201416946, 
8.12403840463596, 8.06225774829855, 7, 9.4339811320566, 9.38083151964686, 
9.38083151964686, 9.38083151964686, 7.87400787401181, 8.30662386291807, 
7.68114574786861, 9.64365076099295, 9.64365076099295, 9.64365076099295, 
9, 8.54400374531753, 8.54400374531753, 9.64365076099295, 8.71779788708135, 
8.71779788708135, 8.71779788708135, 8.71779788708135, 8.71779788708135, 
8.71779788708135, 8.71779788708135, 10.9544511501033, 9, 9, 9, 
6.48074069840786, 6.48074069840786, 6.48074069840786, 8.83176086632785, 
10.4403065089106, 8.83176086632785, 6.6332495807108, 7.93725393319377, 
10.6301458127346, 7.93725393319377, 7.93725393319377, 9.69535971483266, 
9.69535971483266, 9.69535971483266, 9.69535971483266, 7.74596669241483, 
8.36660026534076, 8.83176086632785, 8.30662386291807, 8.36660026534076, 
7.87400787401181, 8.77496438739212, 8.77496438739212, 8.77496438739212, 
7.68114574786861, 8.94427190999916, 13.7840487520902, 12.328828005938, 
10.9544511501033, 14.8323969741913, 14.8323969741913, 14.8323969741913, 
14.8323969741913, 14.8323969741913, 14.8323969741913, 14.142135623731, 
14.142135623731, 14.7648230602334, 12.1655250605964, 12.1655250605964, 
14.7648230602334, 14.7648230602334, 15.4919333848297, 14.142135623731, 
16.2788205960997, 16.2788205960997, 11.4017542509914, 8.06225774829855, 
8.06225774829855, 8.94427190999916, 11.4017542509914, 11.4017542509914, 
8.66025403784439, 8.66025403784439, 8.94427190999916, 11.8321595661992, 
13.4164078649987, 11.8321595661992, 17.8885438199983, 17.8885438199983, 
17.8885438199983, 10.4880884817015, 10.4880884817015, 15, 19.8746069143518, 
8.94427190999916, 8.94427190999916, 15.6524758424985, 10.4880884817015, 
10.9544511501033, 8.94427190999916, 9.21954445729289, 10, 17.3205080756888, 
17.8885438199983, 17.8885438199983, 17.3205080756888, 17.8885438199983, 
17.8885438199983, 17.8885438199983, 17.8885438199983, 16.1245154965971, 
16.1245154965971, 17.8885438199983, 17.8885438199983, 17.8885438199983, 
15.9687194226713, 15.1657508881031, 16.1245154965971, 13.6014705087354, 
15.4919333848297, 14.6628782986152, 14.6628782986152, 15.4919333848297, 
8.94427190999916, 9.48683298050514, 15.4919333848297, 9.48683298050514, 
9.48683298050514, 9.48683298050514, 14.142135623731, 12.8452325786651, 
12.1243556529821, 19.8746069143518, 19.8746069143518, 19.8746069143518, 
19.8746069143518, 19.8746069143518, 19.8746069143518, 19.8746069143518, 
18.0277563773199, 18.0277563773199, 14.8323969741913, 17.8885438199983, 
18.0277563773199, 18.0277563773199, 14.0712472794703, 13.7840487520902, 
11.4017542509914, 11.1803398874989, 16.2788205960997, 15.6524758424985, 
10, 10.9544511501033, 17.8885438199983, 16.1245154965971, 16.1245154965971, 
10, 8.36660026534076, 8.36660026534076, 8.94427190999916, 13.9642400437689, 
12.5698050899765, 12.5698050899765, 17.1755640373177, 14.142135623731, 
13.4164078649987, 14.8323969741913, 14.4913767461894, 18.1659021245849, 
17.8885438199983, 17.8885438199983, 14.7648230602334, 15.2643375224737, 
16.583123951777, 16.583123951777, 16.583123951777, 16.583123951777, 
16.583123951777, 16.583123951777, 16.583123951777, 15.1657508881031, 
16.1245154965971, 16.431676725155, 16.431676725155, 16.431676725155, 
18.1383571472171, 18.1383571472171, 15.4919333848297, 15.9373774505092, 
15.9373774505092, 15.9373774505092, 15.9373774505092, 15.9373774505092, 
15.9373774505092, 15.9373774505092, 15.1657508881031, 16.1245154965971, 
16.1245154965971, 16.1245154965971, 16.1245154965971, 8.48528137423857, 
15.3297097167559, 20.1246117974981, 16.5227116418583, 17.058722109232, 
20.7364413533277, 16.431676725155, 16.1245154965971, 7.93725393319377, 
13.5277492584687, 8.06225774829855, 8.06225774829855, 19.2353840616713, 
7.41619848709566, 9.48683298050514, 9.48683298050514, 9.79795897113271, 
18.8148877222268, 18.8148877222268, 10.1488915650922, 8.54400374531753, 
13.1529464379659, 13.1529464379659, 13.1529464379659, 13.1529464379659, 
13.1529464379659, 13.1529464379659, 13.1529464379659, 13.1529464379659, 
13.1529464379659, 15.4919333848297, 15.4919333848297, 20.1246117974981, 
6.2449979983984, 18.9736659610103, 18.9736659610103, 18.9736659610103, 
16.7630546142402, 16.7630546142402, 16.7630546142402, 16.7630546142402, 
16.7630546142402, 16.7630546142402, 19.4935886896179, 16.7630546142402, 
20.2484567313166, 20.2484567313166, 20.2484567313166, 11.916375287813, 
11.916375287813, 11.6189500386223, 11.0905365064094, 11.0905365064094, 
11.0905365064094, 11.0905365064094, 10, 10, 15.8113883008419, 
15.8113883008419, 15.8113883008419, 15.8113883008419, 8.94427190999916, 
8.66025403784439, 8.36660026534076, 21.5638586528478, 17.6635217326557, 
15.2315462117278, 15.2315462117278, 15.2315462117278, 14.0712472794703, 
14.0712472794703, 14.422205101856, 14.0356688476182, 17.2626765016321, 
17.2626765016321, 17.2626765016321, 8.94427190999916, 15.8113883008419, 
15.8113883008419, 14.4913767461894, 13.7840487520902, 14.8323969741913, 
14.8323969741913, 10.5356537528527, 17.6635217326557, 16.0312195418814, 
16.9705627484771, 14.0712472794703, 14.0712472794703, 14.0712472794703, 
14.0712472794703, 14.0712472794703, 14.0712472794703, 10.1980390271856, 
19.3649167310371, 19.3649167310371, 19.3649167310371, 16.2788205960997, 
14.422205101856, 16.2788205960997, 12.8840987267251, 19, 15.1327459504216, 
14.7648230602334, 14.7648230602334, 14.4913767461894, 14.4913767461894, 
13.4164078649987, 17.8885438199983, 15.1657508881031, 18.1659021245849, 
18.1383571472171, 18.1383571472171, 18.9208879284245, 13.5646599662505, 
14.6969384566991, 13.4536240470737, 12.8840987267251, 19.94993734326, 
19.94993734326, 13.5277492584687, 13.5277492584687, 13.5277492584687, 
13.5277492584687, 13.5277492584687, 18.6547581061776, 16.2788205960997, 
14.422205101856, 17.058722109232, 14.6969384566991, 15.3297097167559, 
15, 19.313207915828, 19.313207915828, 15.1657508881031, 16.1245154965971, 
15.1657508881031, 15.1657508881031, 15.1657508881031, 7.54983443527075, 
7.87400787401181, 17.8885438199983, 14.7648230602334, 15.3948043183407, 
15, 15, 15, 15, 15, 15, 15, 19.2093727122985, 19.2093727122985, 
19.2093727122985, 10, 10, 13.9283882771841, 14.4913767461894, 
15.6204993518133, 15.8429795177549, 15.6204993518133, 14.6969384566991, 
15.8113883008419, 16.431676725155, 15.1657508881031, 16.1245154965971, 
14.8323969741913, 16.1245154965971, 17.2336879396141, 17.2336879396141
)), class = "data.frame", row.names = c(NA, -820L))

CodePudding user response:

It is plotting everything at 0 because the variance term is exactly zero.

summary(mod1)
Generalized linear mixed model fit by maximum likelihood (Adaptive
  Gauss-Hermite Quadrature, nAGQ = 0) [glmerMod]
 Family: binomial  ( logit )
Formula: resp ~ var1   (var1 || group1)   (1 | group2)
   Data: testdata
Control: 
glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e 06))

     AIC      BIC   logLik deviance df.resid 
  1110.4   1133.9   -550.2   1100.4      815 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.8083 -0.9033 -0.5787  0.9235  1.7280 

Random effects:
 Groups   Name        Variance Std.Dev.
 group2   (Intercept) 0.2059   0.4538  
 group1   var1        0.0000   0.0000  
 group1.1 (Intercept) 0.1071   0.3272  
Number of obs: 820, groups:  group2, 74; group1, 7

Fixed effects:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  1.08061    0.35577   3.037 0.002386 ** 
var1        -0.08115    0.02308  -3.516 0.000438 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
     (Intr)
var1 -0.900

I'm not sure why the singular fit warning is not showing up automatically, but when I fit the model and run the following we see that it is one, and the model has not been able to estimate the random slope:

isSingular(mod1)
[1] TRUE

I would recommend looking at the different approaches to dealing with the singularity here: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#singular-models-random-effect-variances-estimated-as-zero-or-correlations-estimated-as---1

  • Related