lme4::allFit() 中的错误 -- 'isGLMM' 没有适用的方法

Error in lme4::allFit() -- no applicable method for 'isGLMM'

我在尝试使用某些内置并行化 运行 lme4::allFit() 时遇到了一个令人困惑的错误。我拟合了一个初始模型 m0,它使用更大的数据框 ckDF(n = 265,623 行)来模拟对具有 [=37= 的逻辑框架中的多个分类和连续预测变量的二元响应]dom 拦截年。

我有兴趣确定不同的优化器是否会产生不同的结果,遵循我在网上找到的一些建议(例如@BenBolker here)。我的数据相当大,通常需要大约 20 分钟才能达到 运行,所以我希望使用 allFit()parallelncpus 参数来加快速度.这是我的相关代码:

require(lme4)
require(parallel)

m0 <- glmer(returned ~ 1 + barge + site + barge:site + 
            (run + rearType + basin)^2 + 
            (tdg + temp + holdingTime)^2 +
            (1|year), 
            data = ckDF, family = 'binomial',
            control = glmerControl(optimizer='bobyqa', 
                                   optCtrl = list(maxfun = 1e5)))
af1 <- allFit(m0, parallel = 'multicore', ncpus = detectCores())

执行此操作时,我遇到以下错误:

Error in checkForRemoteErrors(val) : 7 nodes produced errors; first error: no applicable method for 'isGLMM' applied to an object of class "list"

有什么想法吗?在我看来,当它构建一堆节点时,不知何故其中一些节点不导入 lme4 包,因此不识别 isGLMM();但我不知道为什么 allFit() 会这样做,因为它来自 lme4()。我尝试深入了解并更改我自己的 allFit() 包的功能,但 运行 出现其他错误。

如有任何帮助,我们将不胜感激。 R版本:3.6.1; lme4 版本:1.1-21;平台:Windows 10 64 位

感谢@user20650 和@Ben Bolker 在上面的评论中提供的提示 - 它有效并且我能够按预期获得 allFit() 到 运行,确保我使用 [=12] =] 在我的函数调用中,因为我 运行 在 Windows 中。只需在此处发布编辑后的代码,供其他认为有用的人使用:

require(lme4); require(snow)

# Define initial model (switched to defaults here)
m0 <- glmer(returned ~ 1 + barge + site + barge:site + 
            (run + rearType + basin)^2 + 
            (tdg + temp + holdingTime)^2 +
            (1|year), 
            data = ckDF, family = 'binomial')

# Set up cluster for running allFit()
optCls <- makeCluster(detectCores()-1, type = "SOCK")
clusterEvalQ(optCls,library("lme4"))
clusterExport(optCls, "ckDF")

# Use allFit() to look at differences in optimizers
system.time(af1 <- allFit(m0, parallel = 'snow', 
                          ncpus = detectCores()-1, cl=optCls))
stopCluster(optCls)

在我的机器上使用 11 个内核最终花费了大约 40 分钟。