[R-sig-ME] Working formula for glmm model in R (bernoulli response)
m|ch@e|_rom@nov @end|ng |rom |nbox@ru
Thu Mar 19 14:14:35 CET 2020
Sorry for the silly question, but I got stuck on it.
My dataset is occupancy of eagle territories in different years (see the example below). I’m trying to test my data for time trend, taking into account territory quality (as a random effect).
territory year occupied
CHV-1 2006 0
CHV-12 2006 0
CHV-120 2006 1
CHV-13 2009 0
CHV-14 2009 1
CHV-15 2010 1
CHV-16 2010 1
My thoughts are following. ‘year’ is a fixed effect variable and ‘territory’ is a random effect variable. For example, in lme4 package the formula could be following: occupied = year + (1|territory). However, lme4 doesn’t support Bernoulli family, so I chose glmm package. According to its specifications, the glmm function accepts two different formulae, separately for fixed and random effects:
glmm(fixed, random, varcomps.names, data, family.glmm, m, varcomps.equal, doPQL = TRUE,debug=FALSE, p1=1/3,p2=1/3, p3=1/3, rmax=1000,iterlim=1000, par.init, zeta=5, cluster=NULL)
So now I need two different formulae. I tried ‘occupied ~ year’, ‘occupied ~ territory’, but it doesn’t work. Namely, the RStudio gets into an infinite loop and doesn’t produce any output.
Can anyone help me to write a working formula (or formulae) to properly run the glmm model?
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models