Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-22-2019 10:51 AM
(816 views)

Hi. I'm calling nlptr in IML after having run a grid search for initial values to give to nlptr. The grid search is good so that it's often the case that nlptr can't improve on the initial values. In these cases, I don't want to have :

ERROR: TRUREG Optimization cannot be completed.

WARNING: Optimization routine cannot improve the function value.

printed to the log. It's not an error. This is part of a big program used by many people in our organization so I can't just say "Turn your notes off."

- Tags:
- iml
- nlptr
- Return Code

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

8 REPLIES 8

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I do not think there is a way in SAS to suppress ERROR messages.

Some programmers use PROC PRINTTO to redirect the SAS log to a file, filter it (eg, remove the ERROR and WARNING messages that you want to ignore, and then display the log. Some programmers have even developed macros that automate this task. Here's one that I found with a quick search:

https://www.lexjansen.com/nesug/nesug04/ap/ap09.pdf

I have not used these macros myself, so I cannot vouch for them.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks Rick. Hmmm...strange that it was developed this way as I guess this is a common frustration.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If your initial guess is the exact optimal solution, I do not think you will get an error message.If you can provide an example, where you get an ERROR when your guess is the exact solution, I would like to see it.

In my experience, that error message often indicates lack of convergence because the objective function is flat near the optimal solution. This often happens in MLE computations when the data set is small or doesn't fit the proposed model. The error could mean that the algorithm cannot improve the current position because the objective function is flat.

To demonstrate what I mean by "flat", here is an example of a one-dimensional flat function: f(x) = exp(-|x - 1/2|^10);

Most algorithms will stop before they converge to the optimal value at x=1/2. Here is a graph of the function:

```
data Flat;
do x = 0 to 1 by 0.01;
y = exp(-abs(x-0.5)**10);
output;
end;
run;
proc sgplot data=Flat;
series x=x y=y;
run;
```

There is an easy way to determine if you are correct: add a small random jitter to your initial guesses, such as

x0 = x0 + randfun(1||ncol(x0), "Normal", 0, 0.1);

If you still get the error message, then you are experiencing a convergence problem. If the error message goes away, then please provide a reproducible example so I can study it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Perhaps I wasn't clear. When the function is extremely flat, it is difficult for any algorithm to find the exact value of the mathematical extremum. I did not provide an algorithm for finding the maximum, I provided a way for you to examine whether the error you are seeing is because your initial guess is already at the maximum (as you claim) or because the algorithm cannot make further progress (as I claim).

In practical terms, this might not matter, since parameters for which the objective function give 0.99999 are often just as useful as parameters for which the objective function is 1.00000.

Since you have not posted your code or your data, I am merely guessing. There are dozens of issues that can arise in optimization that can lead to non-convergence. If you would like additional assistance, please post your code and data.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.