There seems to exist peculiar cases where optim does not take care
of constraints on the parameters to be optimized over. The call to
optim is of the form
opt <- optim(cp, fn=sn.dev, gr=sn.dev.gh, method="L-BFGS-B",
lower=c(-Inf, 1e-10, -0.99527),
upper=c( Inf, Inf, 0.99527),
control=control, X=X, y=y, hessian=FALSE)
The code has worked fine many times, but I have come across cases
(for suitable data X and y) where the constraint on the last component
is ignored; that means that a call is made to sn.dev with
cp = -1.3546 0.4645 3.1741
so the third component exceeds 0.99527, and the program stops
because of a check in the function to be obtimised.
The call just before was to the gradient function
sn.dev.gh: gradient = 219013 -312643 441647332
which has rather large values.
To make the problem more interesting, it shows up on a Linux
(Debian) installation, but it works fine on MS-windows.
In both cases, R is 1.7.0.
Perhaps this sort of question should not be directed to the R-help
list, rather to the developer(s) of optim. Please instruct me on this
point. Also, I appreciate that the above is not a reproducible example;
this would be longish in text, and I though to ask first to whom
it is appropriate that I direct my question.
Best wishes,
Adelchi Azzalini
--
Adelchi Azzalini <[EMAIL PROTECTED]>
Dipart.Scienze Statistiche, Università di Padova, Italia
http://azzalini.stat.unipd.it/
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help