[R-sig-eco] Problem with glmm with nested random effects
Drew Tyre
atyre2 at unl.edu
Tue Oct 27 19:07:43 CET 2015
Juan -- did you try just:
glmer(cbind(A,round(B)) ~ C + D + E + (1 |F/G), data=mydata, family=binomial)
all of which should be interpreted in the context of mydata. If that doesn't work with a similar error, double check that mydata has the factor G in it.
--
Drew Tyre
School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974
phone: +1 402 472 4054
fax: +1 402 472 2946
email: atyre2 at unl.edu
http://snr.unl.edu/tyre
http://aminpractice.blogspot.com
http://www.flickr.com/photos/atiretoo
-----Original Message-----
From: R-sig-ecology [mailto:r-sig-ecology-bounces at r-project.org] On Behalf Of Juan
Sent: Tuesday, October 27, 2015 1:02 PM
To: r-sig-ecology at r-project.org
Subject: [R-sig-eco] Problem with glmm with nested random effects
Hi
everyone. I am trying to run a glmm using the glmer function of the lme4 package but I keep getting this error:
Error: couldn't evaluate grouping factor G:(mydata:`$`) within model frame: try adding grouping factor to data frame explicitly if possible
In addition: Warning message:
In mydata:`$` :
numericalexpression has 16 elements:
only the first used
The model is:
glmer(cbind(mydata$A,round(mydata$B)) ~ mydata$C + mydata$D
+ mydata$E + (1 |mydata$F/G), data=mydata, family=binomial)
As you can see the problem apparently is caused by the random effect term, which has a nested structure, as the model ran smoothly without random effects. I ve also tried including the random factors separately and it worked ok.
How should I proceed in order to solve this error?
The data used (mydata) is a data frame composed of 361 rows and several columns with the following data:
- A - numeric (number of successes)
- B - numeric (number of failures)
-
C - integer
-
D - factor
-
E - numeric
- F - factor(alphanumeric values)
- G - factor(numeric values)
[[alternative HTML version deleted]]
More information about the R-sig-ecology
mailing list