if (interactive()) {
library(lme4)
gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial)
## show available methods
allFit(show.meth.tab=TRUE)
gm_all <- allFit(gm1)
ss <- summary(gm_all)
ss$which.OK ## logical vector: which optimizers worked?
## the other components only contain values for the optimizers that worked
ss$llik ## vector of log-likelihoods
ss$fixef ## table of fixed effects
ss$sdcor ## table of random effect SDs and correlations
ss$theta ## table of random effects parameters, Cholesky scale
}
if (FALSE) {
## Parallel examples for Windows
nc <- detectCores()-1
optCls <- makeCluster(nc, type = "SOCK")
clusterEvalQ(optCls,library("lme4"))
### not necessary here because using a built-in
## data set, but in general you should clusterExport() your data
clusterExport(optCls, "cbpp")
system.time(af1 <- allFit(m0, parallel = 'snow',
ncpus = nc, cl=optCls))
stopCluster(optCls)
}
Run the code above in your browser using DataLab