# Linear mixed effect model with categorical variables

I have a dataframe with three columns “site” (20 different sites), “year” (three years) and “animal” (sighting: 1, no sighting: 0). All three variables are factors. A simplified version of the data looks like this:

> head(data_animal)

site    year    animal
Site_1  2003    1
Site_2  2003    0
Site_3  2003    1
Site_1  2004    1
Site_2  2004    0
Site_3  2004    0
Site_1  2005    1
Site_2  2005    1
Site_3  2005    1


I am doing a linear mixed effect model with the site as random factor to see whether the year has an effect on the sighting of the animal.

model<-glmer(animal~year+(1|site),data =data_animal, family=binomial)

I get the problem message warning: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: large eigenvalue ratio - Rescale variables?

Why should I rescale factor variables? What I am doing wrong?

• Can you try str(data_animal\$year)? If I had to guess, the year variable is currently a number rather than factor. – Heteroskedastic Jim May 9 '18 at 12:00
• no, all three variables are factors. I checked that. – Rosemarie May 14 '18 at 12:36