[R-sig-ME] recover simulated individual-level random effects with glmer?

Ian Carroll itc2 at georgetown.edu
Mon Jun 22 17:36:53 CEST 2015


I raised this question yesterday on Cross Validated (
stats.stackexchange.com/q/158043/43122), but now realize this might be the
more appropriate forum for help. Please excuse the cross-post if you track
both.

I simulated count data with an observation level random effect, then fit a
Poisson-family GLMM using glmer (lme4 version 1.1-7). The fitted random
intercepts show a strange pattern when compared to the simulated data, and
produce a kinked QQ plot. If this is expected, why is it okay? If not, what
am I doing wrong?

Simulated data and fitting:
> n <- 1000
> df <- data.frame(obs=factor(1:n))
> df$x <- rnorm(n)
> df$r <- rnorm(n, sd=3)
> df$y <- rpois(n=n, lambda=exp(2*df$x + df$r))
> glmer.fit <- glmer(y ~ x + (1|obs), family='poisson', data=df)

Questioned results:
> df$r.est <- ranef(glmer.fit)$obs[ , '(Intercept)']
> plot(df$r, df$r.est)
> qqnorm(df$r.est)

My results (posted on CV) are two overlapping clusters of points: in one r
and r.est show the expected correlation, in the other there is no
correlation. The normal QQ plot makes it look like different normal
distributions are obtained for positive and negative intercepts.

Thanks,
Ian

-- 
Ian Carroll | itc2 at georgetown.edu | 202-784-7182

	[[alternative HTML version deleted]]



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