Skip to content
Prev 6713 / 7420 Next

GLMM: Should Integers be Levels of Dr. Alexandre F. Souza Prof. Associado a Factor?

Dear Alexandre,

Making those changes shouldn?t be necessary with the GLMM packages I?m familiar with (lme4 and glmmTMB). Your data looks correct as it is, assuming you will treat plot numbers, block levels,
sampling year and the ID of individual measured plants as random intercepts, e.g. the formula contains (1|plot)+(1|block) + (1|year)+(1|ID) . The package will automatically interpret the values of those variables as levels of the random effects. 

An exception is if you were to treat year as an AR(1) random effect. Then you would need to follow the example here
https://cran.r-project.org/web/packages/glmmTMB/vignettes/covstruct.html

Best,
Mollie