Juanchi Juanchi - 2 months ago 10
R Question

predicted values for glmer AICcmodavg

I know that one can get the predicted values (in original scale ~ probability) and their SE for the fixed effects with AICcmodavg, but I'm trying without any success... Can someone help me with that? Thanks in advance

library(lme4)
(gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial))
fixef(gm1)

library("AICcmodavg")

predictSE(gm1,
newdata=as.data.frame(period=c("period1","period2","period3","period4")),
type="response",
se.fit=TRUE,
level=0,
print.matrix=F)

Answer

It would be better to read levels(cbpp$period), and not as.data.frame() but data.frame()

predictSE(gm1, 
          newdata = data.frame(period=c("1", "2", "3", "4")),
          type = "response", 
          se.fit = TRUE, 
          level = 0, 
          print.matrix = F)