0

I am running a set of mixed models and comparing them by AIC to select the best models but I am having singularity problems in some of them. It is clear to me from here and here among other references that singularity problems indicate that the random effects structure is too complex to be supported by the data. But, from the following models (see below), I am having singularity problems with the one named cort2 but not with the one named cort3, it seems counterintuitive that the model without interaction has overfitting problems and the one that tests the interaction does not have them. Any ideas about the reason for this problem?

library(lme4)
cort1<-lmer(CORT ~ etapa + (1|ID),dat = d_e_filter)
cort2<- blmer (CORT ~ etapa + sex + (1|ID), dat=d_e_filter, REML= FALSE)
cort3 <-lmer (CORT ~ etapa + sex + etapa*sex + (1|ID), dat=d_e_filter, 
              REML=FALSE)

In this case, is possible to work with cort1 and cort3 ignoring the cort2model? With the same data set I am exploring the same models with other response variables without overfitting problems, and they will be reported all together. Here is an example

Models:
ldf1<- LDF ~ etapa + (1 | ID)
ldf2<- LDF ~ etapa + sex + (1 | ID)
ldf3<- LDF ~ etapa + sex + sex * etapa + (1 | ID)

Would be correct to report in the same research the first case cort1 and cort2 and in the second case ldf1 ldf2 and ldf3? or would be better to go directly to the blme package for all the models instead of using the blme package?

Here is part of the data set:

   etapa   ID sex Lymph CORT Testo  LDF granulocytes lymphocytes monocytes AbSRBC il.1b
1      a 6201   m  2.00 0.53  1.54 1.65         4510        2740         0      8   530
2      a 6202   m 36.51 0.69  1.78 3.51         4153        1086        97      6   721
3      a 6203   m 35.14 0.26  1.12 5.16         6862        1331         0      6   716
4      a 6204   m 15.83 0.74  1.14 1.47         4497        2723       346      2   311
5      a 6205   m 18.73 1.81    NA 1.93         7143        3700         0      2   113
6      a 6207   m 13.91 0.65  1.34 2.27         4693        2066         0      6   115
7      a 6208   m 33.06 0.65  1.95 2.11         4060        1676       251      4    65
8      a 6209   h  0.00 3.18  0.01 0.95         4964        4326       872      3    66
9      a 6210   m  4.59 0.69  1.78 1.88         5113        2455       258      6   280
10     a 6211   m 14.25 1.09  1.46 1.96         3468        1578       190      5   118
11     a 6213   m 33.41 0.39  1.53 2.00         5896        2147       801      4   698
12     a 6214   m 41.25 0.15  0.57 2.48         9811        3860        90      9   707
13     a 6215   m 36.23 0.28  0.88 3.63         7909        2181         0      7   690
14     a 6216   m 31.63 0.57  0.22 2.08         9754        4696         0      4   613
15     a 6217   m 17.63 1.68  1.29 1.86         4148        2130       103      1    56
16     a 6218   m 13.87 0.51  2.19 2.56         4172        1424       208      4   337
17     a 6219   m 17.03 0.14  1.28 3.22         6333        1965         0      4   274
18     a 6220   m  6.45 0.64  1.63 2.04         4551        2099       128      6   594
19     a 6221   m 11.13 0.30  1.05 1.00         3430        3184       230      2   415
20     a 6222   m 35.00 0.81  0.95 4.30         4020         885        50      6   690
21     a 6223   m 18.98 0.59  1.58 1.62         3346        1832       231      3    70
22     a 6224   m 21.23 0.39  1.10 2.83         3886        1219       155      4   415
23     a 6225   m  5.31 1.75  0.30 2.73         4522        1450       205      3    78
24     a 6226   m    NA   NA    NA   NA           NA          NA        NA     NA    NA
25     a 6227   m 11.41 0.41  1.58 1.19         3533        2749       214      6   146
26     a 6228   m  0.00 0.58  1.94 2.54         4924        1767       174      6   321
27     a 6229   m  7.82 0.58  1.38 1.79         4436        2204       268      8   228
28     a 6230   m  0.00 0.45  0.64 1.39         4452        2941       267      7   615
29     a 6231   m 19.30 0.53  3.36 1.61         4452        2491       267      3   285
30     a 6232   m 36.94 0.55  1.62 2.15         4211        1210       748      4   675
31     a 6233   m 13.73 0.52  1.59 2.20         3265        1340       145      3   315
32     a 6234   m  0.00 0.82  1.30 2.62         4567        1578       162      4   623
33     a 6235   m 39.12 0.19  1.11 5.15         8503        1500       150      6   702
34     a 6236   m 11.28   NA    NA 4.54        10436        2301         0     NA    NA
35     a 6237   m 19.96 0.57  1.30 1.46         3647        2203       294      4   528
36     a 6238   m 29.29 0.36  1.21 3.10         3783        1130        90      5   728
37     a 6239   m 13.27 0.47  1.67 2.57         3135        1095       124      3   401
38     a 6240   m 18.13 0.36  1.16 1.28         3763        2796       140      4   369
39     a 6241   m 19.14   NA    NA 2.56         2663         955        84     NA    NA
40     a 6242   m 18.23 0.46  1.89 2.99         5820        1804       140      4    64
41     a 6243   m 12.47 0.58  1.51 2.17         3835        1544       222      5   123
42     a 6244   m 12.36 0.70  1.44 3.17         6562        1813       255      6   594
43     a 6245   m 26.52 0.82  1.15 1.35         3704        2454       289      5   415
44     a 6246   m 31.25 0.31  1.52 3.37         4755        1305       108      5   682
45     a 6248   m 51.29 0.83  0.68 3.09         4507         589       868      4   612
46     a 6249   m  0.00 0.42  2.28 2.07         4025        1874        69      5   598
47     a 6250   m 26.53 0.60  1.66 0.76         4067        4728       602      2    75
48     a 6274   m 46.00 0.37  0.83 2.82         4040        1247       186      6   719
49     a 7404   h    NA   NA    NA   NA           NA          NA        NA     NA    NA
50     a 7405   h 23.16 0.89  0.09 1.48         6184        3625       566      2   142
51     a 7406   h 10.63 0.65  0.11 0.80         4387        4956       554      5   440
52     a 7407   h 25.64 0.73  0.07 1.04         9139        7578      1210      3   340
MyName
  • 33
  • Why mixing blmer with lmer results? – utobi Jun 09 '23 at 06:47
  • I am thinking in change from one package to the other in all the models aplied because of this problem... even so, I don't understand why I am getting an overfitting in a simpler model and with a more complex model, the overfitting is absent. – MyName Jun 09 '23 at 11:44

1 Answers1

1

First, it's useful to point out that the problem you're encountering is that the models have "singular fit", which isn't exactly the same thing as "overfitting" - see here for details. Overfitting is one reason singular fit might occur, but there are others.

In your case, I think the most likely problem is that introducing an interaction term changes the meaning of your intercept, and the maximum-likelihood solution has zero variance in the interpretation for the intercept definition for model 2, but non-zero variance for model 3. Centring your predictors often resolves these issues.

And no, AFAIK you can't compare models fit with lmer and blmer.

Eoin
  • 8,997
  • Thank you for the answer, I will try this suggestion. Even so, the idea was to change the package, not to mix them. I edited the question again to clarify this point that seems to be confusing. Hopefully, now is more clear. – MyName Jun 09 '23 at 13:33