Model failure for nonlinear mixed-effects model from Pinhiero and Bates

狂风中的少年 提交于 2019-12-23 22:25:58

问题


I have been working through Mixed-Effects Models in S and S-Plus by Pinhiero and Bates and am discovering a lot of problems making the models in the book work.

The latest is this, using a constant plus power function to model heteroscedastic within-group error in the Theo dataset, (p.393). The error comes at the end of a model-building exercise. The first three models work in R but the last does not

library(nlme)
fm1Theo.nlme <- nlme( model = conc ~ SSfol(Dose, Time, lKe, lKa, lCl), 
                      data = Theoph,
                      fixed = lKe + lKa + lCl ~ 1,
                      random = lKe + lKa + lCl ~ 1)
fm2Theo.nlme <- update(fm1Theo.nlme, random = pdDiag(list(lKe ~ 1, lKa ~ 1, lCl ~ 1)))
fm3Theo.nlme <- update(fm2Theo.nlme, random = pdDiag(list(lKa ~ 1, lCl ~ 1)))
fm4Theo.nlme <- update(fm3Theo.nlme, weights = varConstPower(power=0.1))

...yielding the error message

Error in eigen(val, only.values = TRUE) : 
  infinite or missing values in 'x'
In addition: Warning messages:
1: In nlminb(c(coef(nlmeSt)), function(nlmePars) -logLik(nlmeSt, nlmePars),  :
  NA/NaN function evaluation
2: In nlminb(c(coef(nlmeSt)), function(nlmePars) -logLik(nlmeSt, nlmePars),  :
  NA/NaN function evaluation
3: In nlminb(c(coef(nlmeSt)), function(nlmePars) -logLik(nlmeSt, nlmePars),  :
  NA/NaN function evaluation
4: In nlminb(c(coef(nlmeSt)), function(nlmePars) -logLik(nlmeSt, nlmePars),  :
  NA/NaN function evaluation

Can anyone shed some light on this message, and how I might make it work?


回答1:


It looks like something that is supposed to be positive became negative during the optimization: functions such as sqrt and log when applied to negative numbers return NaN. Without digging deeper I tried to look into the variance model, which is supposed to return positive values. Setting higher initial value for const solves the issue:

fm4Theo.nlme <- update(fm3Theo.nlme, weights = varConstPower(const = 0.5, power = 0.1))


来源:https://stackoverflow.com/questions/53927436/model-failure-for-nonlinear-mixed-effects-model-from-pinhiero-and-bates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!