Bootstrapping glmer random effects
On Fri, 15 Jun 2012, Joe King wrote:
Dear all
I am attempting to obtain a bootstrap confidence interval for the random
effect in a simple (random intercept) model using glmer.
The problem I have is that the interval I obtain consistently does not
contain the value I am trying to get an interval for !
There are no missing data. This is the code I have used to obtain the interval:
for (i in 1:k) {
sam <- dt[sample(nrow(dt), replace=T, size=nrow(dt)), ]
m1<- glmer(wg~(1|city), data=sam, family=binomial)
bs[i] <- VarCorr(m1)$city[1]
}
quantile(bs,c(0.025,0.975))
Could anyone suggest why this is happening, and what I might be able to do about it ?
Have a look at how it is done by glmmML's glmmboot (or by merboot). Your resampling has to correctly mimic the mechanism by which your data are generated. I liked Shao J, Tu D (1995): The jackknife and bootstrap.