0

我正在尝试使用 R 中的 L-BFGS-B 方法使用函数 mle() 估计七个约束参数。为了调查为什么会non-finite finite-difference value [2]出错,我将其包含control = list(trace = 6)在 mle() 函数中以希望了解有关起源的更多信息的错误。

不幸的是,我不太了解跟踪的输出,这让我感到惊讶:程序似乎只是在 101 次迭代后停止,而没有给我一个适当的理由。

有谁知道为什么?

我想 trace=6 报告的七个 X 值是 mle 过程收敛到此迭代的参数值。在我的对数似然函数中输入这些值给我的值与“最终值”下报告的值相同:-152.449285。当我从第 97 次迭代中估算七个 X 值时,我得到相同的对数似然 -152.449285。

有两件事似乎很突出。首先,X 的第二个值 0.999 正是我估计的第二个参数的上限。其次,与其他 G 值相比,G 的第二个值在 -412.172 处似乎相对较大。G到底是什么意思?X 和 G 的第二个值在很多次迭代中都是这样的。这是否给了我一个线索,我怎样才能使估计工作?提前致谢!

由于我的问题是关于结果的解释/直觉,我没有提供可重复的例子。它有很多代码,我不知道如何用一点点代码来重现这种情况。如果您需要我的代码,请告诉我。

最后的第 101 次迭代:

---------------- CAUCHY entered-------------------

There are 4  breakpoints

Piece      1 f1, f2 at start point -9.1069e-03  3.1139e+01

Distance to the next break point =   1.9816e+00

Distance to the stationary point =   2.9246e-04

GCP found in this segment

Piece      1 f1, f2 at start point -9.1069e-03  3.1139e+01

Distance to the stationary point =   2.9246e-04

Cauchy X =  -0.749937 0.999 0.841376 1.14695 0.134673 0.121755 0.365289 


---------------- exit CAUCHY----------------------

0 variables leave; 0 variables enter

6  variables are free at GCP on iteration 101

LINE SEARCH 0 times; norm of step = 0.000232633

X = -0.749896 **0.999** 0.841349 1.14697 0.134672 0.121757 0.36551 

G = -0.0154393 **-412.172** -0.0621798 0.0130552 -0.00801055 0.00692317 -0.0134718 

final  value -152.449285 

**stopped after 101 iterations**

Error in optim(start, f, method = method, hessian = TRUE, ...) : 
  non-finite finite-difference value [2]

---- 更新 1 ---

我听从了 Roland 的建议,但首先尝试将 maxit 设置为 200: control = list(maxit=200, trace=6)

该过程现在在第 106 次迭代时收敛,但是,我仍然收到之前的错误:

iterations 106
function evaluations 127
segments explored during Cauchy searches 110
BFGS updates skipped 2
active bounds at final generalized Cauchy point 1
norm of the final projected gradient 0.0217961
final function value -152.449

X = -0.749748 0.999 0.841415 1.14687 0.134666 0.121766 0.366383 

F = -152.449

final  value -152.449295 

converged

Error in optim(start, f, method = method, hessian = TRUE, ...) : 
  non-finite finite-difference value [2]

---- 更新 2 ---

我遵循了 Biswajit Banerjee optim in r : nonfinitefinite Difference error 的建议,并将 ndeps 设置?optim为“梯度的有限差分逼近的步长向量”,第二个参数为 0.0001(所有参数默认为 0.001其他参数)。现在一切正常!请问这是否与第二个参数的值是上限或G值比较大有关?

4

0 回答 0