Skip to content

Enc: error: model is nearly unidentifiable

2 messages · Ligia Pizzatto do Prado, David Duffy

#
Dear John, thanks for your reply.


I tried to simplify my variables names when posted (originally named Fchoice and changed to choice), so Fchoice was just a typo in the formula when posting, it was all the same in the model thou...


I doubled checked the data and it is correct, 24 0s and 42 1s for my response variable. it is a coincidence. 6 frogs chose 1 in both trials, 6 chose 0 and 12 chose had 0 and 1 in each trial. So, no choice don't seem invariant within frogs, but I now pasted the dataset bellow.


Lets try again...


The experiment is a two choice habitat ("Fchoice": poor [0] vs rich [1]) for frogs under two-state treatments, lets say F and C. Then I have as potential variables frog size ("SUL"), air temperature ("temp"), humidity ("hum") and date of experiment ("dateCont" recorded as continuos variable starting at day 1...). This is a repeated measure design as frogs were tested both in F and C trials (thus id is my random effect). I want to know if the choice is affected by treat, but also considering SUL, temp, humidity, and date in my model.

##Dataset:

newdata
   treat id Fchoice  SUL temp hum dateCont
1      F  1       1 42.5 27.0  53        1
2      F  2       0 36.5 27.0  53        1
3      F  3       0 38.1 27.0  53        1
4      F  4       0 46.4 27.0  53        1
5      C  5       1 35.7 27.3  63        2
6      C  6       1 41.6 27.3  63        2
7      C  7       0 45.4 27.3  63        2
8      C  8       1 43.6 27.3  63        2
9      C  1       1 42.5 27.5  64        3
10     C  3       0 38.1 27.5  64        3
11     C  4       1 46.4 27.5  64        3
12     F  5       1 35.7 27.4  59        4
13     F  6       1 41.6 27.4  59        4
14     F  7       1 45.4 27.4  59        4
15     F  8       0 43.6 27.4  59        4
16     C  2       0 36.5 27.9  60        5
17     C  9       1 46.0 27.9  60        5
18     C 10       1 38.0 27.9  60        5
19     C 11       0 46.9 27.9  60        5
20     F 10       1 38.0 27.4  63        8
21     F 11       0 46.9 27.4  63        8
22     F 12       1 37.6 27.4  63        8
23     F  9       0 46.0 26.3  76        9
24     C 13       1 38.3 25.1  75        9
25     C 14       0 47.3 25.1  75        9
26     C 15       1 37.6 25.1  75        9
27     C 12       0 37.6 25.1  75       11
28     F 13       0 38.3 26.3  76       11
29     F 14       0 47.3 26.3  76       11
30     F 15       0 37.6 26.3  76       11
31     C 16       1 38.9 26.3  55       15
32     C 17       0 38.9 26.3  55       15
33     C 18       0 42.3 26.3  55       15
34     F 20       0 51.0 26.3  59       16
35     F 21       0 43.5 26.3  59       16
36     F 22       1 43.5 26.3  59       16
37     F 16       0 38.9 27.6  57       19
38     F 17       1 38.9 27.6  57       19
39     F 18       0 42.3 27.6  57       19
40     C 20       0 51.0 27.3  75       22
41     C 21       1 43.5 27.3  75       22
42     C 22       1 43.5 27.3  75       22
43     C 23       1 41.6 27.3  75       22
44     F 23       0 41.6 25.1  69       23
45     F 24       1 43.9 25.1  69       23
46     F 25       0 43.5 25.1  69       23
47     C 24       1 43.9 24.8  55       24
48     C 25       1 43.5 24.8  55       24

summary(newdata)
 treat        id     Fchoice      SUL             temp            hum
 C:24   1      : 2   0:24    Min.   :35.70   Min.   :24.80   Min.   :53.00
 F:24   2      : 2   1:24    1st Qu.:38.25   1st Qu.:26.30   1st Qu.:58.50
        3      : 2           Median :42.40   Median :27.30   Median :63.00
        4      : 2           Mean   :42.02   Mean   :26.74   Mean   :63.65
        5      : 2           3rd Qu.:44.27   3rd Qu.:27.40   3rd Qu.:70.50
        6      : 2           Max.   :51.00   Max.   :27.90   Max.   :76.00
        (Other):36
    dateCont
 Min.   : 1.00
 1st Qu.: 4.00
 Median : 9.00
 Mean   :10.75
 3rd Qu.:16.75
 Max.   :24.00

## The models:
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?

m2<- glmer(Fchoice ~ treat + SUL + temp + dateCont + (1|id), data = data, family = binomial)
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?

I can see that dateCont and temp are significantly correlated, but dateCont and hum are not.

I'm using R 3.3.3 GUI 1.69 Mavericks build (7328). Is this enough info to reproduce, John?

Cheers,

Ligia
#
Should date rather be a factor? That would make the model even harder to fit, as you would
have too few data for the number of coefficients to be estimated.

Since you have exactly 2 obs per ID, then a generalized estimating equation should be pretty close,
and tends to be a bit more stable.  We can also check comparing the
glmmML fit - it is set up only for a simple RE model like yours, but the fitter often does a better job for those.

library(gee)
summary(gee(Fchoice ~ treat + SUL + temp + hum + dateCont, id=id, data=x,
                         corstr="exchangeable", family="binomial"))
library(glmmML)
summary(glmmML(Fchoice ~ treat + SUL + temp + hum + dateCont, cluster=id, data=x, family="binomial"))

               GEE (exchangeable r=0.08)         glmmML                   glmer
               Estimate Robust S.E.    Robust z     coef se(coef)       z Estimate Std. Error z value 
(Intercept) -0.88719918 10.40645085 -0.08525473 -1.13855 11.88440 -0.0958 -1.14557   11.89332  -0.096 
treatF      -1.15044245  0.64272611 -1.78994198 -1.21411  0.70458 -1.7232 -1.21572    0.70451  -1.726 
SUL         -0.10705958  0.07911966 -1.35313499 -0.11373  0.09252 -1.2293 -0.11384    0.09255  -1.230 
temp         0.25765994  0.35199301  0.73200300  0.28526  0.41123  0.6937  0.28591    0.41136   0.695 
hum         -0.01921368  0.03913854 -0.49091468 -0.02243  0.04662 -0.4812 -0.02252    0.04665  -0.483 
dateCont     0.02696366  0.04181628  0.64481255  0.02962  0.05015  0.5905  0.02965    0.05020   0.591 

Looks like glmer has found a solution close to that accepted by the other approaches. To me, suggests that glmer has worked OK.