[R] On nlm

E. D. Isaia isaia at econ.unito.it
Mon Jan 6 06:23:03 CET 2003


Dear all, I have to minimize a (real) function in a loop (say i in 
(1:1000)) and store its ``$estimate'', via 

l2estim<-nlm(f.minimo,c(-.01,0.1))$estimate

into a vector for further analisys.
Since the function's behaviour is quite  peculiar (in the sense that in 
the simulation study it may not have a minumum), sometimes I get the the 
warning

Error in nlm(minimo, c(-0.01, 0.1), check.analyticals = FALSE) : 
	non-finite value supplied by nlm
In addition: There were 50 or more warnings (use warnings() to see the first 50)

and the cicle stops. How can I avoid this and tell R that if so then l2estim<-0, for example.

Thanks to all, isaia.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Ennio D. Isaia
~ Dep. of Statistics & Mathematics, University of Torino
~ Piazza Arbarello, 8 - 10128 Torino (Italy)
~ Phone: +39 011 670 62 51 ~~ Fax: +39 011 670 62 39
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the R-help mailing list