Dear All,
I have been using the function optimize and I found the following behaviour:
I construct a function with the following format:
some.fun<-function(){
fun.1() # which uses optimize
# Then use optimize again:
lapply(1:n,function(k) optimize ...) }
I got a different result if I use:
some.fun2<-function(){
fun.2() # which does the same thing as fun.1 but do not use optimize
# Then use optimize again:
lapply(1:n,function(k) optimize ...) }
I read the optimize helpfile and it says "The optimize function may not be
called recursively, that is, f may not include a call to optimize. Recursive
calls would overwrite information that is stored internally." I believe
this comment applies to using optimize in the following manner:
optimize(optimize(),...)
But does it also cover the situation like above?
What am I doing wrong here?
Thank your for your attention.
****************************************************************************
**********
Steve Su (s.su@qut.edu.au)
PhD student.
School of Accountancy
School of Mathematical Sciences
Queensland University of Technology
Postal Address: Steve Su, School of Accountancy, QUT, PO Box 2434,
Brisbane,
Queensland, Australia, 4000.
Phone: +61 7 3864 2017
Fax: +61 7 3864 1812
Mobile: 0421 840 586
.
_--_|\
/ QUT
\_.--._/
v
****************************************************************************
**********
|