Skip to content
Prev 5195 / 7420 Next

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)