Re: [R] optimization in for loop

2011-06-29 Thread siriustar
Thankyou very much. I think "try" works for me. I am learning it . Sirius -- View this message in context: http://r.789695.n4.nabble.com/optimization-in-for-loop-tp3633638p3634100.html Sent from the R help mailing list archive at Nabble.com. __ R-hel

Re: [R] optimization in for loop

2011-06-29 Thread David Winsemius
On Jun 29, 2011, at 2:31 PM, siriustar wrote: Hi, dear R help I am trying to use optim inside a for loop: ##For example. a: intial guess. b: result. f: function to be minimized for (i in 1:10) { b[i] <- optim(a[i], f)} However, some intial values cause error in optim function (e.g. "

[R] optimization in for loop

2011-06-29 Thread siriustar
Hi, dear R help I am trying to use optim inside a for loop: ##For example. a: intial guess. b: result. f: function to be minimized for (i in 1:10) { b[i] <- optim(a[i], f)} However, some intial values cause error in optim function (e.g. " system is computationally singular..."). Then the for