Working formula for glmm model in R (bernoulli response)
Most packages in R lump Bernoulli and Binomial families together, so this should work: library(lme4) glmer(occuppied ~ 1 + year + (1|territory), data=yourdata, family=binomial)
On 19/3/20 2:14 pm, Michael Romanov via R-sig-mixed-models wrote:
Dear all, ? 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? ? Thanks, ? Michael ? ? ? ? ? ? ? ? [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models