Hi Marcin, thanks. It is a good thing that gretl's functionality has so much expanded that one cannot really remember  (or encounter) the whole of it.

I tried both approaches (for a single unknown). The non-linear function had the unknown in several places at the same time, either exponentiated, or as an exponent itself, or in logs, or in the denominator.

REPORT

1. Run both methods 10,000 times on the same data (two series ranging in (0,1)).

2. When they both succeed for the same data (see next for when they don't), they provide identical results (max abs difference 1.8256e-007).

3. fzero issues:  with the fzero function (where i provided only a single 0.01 initial value), the limitation I see is that we cannot constraint the value of the argmin (and I need it to be in (0,1) for example). But still, in 10,000 attempts it provided an inadmissible solution only for a few dozen cases (these were the cases were the BFGScmin approach gave a solution below the initial value provided for the fzero setup). It also appears that this initial value for fzero cannot be very small because I get "the convergence criterion is not met" and the loop stops (e.g. this happened when I tried to set it equal to 0.001 instead of 0.01).

4. With the BFGScmin (with the (0,1) constraint in place and bfgs_richardson "on"), for some 1.5% of the cases I got an obvious failure in that the solution was admissible, but the value of the objective function was away from zero. In all these cases the solution given was the maximum permissible value, 1. Note that these observations for which BFGScmin failed, are totally different from those that fzero provided an inadmissible solution.

So, in all 10,000 cases, one method or the other gave a valid result, and in 98% both succeeded.

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
On 17/11/2024 12:32, Marcin Błażejowski wrote:
On 17.11.2024 11:19, Alecos Papadopoulos wrote:
To the best of my knowledge, we do not have in gretl a direct root-finder for a non-linear equation (apart from "polroots" for polynomials) , say

f(x,a) - b = 0

with function f continuous / non-linear, a,b given and with task to find x. Assume that there indeed exists a unique solution x*.

I thought I'd trick the system by specifying

h(x,a,b) = [f(x,a) - b]^2

and ask the BFGScmin function to minimize h(x,a,b) (with numerical derivatives).

Mathematically this looks sound, but is there something that lurks in the software/computational basement?

Well, there is a fzero() function, thought it works with only one variable.

Marcin
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave@gretlml.univpm.it
Website: https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/