[R-sig-ME] Enc: error: model is nearly unidentifiable
Ligia Pizzatto do Prado
ligia_oceanica at hotmail.com
Tue Apr 17 03:14:35 CEST 2018
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:
>m1<- glmer(Fchoice ~ treat + SUL + temp + hum + dateCont + (1|id), data = newdata, family = binomial)
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?
> null<- glmer(Fchoice ~ 1 + (1|id), data = newdata, family = binomial)
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?
> m3<- glmer(Fchoice ~ treat + SUL + dateCont + (1|id), data = data, family = binomial)
> m4<- glmer(Fchoice ~ treat + SUL + temp + (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?
> m5<- glmer(Fchoice ~ treat + SUL + (1|id), data = data, family = binomial)
> m6<- glmer(Fchoice ~ treat + (1|id), data = data, family = binomial)
> m7<- glmer(Fchoice ~ treat + SUL + hum + (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?
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
________________________________
De: Fox, John <jfox at mcmaster.ca>
Enviado: segunda-feira, 9 de abril de 2018 14:14
Para: Ligia Pizzatto do Prado
Cc: r-sig-mixed-models at r-project.org
Assunto: RE: error: model is nearly unidentifiable
Dear Ligia,
Without your data, and therefore without a reproducible example, one can only speculate about the source of the problem. I noticed, however, that your response variable (choice) has equal numbers of 0s and 1s -- 24 of each. Was that simply a coincidence? As well, the response is named "choice" in the earlier part of your message and model "null," but "Fchoice" in model "m1." Why?
More generally, the question mark in "Rescale variables?" indicates that this is a common source of numerical instability but not the only one. For example, highly collinear predictors could also produce a nearly unidentified model. What's curious is that you're observing this problem in a model with only an intercept. Perhaps, e.g., choice is invariant within frogs.
Reading the posting guide at <https://www.r-project.org/posting-guide.html> might help you to formulate your question more effectively.
R: Posting Guide: How to ask good questions that prompt ...<https://www.r-project.org/posting-guide.html>
www.r-project.org
Posting Guide: How to ask good questions that prompt useful answers. This guide is intended to help you get the most out of the R mailing lists, and to avoid embarrassment.
I hope this helps,
John
-----------------------------
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: socialsciences.mcmaster.ca/jfox/
> -----Original Message-----
> From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-project.org]
> On Behalf Of Ligia Pizzatto do Prado
> Sent: Monday, April 9, 2018 2:14 AM
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] error: model is nearly unidentifiable
>
> Hi there, I'm new to mixed models but have ran a few with success before. Now,
> while trying to analyse this new experiment I am having an error that I quite
> don't understand...
>
>
> The experiment is a two choice habitat ("choice": poor [0] vs rich [1]) for frogs
> under two-state treatments, lets say F and C. Then I have as potential variables
> frog size ("size"), air temperature ("temp"), humidity ("hum") and date of
> experiment (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 size, temp, humidity, and date in my model.
>
>
> First I did:
>
>
> data$treat<- factor(data$treat)
>
> data$id<- factor(data$id)
>
> data$choice<- factor(data$choice)
>
>
> summary(data)
>
> treat id choice
>
> C:24 1 : 2 0:24
>
> F:24 2 : 2 1:24
>
> 3 : 2
>
> 4 : 2
>
> 5 : 2
>
> 6 : 2
>
> (Other):36
>
>
>
> size temp hum date
>
> Min. :35.70 Min. :24.80 Min. :53.00 Min. : 1.00
>
> 1st Qu.:38.25 1st Qu.:26.30 1st Qu.:58.50 1st Qu.: 4.00
>
> Median :42.40 Median :27.30 Median :63.00 Median : 9.00
>
> Mean :42.02 Mean :26.74 Mean :63.65 Mean :10.75
>
> 3rd Qu.:44.27 3rd Qu.:27.40 3rd Qu.:70.50 3rd Qu.:16.75
>
> Max. :51.00 Max. :27.90 Max. :76.00 Max. :24.00
>
> m1<- glmer(Fchoice ~ treat + SUL + temp + hum + date + (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?
>
>
> I keep getting this message in all models except when I exclude both temp and
> hum, but I also get the message when tried null model: null<- glmer(choice ~ 1 +
> (1|id), data = data, family = binomial)
>
>
> I tried to transform/re-scale all continuous variable (temp, hum, date) and
> nothing changed, and I quite don't understand why the error also appears in the
> null model, given id is a factor... If its a scale problem wouldn't this only appear
> in the continuous variables?
>
>
> Can anyone provide some guidance here, please?
>
>
> TIA,
>
>
> Ligia
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list