I'm written a function that uses nls in a loop to fit a model to resampled data. Occasionally a sample is drawn such that the algorithm (apparently) can't converge and step factor reduced below minimum is printed to the screen. I tried a few different settings for the minFactor parameter in nls.control with no different result. When this happens, I would like my function to put NAs in the output matrix that holds the parameter estimates and move to the next iteration. As it is, the function terminates upon error and the partially-filled result matrix is not returned. Any suggestions? platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 2.0 year 2000 month 12 day 15 Thanks for your time, Gregg <<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>> Gregg Rosenkranz Scallop Biometrician Alaska Department of Fish and Game 211 Mission Road Kodiak, AK 99615 phone 907.486.1858 fax 907.486.1824 gregg_rosenkranz at fishgame.state.ak.us -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 10 Jan 2001, Gregg Rosenkranz wrote:> I'm written a function that uses nls in a loop to fit a model to resampled data. Occasionally a sample is drawn such that the algorithm (apparently) can't converge and > > step factor reduced below minimum > > is printed to the screen. I tried a few different settings for the minFactor parameter in nls.control with no different result. When this happens, I would like my function to put NAs in the output matrix that holds the parameter estimates and move to the next iteration. As it is, the function terminates upon error and the partially-filled result matrix is not returned. Any suggestions?Use try() around the nls call. See help(try). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi! Gregg Rosenkranz wrote:> > I'm written a function that uses nls in a loop to fit a model to resampled data. Occasionally a sample > is drawn such that the algorithm (apparently) can't converge and...Have a look to try(). If you do a try(nls(...)) your script will continue even if your nls reports an error. cheers, IOsu -- Jesus Maria Frias Celayeta, PhD. Process Engineering Department University College Cork,Cork Ireland phone: 353-21-903096 fax: 353-21-270249 http://www.ucc.ie/acad/departments/processeng/staff/friasj.html -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._