I want to use the new bootMer() feature of the new lme4 package (the developer version currently). I am new to R and don\'t know which function should I write for its FUN argume
There are basically two (simple) confusions here.
coef()
(which returns a list of matrices) and fixef()
(which returns a vector of the fixed-effect
coefficients): I assume that fixef()
is what you wanted, although you might want something like c(fixef(mixed),unlist(VarCorr(mixed)))
.FUN
should take a fitted model object as input ...For example:
library(lme4)
library(boot)
mixed <- glmer(incidence/size ~ period + (1|herd),
weights=size, data=cbpp, family=binomial)
FUN <- function(fit) {
return(fixef(fit))
}
result <- bootMer(mixed, FUN, nsim = 3)
result
## Call:
## bootMer(x = mixed, FUN = FUN, nsim = 3)
## Bootstrap Statistics :
## original bias std. error
## t1* -1.398343 -0.20084060 0.09157886
## t2* -0.991925 0.02597136 0.18432336
## t3* -1.128216 -0.03456143 0.05967291
## t4* -1.579745 -0.08249495 0.38272580
##