在 R 中应用 NLS 时遇到问题

Trouble applying NLS in R

我正在尝试对 R 中的蛋白质结合应用非线性回归模型。

数据如下:

data$WT
 [1] 107.194364  95.986477  87.511449  74.028678  67.733609
 [6]  52.117508  38.486519  24.197712  15.854248   8.641564
[11]   5.965327   2.871084

data$So
 [1] 2.0000000 1.0000000 0.5000000 0.2500000 0.2000000 0.1000000
 [7] 0.0500000 0.0250000 0.0125000 0.0062500 0.0031250 0.0015625

型号是:

bindmod <- nls(WT ~
(Ase* ((Kd+So+0.03)- sqrt((Kd+So+0.03)^2 - 4*So*0.03)/2)/So)
, data = data, start = list(Kd = 0.03, Ase = 2000))

在试图适应这个错误时出现:

Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model In addition: Warning message: In sqrt((Kd + So + 0.03)^2 - 4 * So * 0.03) : NaNs produced

但是,对于存在的值,平方根中此项的值不应为负,所以我不明白为什么它会产生 NaN。这与估算过程有关吗?

非常感谢任何帮助,谢谢。

乔治

您没有指定 lower/upper 边界,因此当 kdso 使得 (Kd+So+0.03)^2 - 4*So*0.03 为负时,sqrt 产生 NaN .尝试同时设置 lower/upperbounds _and_ thealgorithm`:

  nls(WT ~ (Ase* ((Kd+So+0.03) - sqrt((Kd+So+0.03)^2 - 4*So*0.03)   /   2) / So ),
      data = data,
      start = list(Kd = 0.03, Ase = 2000),
      lower = list(kd=0.01, Ase=  0.01 ),
      algorithm = "port")