This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function for getting bootstrapped glmer predictions in parallel | |
glmmBoot <- function(dat, form, R, nc){ | |
# dat = data for glmer (lme4) logistic regression | |
# form = formula of glmer equation for fitting | |
# R = total number of bootstrap draws - should be multiple of nc b/c divided among cores evenly | |
# nc = number of cores to use in parallel | |
library(parallel) | |
cl <- makeCluster(nc) # Request # cores | |
clusterExport(cl, c("dat", "form", "nc", "R"), envir = environment()) # Make these available to each core |