stcava
如果实在找不到参数而产生 (以下例子参照(statistic with R))
Error in numericDeriv(form[[3]], names(ind), env):
Missing value or an Infinity produced when evaluating the model
In addition: Warning messages:
1: NaNs produced in: log(x)
2: NaNs produced in: log(x)
或者
Error in nls(resp ~ (Dose * (exp(-input * exp(lKe)) - exp(-input * exp(lKa))))/(exp
(lKa) - :
singular gradient
或者
Error in nls(y ~ cbind(exp(-exp(lrc1) * x), exp(-exp(lrc2) * x)), data = xy, :
step factor 0.000488281 reduced below `minFactor' of 0.000976562
等等
如果nls是在loop中,因为自动找不到参数而遇到error,如果我想忽略它return NA或者其他,然后跳到下一个命令,该用什么语句呢?
谢谢
stcava
问题已经解决
zwdbordeaux
可否说说怎么解决的?我也有时候会碰到类似问题。先多谢分享
stcava
try()
options()
由于引起error的情况很多,具体请参看 ?try
最好是没有error,其实参数估算还是不要用loop的好。
如果加上一些手动估算,例如使用selfStrat,基本还是能估算出来的。而nlme包里面有些小function对估算也很有帮组。另外了解模型的参数基本是代表什么也很重要。
mixed-effects models in S and S-PLUS 这本书也很有帮组
作者是:Jose C. Pinheiro and Douglas M. Bates
另外
statistical tools for nonlinear regression
作者: S. Huet, A. Bouvier, M. -A. Poutsat, E. Jolivet
希望这些能榜到大家。
stcava
还有方法就是suppressWarnings()
然而这是最不可取的方法