Bootstrapped confidence interval for GLMM model parameters

Asked

Viewed 58 times

1

I am doubtful to generate a confidence interval that I have been asked to when it is a GLMM

Normally if it were not binomial would do for example like this:

library(boot)
library(lme4)
library(dplyr)
dat <- data.frame(x = runif(100, -2,2),ind = gl(n = 10, k = 10))
dat$y <- 1 + 2 * dat$x + rnorm(10, 0, 1.2)[dat$ind] + rnorm(100, 0, 0.5)
m <- lmer(y ~ x + (1|ind), dat)

b_par <- bootMer(x = m, FUN = fixef, nsim = 200)
boot.ci(b_par, type = "perc", index = 1)

But when y is binomial, I don’t know how to generate the dat$y mentioned above.

Thank you

  • 1

    Hello Cleber, remove the tag bootstrap-3, because it’s a programming language. To reproduce the error, provide the database, or at least a database with the same behavior as your.

1 answer

2

I circled that way:

(gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
              data = cbpp, family = binomial))
b_par <- bootMer(x = gm1, FUN = fixef, nsim = 50)
boot::boot.ci(b_par, type = "perc", index = 1)

which is an example code of the function glmer and worked to binomial.

Try to reduce the number of simulations (as I did here).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.