Turn on suggestions

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

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- proc nlin how to determine the initial parameters

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 06-18-2018 04:13 AM
(2752 views)

```
%let a= 54.8829483019154;
%let b= 61.8215366579612 ;
%let c= 8.4693242460909 ;
proc nlin
data=TXPTE_GENEALL method= MARQUARDT MAXITER=500;
parms a=&a b=&b c=&c ;
model GENEALL = 1 / (a + ((TRIM-b)/c)**2);
output out= MODEL_GENERALISTE_CTX
predicted= ESTIM_GENEALL
parms= A B C;
run;
```

Hello,

I have a dataset "TXPTE_GENEALL" that holds 32 values.

by lauching the this proc nlin, the problem I encounter is tha the ESTIM_GENEALL column get only one value for each observations.

and the message is below:

WARNING: Step size shows no improvement.

WARNING: PROC NLIN failed to converge.

NOTE: Negative model SS. Check model and initial parameters.

I Wonder how to determine the correct values a, b, c.

thanks a lot in advance for your help

Nasser

1 ACCEPTED SOLUTION

Accepted Solutions

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

I don't know. Your initial post says that the procedure does not converge. Usually that means that either

1. The model does not fit the data, or

2. The model does not converge from the initial guess that you specified.

You can specify a grid of initial values if you think the model fits, but that it doesn't converge from the initial values &a, &b, and &c. See the doc for the PARMS statement. For example, you could try

PARMS a=25, 50, 100

b=20 to 100 by 20

c = 5 to 12;

I assume you've plotted the response against TRIM to see that your model is reasonable?

9 REPLIES 9

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

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

You need to check the documentation and review the correct syntax for the MODEL statement. That syntax is invalid. Look at the examples, too. Perhaps you intended to say something like

LL = 1 / (a + ((TRIM-b)/c)**2);

MODEL GENEALL ~ general(LL);

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

Thanks Rick for your quick response

I checked the documentation (your link) but i do not manage to find the correct syntax.

I took a look at the "Iteratively Reweighted Least Squares" paragraph.

and the syntax you suggested does not seem to work .

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

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

don't worry about that. I noticed it. I think my syntax is correct because it works with another set of data.

my input dataset gets one column (a rate %) and there are obs. What I don not understand is why the "

ESTIM_GENEALL" column in the output table has the same value for all obs.

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

The following call to PROC NLIN uses your syntax on simulated data and gets non-constant predicted values. Therefore the problem you report is not because of the procedure. The most likely cause, therefore, is your data. This problem would occur if the parameter estimate for 'a' is huge or if TRIM is equal to 'b' or is very very close to 'b' for all observations.

```
%let a= 54.8829483019154;
%let b= 61.8215366579612 ;
%let c= 8.4693242460909 ;
data TXPTE_GENEALL;
do i = 1 to 200;
TRIM = rand("Normal", &b, &c);
GENEALL = 1 / (&a + ((TRIM-&b)/&c)**2) + 0.1*rand("Normal");
output;
end;
run;
proc nlin
data=TXPTE_GENEALL method= MARQUARDT MAXITER=500;
parms a=&a b=&b c=&c ;
model GENEALL = 1 / (a + ((TRIM-b)/c)**2);
output out= MODEL_GENERALISTE_CTX
predicted= ESTIM_GENEALL
parms= A B C;
run;
/* visualize the predicted values */
proc sort data=MODEL_GENERALISTE_CTX; by TRIM; run;
proc sgplot data=MODEL_GENERALISTE_CTX;
series x=TRIM y=ESTIM_GENEALL;
run;
```

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

Thanks Rick.

sorry but I do not understand.

the rates values are like this below

**data** TXPTE_GENEALL;

input geneall **12.**;

datalines;

0.0133904

0.0132869

0.0121815

0.0110640

0.0118499

...

and trim (that means quarters from year 2010 SEPT to 2017 DEC) so trim values are 1,2,3,4...31,32. so trim not close to b parameter wich is equal to 61.8215366579612.

do you mean I should change the b value ?

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

I don't know. Your initial post says that the procedure does not converge. Usually that means that either

1. The model does not fit the data, or

2. The model does not converge from the initial guess that you specified.

You can specify a grid of initial values if you think the model fits, but that it doesn't converge from the initial values &a, &b, and &c. See the doc for the PARMS statement. For example, you could try

PARMS a=25, 50, 100

b=20 to 100 by 20

c = 5 to 12;

I assume you've plotted the response against TRIM to see that your model is reasonable?

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

thanks a lot Rick

it works. I don't have the message "PROC NLIN failed to converge" anymore but "Convergence criterion met"

I Wonder why you suggeses this grid values ?

I assume it is because my initials values were around a=55, b=62 and c=8, , exact ?

thanks

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.