rlme4confidence-intervalmumin

Confidence intervals for variables from top model of dredge function (lmer)


I am using lmer models to look at the effect of environmental predictor variables on a landscape variable. To do so, I'm using the dredge function to create a model candidate set of all possible combinations of predictor variables.

m3 <- lmer(div~scale(log(travel.time))+scale(spinsandplain)+scale(ThreeYearRain)+scale(claylake)+scale(ThreeYearRain)*scale(log(travel.time))+(1|circleID),na.action=na.fail,
          data=data, REML=FALSE)
s <-dredge(m3, extra = list("R^2"))
s

summary(get.models(s, 1)[[1]])  

I want to now pull out the confidence intervals of each variable from each of the top models. I can't seem to find any code, other than model averaging. Do you have the code? Is this not possible?

Thanks in advance, Leanne


Solution

  • get.models() returns a list of model objects of the same class as your global.model, so use e.g. confint or any relevant function on each item through lapply, sapply or a for loop.

    For example: lapply(get.models(s, 1:10), confint)

    Reproducible example:

    library(glmmTMB)
    library(MuMIn)
    
    # from example(glmmTMB)
    m2 <- glmmTMB(count ~ spp + mined + (1|site), family=nbinom2, data=Salamanders))
    models <- get.models(dredge(m2), TRUE)
    
    # list of CI for each model's parameters:
    lapply(models, confint)