Hello, I am trying to estimate a non-linear GMM in R using Optimx. However, when I do the start test to compare my analytical gradient with the numerical gradient, I get the following error message
Error: Gradient function might be wrong - check it! Below are the print out of my analytical and numerical gradient. They are close to an extent and I want to use my analytical gradient. The first column is the analytical gradient while the second column is the numerical gradient numgrad [1,] -9862.118 -9862.103 [2,] -20855.001 -20854.985 [3,] -12277.764 -12277.767 [4,] 3332.864 3332.865 [5,] 3562.808 3562.804 [6,] -14971.913 -14971.915 [7,] 27394.457 27394.451 [8,] -15634.531 -15634.532 [9,] -16893.399 -16893.402 [10,] -1330.469 -1330.468 [11,] 16877.994 16877.991 [12,] -9406.643 -9406.643 [13,] -40451.881 -40451.881 [14,] -48052.941 -48052.944 [15,] -29997.114 -29997.116 [16,] 34546.011 34546.002 [17,] -65540.191 -65540.200 [18,] -24400.970 -24400.972 [19,] -26655.760 -26655.760 [20,] -59128.576 -59128.576 [21,] -40026.926 -40026.931 [22,] -34780.662 -34780.655 [23,] -119284.474 -119284.473 [24,] 22336.013 22336.025 [25,] -40665.139 -40665.139 [26,] -21596.959 -21596.959 [27,] -33859.274 -33860.747 [28,] -30536.938 -30539.807 [29,] -95411.022 -95416.182 [30,] -33016.450 -33018.690 [31,] -90052.772 -90059.612 [32,] 8008.684 8009.342 [33,] -45084.823 -45086.720 [34,] -34071.584 -34074.802 [35,] -259960.860 -259990.135 [36,] -69986.472 -69990.537 [37,] 24870.530 24874.012 The code for my optimization is as follows: nlgmm = optimx(par=b0, fn=obj,gr=gra, method ="BFGS", itnmax=10000, control=list(follow.on = TRUE,usenumDeriv=FALSE,kkttol=10,starttests=TRUE, save.failures=TRUE, trace=0)) Is there a way to turn off the gradient check? this is because if I do not run the start test, it will still eventually display the error message. Any help to cross this bridge will be greatly appreciated. Thank you ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.