I am dealing with a multilevel model with gaussian error distribution that has ~21,000 observations and 5000 clusters. The model is of the simple form:
lmer(y ~ a + b + a:b + (1|z), weights=b)
and has weights applied in proportion to the variable b
.
The behavior I'm encountering occurs when calculating confidence intervals of the fixed effects parameters with the following:
confint(mod, method="Wald")
confint(mod, method="profile")
confint(mod1, method="boot", nsim=1000, parm="beta_")
The results from bootstrapping give confidence intervals that are ~3 times wider than the Wald results. The profile results throw a number of warnings such as:
1: In profile.merMod(object, which = parm, signames = oldNames, ...) : non-monotonic profile for (Intercept)
6: In confint.thpr(pp, level = level, zeta = zeta) : bad spline fit for (Intercept): falling back to linear interpolation
I have searched through many old threads that compare these methods, and I do expect the results from these methods to be different. However previous posts (and my own experience) suggests that usually these methods produce results that are not quite so far apart. I am looking for some intuition as to why this might occur and whether I am right to think that the bootstrapped results are probably more realistic (I suppose this means I should be skeptical of the SEs reported in summary()
as well?).
I apologize for not providing a reproducible example, as I am not able to share the original data and my attempts to simulate the same issue only lead to situations in which the Wald and bootstrapped CIs were similar.
EDIT: Plot of profile:
Edit #2: In response to Ben Bolker's comment below, the following code (stolen from elsewhere on the internet) simulates data for a mixed model and demonstrates that confint(..., method="profile") fails when weights are included as well as some differences in CIs from the different methods.
library(mvtnorm)
set.seed(2345)
N <- 150
unit.df <- data.frame(unit = c(1:N), a = rnorm(N))
unit.df <- within(unit.df, {
E.alpha.given.a <- 1 - 0.15 * a
E.beta.given.a <- 3 + 0.3 * a
})
q = 0.2
r = 0.9
s = 0.5
cov.matrix <- matrix(c(q^2, r * q * s, r * q * s, s^2), nrow = 2,
byrow = TRUE)
random.effects <- rmvnorm(N, mean = c(0, 0), sigma = cov.matrix)
unit.df$alpha <- unit.df$E.alpha.given.a + random.effects[, 1]
unit.df$beta <- unit.df$E.beta.given.a + random.effects[, 2]
J <- 300
M = J * N #Total number of observations
x.grid = seq(-4, 4, by = 8/J)[0:30]
within.unit.df <- data.frame(unit = sort(rep(c(1:N), J)), j = rep(c(1:J),N), x =rep(x.grid, N))
flat.df = merge(unit.df, within.unit.df)
flat.df <- within(flat.df, y <- alpha + x * beta + 0.75 * rnorm(n = M))
simple.df <- flat.df[, c("unit", "a", "x", "y")]
simple.df$wht <- rpois(n = dim(simple.df)[1], lambda = 5)+1
my.lmer <- lmer(y ~ x + a + x * a + wht + (1 | unit), data = simple.df, weights = wht)
summary(my.lmer)
confint(my.lmer, method="Wald")
confint(my.lmer, method="profile")
confint(my.lmer, method="boot", nsim=100)
pp <- profile(mod); lattice::xyplot(pp)
(you'll want to save the profile object, as it's pretty slow to compute) $\endgroup$