Position of _max_MaxIters

Dear all,

If I write the code like this:


_max_Options = { bfgs stepbt };
_max_CovPar = 1;
_max_active = ones(L + P + 1,1)|1;
{x,f,g,cov,retcode} = maxprt(maxlik(dataset,0,&lpr,b));
clearg _max_gradproc;
b1 = x[1]|exp(x[2:L+1])|exp(x[L+2:L+P+1])|(exp(x[L+P+2]));
_max_MaxIters=0;

I get a "Hessian calculation failed"

If I write the code like this:

_max_Options = { bfgs stepbt };
_max_CovPar = 1;
_max_active = ones(L + P + 1,1)|1;
_max_MaxIters=0;
{x,f,g,cov,retcode} = maxprt(maxlik(dataset,0,&lpr,b));
clearg _max_gradproc;
b1 = x[1]|exp(x[2:L+1])|exp(x[L+2:L+P+1])|(exp(x[L+P+2]));

I get results that may be correct.

What is the adequate position of the "_max_MaxIters=0;"?????

Thanks!

1 Answer



0



Statements in your command file are executed in order.  By placing _max_MaxIters after the call to Maxlik, it will have no effect on the iterations.  By placing it before the call to Maxlik you are causing Maxlik not to iterate but rather to go directly to computing the covariance matrix of the parameters at the starting point.

In your first instance, Maxlik went into the iterations with the default _max_MaxIters (1e5).   You have not indicated what the retcode was so I don't know what kind of convergence occurred, but the Hessian failed to be calculated.  Most likely this happens when the log-likelihood function produces a NAN or a missing value in its calculations.

In your second instance, Maxlik didn't perform any iterations but went directly to computing the covariance matrix at the starting values which apparently succeeded.   Without iterations, though, Maxlik cannot determine whether the starting point is maximum likelihood.

Your Answer

1 Answer

0

Statements in your command file are executed in order.  By placing _max_MaxIters after the call to Maxlik, it will have no effect on the iterations.  By placing it before the call to Maxlik you are causing Maxlik not to iterate but rather to go directly to computing the covariance matrix of the parameters at the starting point.

In your first instance, Maxlik went into the iterations with the default _max_MaxIters (1e5).   You have not indicated what the retcode was so I don't know what kind of convergence occurred, but the Hessian failed to be calculated.  Most likely this happens when the log-likelihood function produces a NAN or a missing value in its calculations.

In your second instance, Maxlik didn't perform any iterations but went directly to computing the covariance matrix at the starting values which apparently succeeded.   Without iterations, though, Maxlik cannot determine whether the starting point is maximum likelihood.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.