I am trying to fit a GLMM for binary data of whether colonies of bees perform mass flight or not. I have time when the mass flight was performed, temperature, location of the hive and species of the bee as fixed effects and Hive ID as random effect. I had a total of 8 hives, two of each species at each location.
'data.frame': 2182 obs. of 7 variables:
$ Temp : num 29 29.1 29.8 29 29 29.1 29 30 30 28.3 ...
$ Zenith_angle: num 74.9 86.9 59.4 76 76 ...
$ Mass_flight : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
$ Hive : Factor w/ 8 levels "JC1","JC2","JM1",..: 6 5 6 7 8 7 6 6 7 5 ...
$ Site : Factor w/ 2 levels "Jammu","Trivandrum": 2 2 2 2 2 2 2 2 2 2 ...
$ Species : Factor w/ 2 levels "Apis cerana",..: 1 1 1 2 2 2 1 1 2 1 ...
$ Time : 'times' num 16:50:00 17:40:00 15:45:00 16:35:00 16:54:00 ...
..- attr(*, "format")= chr "h:m:s"
- attr(*, "na.action")= 'omit' Named int 7 22 23 30 69 378 379 380 381 382 ...
..- attr(*, "names")= chr "7" "22" "23" "30" ...
But it is showing an error of singular fit. How do I correct it?
m4 <- glmer(Mass_flight ~ Time + Temp*Site + Species + (1|Hive), data=data, family = binomial)
Family: binomial ( logit )
Formula: Mass_flight ~ Time + Temp * Site + Species + (1 | Hive)
Data: data
AIC BIC logLik deviance df.resid
837.8 877.6 -411.9 823.8 2175
Scaled residuals:
Min 1Q Median 3Q Max
-0.5508 -0.2874 -0.1804 -0.1084 9.4977
Random effects:
Groups Name Variance Std.Dev.
Hive (Intercept) 2.012e-14 1.419e-07
Number of obs: 2182, groups: Hive, 8
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -11.64885 1.46926 -7.928 2.22e-15 ***
Time 8.30280 1.16666 7.117 1.11e-12 ***
Temp 0.16538 0.04572 3.617 0.000298 ***
SiteTrivandrum 6.43244 2.79463 2.302 0.021351 *
SpeciesApis mellifera -0.47795 0.21000 -2.276 0.022849 *
Temp:SiteTrivandrum -0.25244 0.09400 -2.685 0.007243 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) Time Temp StTrvn SpcsAm
Time -0.569
Temp -0.868 0.110
SiteTrvndrm -0.230 -0.229 0.408
SpcsApsmllf 0.152 -0.058 -0.266 -0.088
Tmp:StTrvnd 0.283 0.193 -0.461 -0.995 0.123
convergence code: 0
boundary (singular) fit: see ?isSingular