nls - 收敛失败:奇异收敛(7)

MYa*_*208 5 statistics r nls

以下nls代码Convergence failure: singular convergence (7)fm2(for Data2)引发以下错误.但类似数据集的相同代码工作正常(fm1for Data1).任何帮助解决这个问题将非常感激.谢谢


适用于此数据集


Data1 <-
structure(list(D = c(0L, 0L, 0L, 0L, 5L, 5L, 5L, 5L,
10L, 10L, 10L, 10L, 15L, 15L, 15L, 15L, 20L, 20L, 20L, 20L),
    Y = c(11.6, 9.3, 10.7, 9.2, 7.8, 8, 8.6, 7.9, 7.7,
    7.6, 7.5, 7.5, 7.2, 7.3, 7, 6.5, 6.3, 5.7, 5.6, 6)), .Names = c("D",
"Y"), class = "data.frame", row.names = c(NA, 20L))

fm1  <-
  nls(
      formula=Y~w*(1-(i*D/(100*(1+i*D/A))))
    , data=Data1
    , start=list(w=13, i=3, A=80)
    , algorithm="port"
    )
Run Code Online (Sandbox Code Playgroud)

不适用于此数据集


Data2 <-
structure(list(D = c(0L, 0L, 0L, 0L, 5L, 5L, 5L, 5L,
10L, 10L, 10L, 10L, 15L, 15L, 15L, 15L, 20L, 20L, 20L, 20L),
    Y = c(10.8, 10.7, 8.4, 8.5, 8, 8, 8, 7.9, 7.9, 7.2,
    7.8, 7.2, 6.6, 6.5, 6.5, 6.4, 2.2, 4.5, 4.2, 6.2)), .Names = c("D",
"Y"), class = "data.frame", row.names = 21:40)

fm2  <-
  nls(
      formula=Y~w*(1-(i*D/(100*(1+i*D/A))))
    , data=Data2
    , start=list(w=13, i=3, A=80)
    , algorithm="port"
    )
Run Code Online (Sandbox Code Playgroud)

G. *_*eck 7

我认为它的参数化存在问题.我们可以通过让B为i/A,.lin1 = w和.lin2 = i*w来利用线性度.在这种情况下.lin1和.lin2线性地输入并且alg=plinear仅使用非线性参数需要起始值:

> fo <- Y ~ cbind(1, -D/(100*(1+B*D)))
> nls(fo, Data, start = list(B = 3/80), alg = "plinear")
Nonlinear regression model
  model: Y ~ cbind(1, -D/(100 * (1 + B * D)))
   data: Data
       B    .lin1    .lin2 
-0.02217  9.26808 13.61471 
 residual sum-of-squares: 15.76

Number of iterations to convergence: 9 
Achieved convergence tolerance: 4.236e-06
Run Code Online (Sandbox Code Playgroud)

从结果w = .lin1; i*w = .lin2(所以i = .lin2/.lin1)和B = i/A(所以A = i/B).

修订改进了配方.