I am fitting a GLMM with family gamma using the `lme4`

package in R. Below is a code example to simulate the gamma GLMM fitting.

`# Load packages library(tidyverse) library(lme4) library(lmerTest) # Set seed set.seed(200) # Create an example data frame dat <- data_frame(X = rgamma(500, shape = 2), Group = rep(c("A", "B", "C", "D", "E"), each = 100)) %>% mutate(R = unlist(map(1:5, ~rnorm(100, .x)))) %>% mutate(Y = exp(X + R)) # Fit a GLMM with Gamma and log link fit <- glmer(Y ~ X + (1 | Group), data = dat, family = Gamma(link = "log")) `

For poisson or binomial GLMM, we can use the `confint`

function to calculate the confidence interval. But the default setting (`method = "profile`

) is not working for gamma GLMM.

`confint(fit) Computing profile confidence intervals ... Error in profile.merMod(object, which = parm, signames = oldNames, ...) : can't (yet) profile GLMMs with non-fixed scale parameters `

Instead, we can set the method to be `Wald`

or `boot`

to calculate the confidence interval.

`# Calculate the confidence interval using the Wald method confint(fit, method = "Wald") # 2.5 % 97.5 % # .sig01 NA NA # .sigma NA NA # (Intercept) 2.199512 4.548215 # X 1.018495 1.131192 # Calculate the confidence interval using the boot method confint(fit, method = "boot") # 2.5 % 97.5 % # .sig01 0.4264700 1.9473079 # .sigma 0.8331289 0.9826871 # (Intercept) 2.1469817 4.5461055 # X 1.0202349 1.1340656 # Warning message: # In bootMer(object, FUN = FUN, nsim = nsim, ...) : # some bootstrap runs failed (5/500) `

I am curious about which method to use and what would be the pros and cons. As far as I can tell, the `Wald`

method is fast to compute, while the bootstrapping method takes a long time to run. But `Wald`

method can only compute the confidence interval of the fixed-effect parameters. Any insights or suggestion would be appreciated.

**Contents**hide

#### Best Answer

I found this blog to be helpful RE finding CI's for estimates of a GLM(M):

https://fromthebottomoftheheap.net/2018/12/10/confidence-intervals-for-glms/

### Similar Posts:

- Solved – What method is used to calculate confidence intervals in R’s MASS package function confint.glm
- Solved – Understanding confidence intervals in Firth penalized logistic regression
- Solved – Calculating confidence intervals of marginal means in linear mixed models
- Solved – Confidence Interval for Inverse Gamma Distribution
- Solved – Calculate the confidence interval for the mean of a beta distribution