Re: FindMinimum on a potentially Complex-valued function

*To*: mathgroup at smc.vnet.net*Subject*: [mg8728] Re: [mg8719] FindMinimum on a potentially Complex-valued function*From*: seanross at worldnet.att.net*Date*: Sat, 20 Sep 1997 22:27:57 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Luci Ellis wrote: > > Dear MathGroup, > > I have recently written a function that involves minimizing a > log-likelihood function. The function to be minimised is the log of an ugly > high-order polynomial in three variables. > > It works as expected for some data, but for other data sets, the > FindMinimum function ends up going to parameters that give complex-number > values of the objective function, and I get an error. (This also happens in > Gauss so it's not just a Mathematica problem). > > Is there some way of telling the FindMinimum function that if it hits > parameter values that give complex-valued results, it should move to some > other initial guesses for the FindMinimum and try again? > > eg, something like: If[FindMinimum[expr,{a,a0},{b,b0}]==Message[whatever > the name of the message that comes up > is],FindMinimum[expr,{a,a0+1},{b,b0+1}],FindMinimum[expr,{a,a0},{b,b0}]] > > And presumably put it in a While Loop, to keep progressively trying > starting values until it stops falling off the real line. > > I was hoping to write a generalised function to minimise the log-likelihood > function for any appropriate data vector, so I don't know what the "right" > starting values are in any given case, though they are likely to be "small" > (eg between -10 and 10). > > Failing this, if anyone has written a function to estimate the parameters > of a GARCH model (which involves minimising this log-likelihood function), > please let me know how you managed it! > > Please send any replies to my work address ellisl at rba.gov.au as well as my > home address elisha at dot.net.au > > Thanks in anticipation, > Luci Ellis. > > -------------- > Luci Ellis: elisha at dot.net.au > http://www.dot.net.au/~elisha The problem is that FindMinimum does not give you access to intermediate results or intermediate guesses. If you look at the various input options, one of them is the {x,xstart,xmin,xmax}. This will stop your search if the guesses ever exceed the xmin and xmax, but this option can only be used if symbolic derivatives of your function are available. If they are, then you could make a routine that put small limits around the FindMinimum and changed the guesses as appropriate. Another option is to use Catch and Throw around the FindMinimum or Check to catch the complex results. Option three would be to write your own minimization routine. A number of excellent routines can be found in the "Numerical Recipes in ..." series. I am unfamiliar with what is meant by a GARCH or log-likelihood function, but if a log-likelihood function is either an analytic or numeric single valued relatively smooth function of a finite number of input variables, then the principles of minimizing it are the same as for any other function. If you like, I could send you a copy of a multidimensional simplex minimization routine I adapted for Mma out of Numerical Recipes.