[R-sig-ME] fitting glmm under lme4 and Gauss Hermite integration
bbolker at gmail.com
Sun Oct 31 17:45:09 CET 2010
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,
> 5.030438, 5.117994, 5.170484, 5.493061)
> 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
> 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)
In principle, yes.
1. You're essentially using the random effects here to account for
individual-level variance (i.e. a lognormal-Poisson model), rather than
accounting for grouping/correlation.
2. This is a very small dataset. In particular, fitting k=6
fixed-effect parameters to n=12 data points means that you will be
far from reliable asymptotic rules of thumb (we would generally
prefer n/k >= 10 ...). I would strongly recommend bootstrapped
confidence intervals, or some other reasonably robust small-sample
procedure (permutation test, parametric bootstrap ...)
> 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.
glmer uses the Laplace approximation (aGH with 1 quadrature point)
unless you set nAGQ>1. I might recommend [Jiang, Jiming. 2007. Linear
and generalized linear mixed models and their applications. Springer].
<http://lme4.r-forge.r-project.org/book/Ch5.pdf> is Bates's draft of his
new book, but it only goes as far as defining the Laplace approximation.
If you already have "a book" that talks about GH, does it give any more
I would suggest comparing the results of glmer() and glmm() for
different numbers of quadrature points; see if the two packages give
similar estimates, and see whether the estimates seem to be behaving
reasonably/converging to something sensible as you increase the number
of quadrature points. (For "extra credit" :-) or if this is really
important you could also try comparing the results with the glmmML package.)
More information about the R-sig-mixed-models