Dear Allin,
It seems I am too stupid in  C:
I have made
libset_set_double(NLS_TOLER, 1.0e-5);
reconfigured ...
and nothing changed

By the way, such cases are very rare: about 10 in all ~300000
estimated on gretl sample data models
In all cases this gave convergence


if err
               if p > 0
                   mss = y - mean(y)
                   maxlag = 2*(p+q)
                   ols mss mss(-1 to -maxlag) -q
                   uh = $uhat
                   ols mss mss(-1 to -p) uh(-1) -q
                   matrix b0 = $coeff
                   #                 print p q
                   if nelem(b0) >= p
                       b1 = adj_armacoeff(b0[1:p],1.01,null,"ar")
                   else
                       b1 = adj_armacoeff(b0,1.01,null,"ar")|(0.0001*ones(p-nelem(b0),1))
                   endif
                   inits = shift|b1
                   if P  > 0
                       inits = inits|(0.0001*ones(P,1))
                   endif
                   if q == 1
                       if nelem(b0) > p
                           inits = inits|adj_armacoeff(b0[p+1],1.01,null,"ma")
                       else
                           inits = inits|0.0001
                       endif
                   endif
                   if Q > 0
                       inits = inits|(0.0001*ones(Q,1))
                   endif
                   return inits
               else
                   return (0.0001*ones(p+q+P+Q,1))
               endif
           endif

Here err > 9 if arima failed to compute initial values
p,q,/p,Q - arma parameters

adj_armacoeff() is from arima_sim.gfn
It make all roots to be outside the unit circle
The attachment contains all functions I used
(it depends on arima_sim)
Main functions are armainit10/11,
arma_robust2 ()
arma_robust2 was used in about 10 cases out of ~300000
when using shifting/scaling + armainit failed

Idea:
Increasing tolerance is a kind of penalizing lnl
so such models will not be selected
At the other hand they can be diagnosed as bad
by standard means and not by the fact of non-convergence
Oleh




24 листопада 2018, 23:05:58, від "Allin Cottrell" <cottrell@wfu.edu>:

On Sat, 24 Nov 2018, oleg_komashko@ukr.net wrote:

> Dear Allin,
> It seems while tolerance for Hannan - Rissanen
> was resetted, this is not so for models that
> require non-linear autoregression:
>
> open AWM.gdt --quiet
> logs TFT
> arima 3 0 0;1 0 0; TFT --verbose
> arima 3 0 0;1 0 0; l_TFT --verbose
>
> produces
>
> ? open AWM.gdt --quiet
> Read datafile /usr/local/share/gretl/data/misc/AWM.gdt
> ? logs TFT
> Warning: generated missing values
> ? arima 3 0 0;1 0 0; TFT --verbose
> NLS: failed to converge after 1204 iterations

We are in fact setting a sloppy tolerance when we use NLS in 
arma_init, since quite recently -- see arma_init.c, line 1401:

libset_set_double(NLS_TOLER, 1.0e-5);

That can be compared with the default, namely pow(DBL_EPSILON, .75), 
which is about 1.82e-12.

Perhaps it should be sloppier still. But gretl is open source, no 
need to guess what we're doing or not doing!

Allin