r - predicted values for glmer AICcmodavg -
i know 1 can predicted values (in original scale ~ probability) , se fixed effects aiccmodavg, i'm trying without success... can me that? 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)
it better read levels(cbpp$period)
, , not as.data.frame()
data.frame()
levels(cbpp$period) # [1] "1" "2" "3" "4" predictse(gm1, newdata = data.frame(period=c("1", "2", "3", "4")), type = "response", se.fit = true, level = 0, print.matrix = f)
[edited]
fit <- ...(..., data = df) predictse(fit, newdata = df) predictse(fit, newdata = ...) # if 1st predictse() doesn't run, means model causes error. # if 1st runs 2nd doesn't, means due newdata.
if model has 2 factor; newd <- expand.grid(name1 = levels(df$name1), name2 = levels(df$name2)) predictse(fit, newdata = newd) # pred <- predictse(fit, newdata = newd) # cbind(newd, pred) # interpret
Comments
Post a Comment