在 Pinhiero 和 Bates 书中实现非线性混合效应模型收敛的问题

Trouble with achieving convergence in nonlinear mixed-effects model in Pinhiero and Bates book

我正在阅读 Pinhiero 和 Bates 的书S 和 S-Plus 中的混合效应模型R。我在第 8 章(第 387 页)中获取模型时遇到问题) 收敛。

library(nlme)

fm1Wafer.nlmeR <- nlme(current ~ A + B * cos(4.5679 * voltage) + C * sin(4.5679 * voltage),
                       data = Wafer,
                       fixed = list(A ~ voltage + I(voltage^2), B + C ~ 1),
                       random = list(Wafer = A ~ voltage + I(voltage^2),
                                     Site = pdBlocked(list(A ~ 1, A ~ voltage + I(voltage^2)-1))),
                       start = c(-4.26, 5.62, 1.26, -0.10, 0.10), # starting values taken from fixed effects of another model earlier in the book
                       method = "REML",
                       control = nlmeControl(opt = "nlm"))

如您所见,我已经尝试了 nlm 优化器。默认的 nlminb 优化器也不起作用。两者都会产生此错误消息

Error in nlme.formula(current ~ A + B * cos(4.5679 * voltage) + C * sin(4.5679 *  : 
  maximum number of iterations (maxIter = 50) reached without convergence
In addition: Warning messages:
1: In logLik.reStruct(object, conLin) :
  Singular precision matrix in level -2, block 1
2: In logLik.reStruct(object, conLin) :
  Singular precision matrix in level -2, block 1

有什么建议吗?本书的下游有几个基于这个模型的模型,所以让它收敛会很好。

该错误表明设置 nlmeControl(opt = "nlm", maxIter = 2000) 之类的内容会有帮助,但实际上并没有帮助。我尝试了 4000 次,但它花了很长时间...

看来真正的罪魁祸首是 method = "REML"。保留默认值 "ML" 会得到预期的结果。

fm1Wafer.nlmeR <- nlme(current ~ A + B * cos(4.5679 * voltage) + C * sin(4.5679 * voltage),
                       data = Wafer,
                       fixed = list(A ~ voltage + I(voltage^2), B + C ~ 1),
                       random = list(Wafer = A ~ voltage + I(voltage^2),
                                     Site = pdBlocked(list(A ~ 1, A ~ voltage + I(voltage^2) - 1))),
                       start = c(-4.26, 5.62, 1.26, -0.10, 0.10))