[R-sig-ME] fitting glmm under lme4 and Gauss Hermite integration

Ben Bolker bbolker at gmail.com
Sun Oct 31 18:06:26 CET 2010


PS it looks like the coefficients are quite stable under increasing
numbers of quadrature points ...


x=factor(rep(1:6,each=2))
y=c(14, 18, 10, 47, 13, 24, 10, 12,  1,  0,  6,  6)
adjust=c(5.505332,5.645447, 5.549076, 5.886104, 6.023448,
  6.177944, 6.077642, 6.186209, 5.030438, 5.117994, 5.170484, 5.493061)
eu=factor(1:12)
try=data.frame(x,y,eu,adjust)

library(lme4)
fit <- glmer(y ~ x + (1 | eu) + offset(log(adjust)),
              family = poisson, data =try)

nagqvec <- 1:20
fitlist1 <- lapply(nagqvec,
                   glmer,
                   formula=y ~ x + (1 | eu) + offset(log(adjust)),
                   family=poisson,
                   data=try,
                   start=NULL,
                   verbose=FALSE)

t(sapply(fitlist1,fixef))


On 10-10-30 01:07 PM, Jie Li wrote:
> Dear colleagues,
> 
> Happy Halloween.
> 
> When I try fitting glmm under lme4 using the following code:
> 
> x=as.factor(rep(c("1","2","3", "4", "5", "6"),each=2))
> y=c(14, 18, 10, 47, 13, 24, 10, 12,  1,  0,  6,  6)
> offset=c(5.505332,5.645447, 5.549076, 5.886104, 6.023448, 6.177944, 6.077642, 
> 6.186209,
> 5.030438, 5.117994, 5.170484, 5.493061)
> eu=gl(12,1)
> try=data.frame(x,y,eu,offset)
> fit <- glmer(y ~ x + (1 | eu) + offset(log(adjust)),
>               family = poisson, data =try)
> 
> 
> A message pops up, saying "Number of levels of a grouping factor for the random 
> effects
> is *equal* to n, the number of observations". 
> 
> 
> Question1: can I still use the fit statistics? (Should the levels be less than 
> the number of observations? But I can't help it. My data are like that)
> 
> Question2:
> 
> 
> When running the glmm function under the repeated package written by James 
> Lindsey, I encountered the problem of trying to decide on the value of points, 
> ie. Gauss Hermite integration numbers. Different points resulted in quite 
> different fit statistics. Here is my code:
> 
> 
> fit2<-glmm(y~x, family=poisson, offset=offset, nest=gl(12,1),points=4,data=try)
> 
> Is it true that the more points, the better? A book says points=20 entails 
> decent approximation, but there’s an error msg when I increased my point number 
> to 10. It says “Product of probabilities is too small to calculate.” May I seek 
> your advice on this issue (what point should I be using)? Are there good 
> references you would recommend so that I can understand better understand Gauss 
> Hermite integration? BTW, glmer under lme4 uses adapted Gauss-Hermite 
> integration too.
> 
> 
> Thanks so much. Bon week-end. -- jie
>  
>  Jie Li
> Department of Statistics
> 1219 Snedecor Hall
> Iowa State University
> Ames, IA 50010
> lij at iastate.edu
> (515) 294-5790
> 
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> 
> 
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




More information about the R-sig-mixed-models mailing list