Olu Ola
2015-Jul-17 17:55 UTC
[R] OPTIMX: non-finite finite-difference value [26] and scaling problem
Hello,I am running a nonlinear GMM using the optimx wrapper. I am trying to estimate 37 variables however and my code for the optimx is: nlgmm = optimx(par=b0, fn=obj,method = "BFGS", itnmax=10000, control=list(follow.on = TRUE,kkt=FALSE,starttests=TRUE,save.failures=TRUE, trace=0)) My staring values are from Ordinary least squares estimates (OLS) and they are: b0 <- c(-2.00658,-0.04373,0.19079,0.34652,-0.36814,0.21284,-0.24369,0.64622,0.22927,0.29431,0.19547,0.80614,18.8398,0.5928,3.1375,0.4301,-0.4937,2.2016,31.5203,0.6171,1.0206,1.7830,-0.4421,11.0076,-0.03305,0.17087,0.44794,0.17488,0.10781,-0.50747,-0.04563,0.17030,0.41792,0.17526,0.99734,-17.2996,-41.9359) I got the following error: Error in optim(par = par, fn = ufn, gr = ugr, lower = lower, upper = upper, ?:?? non-finite finite-difference value [26] I also got an error about scaling which is as follows: Parameters or bounds appear to have differentscalings.This can cause poor performance in optimization. Itis important for derivative free methods like BOBYQA, UOBYQA, NEWUOA. any help will be greatly appreciated. Best Regards [[alternative HTML version deleted]]
Jeff Newmiller
2015-Jul-18 07:07 UTC
[R] OPTIMX: non-finite finite-difference value [26] and scaling problem
It is quite unlikely that anyone can help you without a reproducible example. [1] You should be aware that sending emails to this list in HTML format is likely to yield scrambled mails received. Please make your email client send email in plain text. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example On 07/17/2015 10:55 AM, Olu Ola via R-help wrote:> Hello,I am running a nonlinear GMM using the optimx wrapper. I am trying to estimate 37 variables however and my code for the optimx is: > nlgmm = optimx(par=b0, fn=obj,method = "BFGS", itnmax=10000, control=list(follow.on = TRUE,kkt=FALSE,starttests=TRUE,save.failures=TRUE, trace=0)) > > My staring values are from Ordinary least squares estimates (OLS) and they are: > b0 <- c(-2.00658,-0.04373,0.19079,0.34652,-0.36814,0.21284,-0.24369,0.64622,0.22927,0.29431,0.19547,0.80614,18.8398,0.5928,3.1375,0.4301,-0.4937,2.2016,31.5203,0.6171,1.0206,1.7830,-0.4421,11.0076,-0.03305,0.17087,0.44794,0.17488,0.10781,-0.50747,-0.04563,0.17030,0.41792,0.17526,0.99734,-17.2996,-41.9359) > > I got the following error: > Error in optim(par = par, fn = ufn, gr = ugr, lower = lower, upper = upper, : non-finite finite-difference value [26] > I also got an error about scaling which is as follows: > Parameters or bounds appear to have differentscalings.This can cause poor performance in optimization. Itis important for derivative free methods like BOBYQA, UOBYQA, NEWUOA. > > > any help will be greatly appreciated. > Best Regards > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k
Bert Gunter
2015-Jul-18 15:57 UTC
[R] OPTIMX: non-finite finite-difference value [26] and scaling problem
... but unless there is an outright error in the code, the problem is due to the specific data and starting values, which means they cannot be easily reproduced. More than likely, the optimizer has run into numerical problems. After all, it is wandering around in 37 dimensional space and the max/min parameter ratio (scaling issues) is about 1000. So there could well be severe overparameterization/inadequate data and poor parameter scaling. Many applied practitioners seem unaware of the realities and challenges of *non*linear optimization -- it is, after all, a highly technical specialty -- and somehow expect that they can throw multi-parameter nonlinear models at any old data they have. This is the sort of rude awakening that might be expected under such circumstances, for which the only solution may be a careful rethink of the goals of the modeling effort, the complexity of the models, and the limitations of the data available. Note that these comments are of necessity largely speculative and would benefit greatly by amplification and criticism by real experts, of which I ain't one. So caveat emptor! (as usual on the internet). Best, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Sat, Jul 18, 2015 at 12:07 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> It is quite unlikely that anyone can help you without a reproducible > example. [1] > > You should be aware that sending emails to this list in HTML format is > likely to yield scrambled mails received. Please make your email client send > email in plain text. > > [1] > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example > > On 07/17/2015 10:55 AM, Olu Ola via R-help wrote: >> >> Hello,I am running a nonlinear GMM using the optimx wrapper. I am trying >> to estimate 37 variables however and my code for the optimx is: >> nlgmm = optimx(par=b0, fn=obj,method = "BFGS", itnmax=10000, >> control=list(follow.on = TRUE,kkt=FALSE,starttests=TRUE,save.failures=TRUE, >> trace=0)) >> >> My staring values are from Ordinary least squares estimates (OLS) and they >> are: >> b0 <- >> c(-2.00658,-0.04373,0.19079,0.34652,-0.36814,0.21284,-0.24369,0.64622,0.22927,0.29431,0.19547,0.80614,18.8398,0.5928,3.1375,0.4301,-0.4937,2.2016,31.5203,0.6171,1.0206,1.7830,-0.4421,11.0076,-0.03305,0.17087,0.44794,0.17488,0.10781,-0.50747,-0.04563,0.17030,0.41792,0.17526,0.99734,-17.2996,-41.9359) >> >> I got the following error: >> Error in optim(par = par, fn = ufn, gr = ugr, lower = lower, upper >> upper, : non-finite finite-difference value [26] >> I also got an error about scaling which is as follows: >> Parameters or bounds appear to have differentscalings.This can cause poor >> performance in optimization. Itis important for derivative free methods >> like BOBYQA, UOBYQA, NEWUOA. >> >> >> any help will be greatly appreciated. >> Best Regards >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at 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. >> > > > -- > --------------------------------------------------------------------------- > Jeff Newmiller The ..... ..... Go Live... > DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/Batteries O.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > > ______________________________________________ > R-help at 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.