An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110121/c693537f/attachment.pl>
nlminb doesn't converge and produce a warning
4 messages · kamel gaanoun, Karl Ove Hufthammer, Douglas Bates +1 more
kamel gaanoun wrote:
I use nlminb like this : res1<-nlminb(vect, V, lower=c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, n-15)), upper=c(rep(Inf, 12), rep(0.99, 3), rep(Inf, n-15)), control = list(maxit=1000) ) and that's the result : Message d'avis : In nlminb(vect, V, lower = c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, : unrecognized control element(s) named `maxit' ignored
Just increase the maximum number of iterations. Which you tried to do, but didn?t succeed in, as the above warnings shows. The argument is called ?iter.max?, not ?max.iter?.
Karl Ove Hufthammer
On Fri, Jan 21, 2011 at 3:51 AM, kamel gaanoun <kamel.gaanoun at gmail.com> wrote:
Hi Everybody, My problem is that nlminb doesn't converge, in minimising a logLikelihood function, with 31*6 parameters(2 weibull parameters+29 regressors repeated 6 times).
Hmm, the length of the parameter vector shown below is 189, which is neither 31*6 nor 2 + 29*6. I suppose it is possible to do nonlinear optimization with box constraints on such a large number of parameters but you should expect it to take a long time and perhaps a lot of memory. Even if the optimizer converges, it would be optimistic to expect that the parameter value returned is necessarily the global optimum. I would recommend trying to simplify the optimization problem. A method like this is just using the computer as a blunt instrument with which to bludgeon the problem to death (sometimes called the "SAS approach").
I use nlminb like this : res1<-nlminb(vect, V, lower=c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, n-15)), upper=c(rep(Inf, 12), rep(0.99, 3), rep(Inf, n-15)), control = list(maxit=1000) ) and that's the result : Message d'avis : In nlminb(vect, V, lower = c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, ?: ?unrecognized control element(s) named `maxit' ignored
res1
$par ?[1] ? 2.48843979 ? 4.75209125 ? 2.57199837 ?16.80712783 ? 3.15211075 16.86606178 ?58.61925499 ?37.85793462 ?48.78215699 ?[10] 151.64638501 ?43.60420299 ?15.14639541 ? 0.58754382 ? 0.76180935 0.66191763 ?-0.26802757 ?-0.96378197 ?-0.68369525 ?[19] ? 0.37813096 ? 0.89778593 -10.26471908 ?-0.87265813 ? 6.43973968 -1.74417166 ?12.00193419 ? 0.60638326 ?-1.66675589 ?[28] ? 1.29312079 ? 1.39846863 ?-0.48449361 ?20.14470193 ?-0.50729841 -2.15177967 ?-0.78155345 ? 0.41857810 ?-0.40863744 ?[37] -17.18489562 ?-1.69140562 ? 1.45236861 ?-0.23738183 ? 5.47688642 -0.71546576 ? 9.95015047 ?-2.16096138 ?-0.74503151 ?[46] ?-0.66258461 ? 5.38871217 ? 2.53147752 -12.58827379 ?-0.45669589 -0.37285088 ? 2.15116198 ?-2.50414066 ?-0.99752892 ?[55] ? 4.83972450 ?-1.16496925 ?-3.53429528 ? 0.56083677 ?-9.87490932 -1.75153657 ? 9.87912224 ?-0.75783517 ?-9.95423392 ?[64] ?-0.07530469 ?-0.73466191 ?-0.27397382 ?15.15891548 ?-0.02489436 12.91493065 ?-4.65335356 ? 0.03524561 ? 0.00000000 ?[73] ?-9.06720312 ?-0.25413758 ?-0.18578765 ? 0.53283198 ?-4.02688497 -0.50581412 ?-0.31544940 ? 0.57450848 ? 6.15206152 ?[82] ? 0.08178377 ? 0.82978606 ? 0.39337352 ?-3.65304712 ?-0.06833839 3.87790848 ?-1.08017043 ? 3.62779184 ?-0.14700541 ?[91] -13.95610827 ?-1.50385432 ? 8.05851743 ?-1.24250013 ?-0.01249817 0.38085483 ?-4.97064573 ?-0.98852401 ?-3.00305183 [100] ? 0.35053875 ?-4.26833889 ?-0.12463188 ?16.05828402 ? 0.41736764 -0.94678922 ?-0.75813452 ? 2.15378348 ? 0.39586048 [109] ? 1.41359441 ? 0.81603207 ?-4.43963958 ?-0.79438435 ? 0.49530882 0.11197484 ?-8.43196798 ? 1.00456535 -22.04423030 [118] ?-0.11532887 ? 2.58085765 ? 1.41912515 ?-0.78120889 ?-1.23850824 12.39079062 ? 0.23567444 ? 1.39557879 ?-2.22993802 [127] -12.58827379 ?-0.45669589 ?-0.37285088 ?-0.73563805 ? 3.40201735 0.58550247 ?-3.62769828 ? 0.21657740 ?-7.37785506 [136] ?-0.68218180 ? 6.41876225 ? 0.38708385 ?-0.33009429 ?-0.25230736 3.53672719 ? 1.53676202 ? 3.65074513 ? 0.42623602 [145] ?-7.26982010 ? 0.70597611 -23.15198788 ?-0.36822845 ?-2.29863267 0.70223129 -14.45665129 ?-0.54094864 ?-2.17858443 [154] ?-0.56501734 ? 2.50032796 ?-0.45677181 ?12.04113439 ?-1.42294094 -16.16874444 ?-0.49101846 ?-6.29724769 ?-1.38333722 [163] -14.16552579 ? 1.57502968 ? 5.04329383 ? 0.24857745 ?-1.69885428 -0.46757266 ? 4.41795651 ?-2.41006349 ? 4.61648610 [172] ? 0.42235314 ?-3.22153895 ?-0.15443857 ? 1.07661101 ?-0.63653449 -2.74034265 ? 0.20898466 ? 1.37927183 ? 0.26722477 [181] -15.09685067 ? 0.87160467 -24.79722150 ? 1.48810684 ? 1.70068893 -0.22538026 ? 7.63908028 ? 1.60431981 ?-7.52661064 $objective [1] 1514.691 $convergence [1] 1 $message [1] "iteration limit reached without convergence (9)" $iterations [1] 150 $evaluations function gradient ? ? 176 ? ?44935 I tried many times to take the res1$par as initial values and retry againe but still doesn't converge. Any help will save me Thanks -- Kamel Gaanoun (+33) (0)6.76.04.65.77 ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list 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.
Hi, It is indeed annoying that each optimization code has different names for the parameters that control the behavior of the algorithms. This is one of the reasons that we have developed "optimx" - to unify the calling convention for the various algorithms. You can call the optimization algorithm of your choice without having to worry about the names of the control parameters. Ravi. ------------------------------------------------------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan at jhmi.edu -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Karl Ove Hufthammer Sent: Friday, January 21, 2011 6:48 AM To: r-help at stat.math.ethz.ch Subject: Re: [R] nlminb doesn't converge and produce a warning
kamel gaanoun wrote:
I use nlminb like this : res1<-nlminb(vect, V, lower=c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, n-15)), upper=c(rep(Inf, 12), rep(0.99, 3), rep(Inf, n-15)), control = list(maxit=1000) ) and that's the result : Message d'avis : In nlminb(vect, V, lower = c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, : unrecognized control element(s) named `maxit' ignored
Just increase the maximum number of iterations. Which you tried to do, but didn?t succeed in, as the above warnings shows. The argument is called ?iter.max?, not ?max.iter?.
Karl Ove Hufthammer ______________________________________________ R-help at r-project.org mailing list 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.