gretl 2024b. Windows 10 64-bit.
Is there a way to impose a non-negativity/positivity constraint on the gmm command for an estimated parameter when using the --lbfgs option?
I am trying to estimate variance(scale) parameters of a distribution. The theoretical moment condition is
qw^2 + qu^2 = (1/n)sum res^2
(sum of squared residuals estimates the population variance, which is the sum of two separate variances, so we need both qw>0, qu>0).
I wrote one of the two related orthogonality conditions as
series eq2 = (res2 - (sqrt(qw))^4 - (sqrt(qu))^4 ) *(1/obsn)
(obsn = n) .
Without the --lbfgs option, it appears that the positivity constraint imposed implicitly through the use of the square root, is respected.
But when I include the --lbfgs option in the gmm command, the
estimator does not seem to be bothered with the square root any
more; I get for example (with --lbfgs)
...
Iteration
2: GMM criterion = 1.45609463344 (steplength = 0.0197114)
Parameters: 0.26238 0.26007
Gradients: -0.87662 1.0848 (norm 5.06e-001)
Iteration 3: GMM criterion = 0.911545264969 (steplength = 13)
Parameters: 0.041548 0.51495
Gradients: -0.019980 1.4100 (norm 6.03e-001)
Iteration 4: GMM criterion = NA (steplength = 0.6875)
Parameters: -0.57965 1.3822
Gradients: -0.019980 1.4100 (norm 9.90e-001)
Iteration 5: GMM criterion = NA (steplength = 0.6875)
Parameters: -1.2008 2.2495
Gradients: -0.019980 1.4100 (norm 1.26e+000)
Iteration 6: GMM criterion = NA (steplength = 0.6875)
Parameters: -1.8220 3.1169
Gradients: -0.019980 1.4100 (norm 1.49e+000)
...
--- FINAL
VALUES:
GMM criterion = NA (steplength = 0.6875)
Parameters: -51.518 72.501
Gradients: -0.019980 1.4100 (norm 7.19e+000)
I detect that once one parameter becomes negative, the values of
the gradients do not change anymore, which may say something about
the inner workings of the gmm command with --lbfgs
--
A last-minute thought: in gretl's guide (in chapter 37 for
numerical methods) we read
<< The primary case for using L-BFGS-B, however, is constrained optimization: this algorithm supports constraints on the parameters in the form of minima and/or maxima. In gretl this is implemented by the function BFGScmax (‘c’ for constrained). The syntax is basically similar to that of BFGSmax, except that the first argument must followed by specification of a “bounds” matrix. >>
So, maybe, because when lbfgs is used as an option in gmm we do not specify this "bounds" matrix, this creates the issue?
But regardless, how can it happen that it takes a negative
number, puts it inside a square root, and doesn't at least abort
if not move away, but keeps on trying negative candidates?
-- Alecos Papadopoulos PhD Affiliate Researcher Dpt of Economics, Athens University of Economics and Business Foundation for Economic and Industrial Research (IOBE) web: alecospapadopoulos.wordpress.com/ ORCID:0000-0003-2441-4550