# How to make the Lmaxalgr option automatic

User ForumHow to make the Lmaxalgr option automatic

Hi All,

Some time during maximum likelihood estimation, the gauss will pop up a option named "Lmaxalgr" and asks user to select an algorithm from the list to continue the estimation. Is there some way to make this automatic, such that if for some reason the estimation gets stuck, gauss knows internally that it needs to apply certain algorithm.

I am providing a screen shot of the problem discussed above for convenience.

Lmaxalgr = 2

= 1, steepest descent
= 2, BFGS
= 3, DFP
= 4, Newton-Raphson
= 5, BHHH
= 6, PRCG
= 7, scaled BFGS
= 8, scaled DFP

Enter new value:

So basically, at enter the value option, we need to manually enter the number.

You can specify the algorithm to switch to with the control variable _max_Switch. Here is the documentation for it:

```_max_Switch 4 × 1 or 4 × 2 vector, controls algorithm switching. If
4 × 1, set its elements in the following way,
max Switch is
1 , algorithm number to switch to
2 , FASTMAX will switch to algorithm in the first element when the
function value is less than the value entered here
3 FASTMAX switches if the number of iterations exceeds the
number entered here
4 FASTMAX switches if line search step changes less than the
amount entered here
If max Switch is 4 × 2, FASTMAX switches between the algorithms in
column 1 and column 2 subject to the conditions specified for the 4 × 1
vector.
Thus if max Switch is a 4 × 1 vector, FASTMAX will switch
algorithms no more than once during the iterations, whereas if it is 4 × 2
it may switch back and forth between the two algorithms throughout the
iterations.
```

Thanks a lot. I was going through gauss source files yesterday and came across this as well. However, i do have one last question. What are the default values which gauss uses for row number 2,3 and 4?.

I believe row 3 should not be a problem (we can set some high number).

I tried searching for default values in gauss source files, but no luck so far. Any help is appreciated. In case you find them, please mention the file name as well.

I searched around a bit in the code. The default value can be found in the file maxlik.dec. It is also assigned to in the maxset function which resets all the Maxlik control variables to defaults--that is in maxlik.src.

After looking around in the code, it looks like _max_Switch is not set automatically to anything other than a missing value. I found _max_Switch being passed into some internal Maxlik functions. It was passed to _max. Inside of _max the variable is called Lmaxswch. Whenever I saw it referenced it was always inside a block surrounded with:

```if not scalmiss(Lmaxswch);
.
.
.
endif;
```

I couldn't find it assigned to or referenced otherwise. Though if you follow Lmaxswch you may find more than I did.

• ### Aptech Systems, Inc. Worldwide Headquarters

Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286

Phone: 360.886.7100
FAX: 360.886.8922

• ### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

• ### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

• ### Have a Specific Question?

Get a real answer from a real person

• Need Support?
• ### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

• ### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!