Model failed to converge (lme4)

1.3k views Asked by At

I would like to achieve the following task. Using a linear mixed model, I would like to check whether "Month" (see dat table) has a significant effect on the "Response" variable. As for some of the tanks, data comes from different months, I included it as a random factor in my model. Please note, that sampling the same tank in different months does not change the "Response" variable. For some tank-month combinations there are multiple records, as we are included the compartment of the tank that was sampled (e.g. NW =north west).

Here the data:

    print(dat)
     Tank Month               ID   Response
1    AEW1   Jul AEW01SOBFJul2008 1.80522937
2   AEW10   Jul AEW10NWBFJul2008 2.13374401
3   AEW10   Jul AEW10NWBFJul2008 2.13374401
4   AEW11   Jun AEW11SWBFJun2008 1.65010205
5   AEW14   Jun AEW14SWBFJun2008 1.75459326
6   AEW15   Jun AEW15SOBFJun2008 2.82200903
7   AEW15   Jun AEW15SOBFJun2008 2.82200903
8   AEW18   Jul AEW18SOBFJul2008 0.39349330
9   AEW19   Jul AEW19NWBFJul2008 0.65886661
10  AEW20   Jul AEW20NWBFJul2008 1.07838018
11  AEW24   Jun AEW24NOBFJun2008 2.56677635
12  AEW27   Jul AEW27SWBFJul2008 2.64019328
13  AEW27   Jul AEW27SWBFJul2008 2.64019328
14  AEW29   Jul AEW29SOBFJul2008 2.06251217
15  AEW30   Jul AEW30NWBFJul2008 1.17010646
16  AEW31   Jun AEW31SWBFJun2008 2.25518873
17  AEW32   Jun AEW32SOBFJun2008 2.38707614
18  AEW33   Jun AEW33SOBFJun2008 2.30498448
19  AEW33   Jun AEW33SOBFJun2008 2.30498448
20  AEW36   Jul AEW36NOBFJul2008 1.92368247
21  AEW37   Jun AEW37NOBFJun2008 0.99387013
22  AEW39   Jul AEW39NOBFJul2008 1.24163732
23   AEW4   Jul AEW04SWBFJul2008 1.56327732
24  AEW42   Jun AEW42SWBFJun2008 1.26012579
25  AEW44   Jun AEW44SWBFJun2008 0.75985267
26  AEW48   Aug AEW48SOBFAug2008 1.57920494
27  AEW50   Jul AEW50NOBFJul2008 0.90052629
28   AEW8   Jul AEW08NOBFJul2008 0.00000000
29   AEW8   Jul AEW08NOBFJul2008 0.00000000
30   AEW9   Jul AEW09NOBFJul2008 0.48529647
31  HEW10   Jun HEW10SWBFJun2008 0.06412823
32  HEW10   Aug HEW10SOBFAug2008 0.06412823
33  HEW12   Jul HEW12NOBFJul2008 0.00000000
34  HEW13   Aug HEW13NWBFAug2008 2.24515850
35  HEW13   Jul HEW13SOBFJul2008 2.24515850
36  HEW13   Jul HEW13NOBFJul2008 2.24515850
37  HEW13   Jun HEW13SOBFJun2008 2.24515850
38  HEW13   Jun HEW13NWBFJun2008 2.24515850
39  HEW14   Jul HEW14SOBFJul2008 1.64783184
40  HEW18   Jun HEW18NWBFJun2008 1.32435721
41  HEW18   Jun HEW18NWBFJun2008 1.32435721
42  HEW19   Jul HEW19SWBFJul2008 1.01761003
43  HEW19   Jul HEW19SWBFJul2008 1.01761003
44  HEW22   Aug HEW22SWBFAug2008 0.63861037
45  HEW23   Jun HEW23SWBFJun2008 1.38472769
46  HEW23   Jun HEW23NWBFJun2008 1.38472769
47  HEW28   Jun HEW28NOBFJun2008 1.44377199
48   HEW3   Jun HEW03SWBFJun2008 2.19793633
49   HEW3   Jul HEW03SWBFJul2008 2.19793633
50  HEW30   Aug HEW30NWBFAug2008 0.76260579
51  HEW31   Jul HEW31SWBFJul2008 1.07879539
52  HEW35   Jun HEW35NWBFJun2008 0.86098152
53  HEW35   Jun HEW35NWBFJun2008 0.86098152
54  HEW36   Aug HEW36SOBFAug2008 0.36533352
55  HEW39   Jun HEW39SOBFJun2008 0.09283168
56   HEW4   Jun HEW04SWBFJun2008 1.89046783
57  HEW41   Aug HEW41NWBFAug2008 0.31996275
58  HEW41   Aug HEW41NWBFAug2008 0.31996275
59  HEW41   Jul HEW41NWBFJul2008 0.31996275
60  HEW41   Jul HEW41NWBFJul2008 0.31996275
61  HEW42   Jul HEW42NWBFJul2008 0.53998250
62  HEW43   Jun HEW43SWBFJun2008 1.85594061
63  HEW43   Jun HEW43SWBFJun2008 1.85594061
64  HEW44   Jun HEW44SOBFJun2008 1.79972095
65  HEW44   Jun HEW44SOBFJun2008 1.79972095
66  HEW49   Jun HEW49SWBFJun2008 1.25229249
67   HEW5   Aug HEW05SWBFAug2008 0.95559764
68  HEW50   Jun HEW50NWBFJun2008 0.42309531
69  HEW50   Jun HEW50NWBFJun2008 0.42309531
70   HEW7   Jul HEW07NWBFJul2008 0.69484213
71   HEW7   Jun HEW07NWBFJun2008 0.69484213
72   HEW8   Jul HEW08SWBFJul2008 1.15617440
73   SEW1   Aug SEW01NWBFAug2008 1.90030109
74   SEW1   Sep SEW01SWBFSep2008 1.90030109
75  SEW11   Aug SEW11NWBFAug2008 2.11940912
76  SEW12   Aug SEW12SOBFAug2008 2.29658624
77  SEW12   Jul SEW12SOBFJul2008 2.29658624
78  SEW17   Aug SEW17NOBFAug2008 1.49277937
79  SEW17   Jul SEW17NOBFJul2008 1.49277937
80  SEW17   Sep SEW17NOBFSep2008 1.49277937
81  SEW17   Aug SEW17SOBFAug2008 1.49277937
82  SEW18   Aug SEW18SOBFAug2008 1.70247509
83  SEW19   Aug SEW19SOBFAug2008 2.11617036
84  SEW20   Jul SEW20SWBFJul2008 1.87718089
85  SEW20   Jul SEW20SOBFJul2008 1.87718089
86  SEW22   Aug SEW22NOBFAug2008 0.77473833
87  SEW23   Aug SEW23NWBFAug2008 0.96183454
88  SEW23   Aug SEW23NOBFAug2008 0.96183454
89  SEW24   Jul SEW24SWBFJul2008 0.64090368
90  SEW24   Jul SEW24NWBFJul2008 0.64090368
91  SEW29   Jul SEW29SOBFJul2008 1.54699664
92  SEW29   Aug SEW29SWBFAug2008 1.54699664
93  SEW29   Aug SEW29SOBFAug2008 1.54699664
94  SEW34   Aug SEW34NWBFAug2008 1.79425003
95  SEW36   Jul SEW36SOBFJul2008 1.20337761
96   SEW4   Aug SEW04SWBFAug2008 1.59611963
97  SEW40   Sep SEW40SOBFSep2008 1.36486039
98  SEW40   Aug SEW40SWBFAug2008 1.36486039
99  SEW43   Sep SEW43SOBFSep2008 1.03169382
100 SEW44   Aug SEW44SWBFAug2008 0.79705660
101 SEW45   Jul SEW45NWBFJul2008 0.34130398
102 SEW46   Aug SEW46SOBFAug2008 0.20690386
103 SEW47   Aug SEW47SWBFAug2008 0.01564703
104 SEW47   Sep SEW47SWBFSep2008 0.01564703
105 SEW48   Aug SEW48SWBFAug2008 0.46745254
106  SEW5   Aug SEW05SWBFAug2008 0.68900435
107 SEW50   Aug SEW50NWBFAug2008 1.10731406
108  SEW7   Aug SEW07SWBFAug2008 0.08552432
109  SEW8   Jul SEW08NWBFJul2008 0.18731374

The model I generated so far is: Mod1 <- lmer(Response ~ Month + (1|Tank), data=dat)

Again, I included "Tank" because we sampled some tanks in several months but that does not change the response variable. Consequently, the response variable is fixed for each tank. Nevertheless, multiple data points originate from the same tank and I tried to account for that by including it as a random factor.

Fitting Mod1 results in the following message:

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.306567 (tol = 0.002, component 1)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?

The question is now, whether the model is overly complex and whether I can drop "Tank" as a random factor, as measuring tanks repeatedly did not have an effect on the response variable.

Thus, the question is, would a simple linear model Mod1 <- lm(Response ~ Month, data =dat) be valid? And if not, how can I solve the 2 convergence issues.

Any help is very much appreciated! :)

0

There are 0 answers