[R] constrained optimisation without second order derivatives? - lnsrch error

Jonathan Phillips 994phij at gmail.com
Thu Apr 26 23:43:55 CEST 2012


Hi,
I'm trying to do some constrained non-linear optimisation, but my
function does not have second order derivatives everywhere.

To be a little more specific (the actual function is huge and
horrible, so it would probably be better to just describe it) my model
has four variables and I'm using optim to minimise an error term.

My data is split into discreet days and I have two types of point:
some which I can only tell if my calculated value is too small (s1,
s2, s3 etc.), and others which I can only tell if it is too large (l1,
l2, l3 etc)  So if my predicted value for l1 is too high I square the
difference between it and the actual result, add it to 'totuperr' and
increment 'totupnum', and if s1 is too small I square the difference,
add it to 'totdownerr' and increment 'totdownnum'.  For each day I
then take totuperr/totupnum, totdownerr/totdownnum and add them both
to my final error term.

I'm constraining two of my parameters (to be between 0 and 1), and so
it seems I have to use L-BFGS-B.

Unfortunately, when optim gets close to the minimum, it usually bails
with 52: "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH" or sometimes 1:
"NEW_X".  Occasionally it succeeds.

I assume this error is something to do with the error terms
disappearing when you get reasonably good parameters.  Is that
plausible?  If so does anybody know how to fix it?

Thanks,
Jon Phillips



More information about the R-help mailing list