turn on suggestions

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

Showing results for

Find a Community

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

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

a month ago

```
%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

Accepted Solutions

Solution

a month ago

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Nasser_alfea

a month ago

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?

All Replies

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Nasser_alfea

a month ago

I succeed to determine the starting values but I don't know how many values should be contained inside the input table

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Nasser_alfea

a month ago

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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

a month ago

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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Nasser_alfea

a month ago

I'm sorry. My mistake. I gave you the link and syntax for PROC NLMIXED instead of NLIN. My apologies.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

a month ago

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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Nasser_alfea

a month ago

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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

a month ago

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 ?

Solution

a month ago

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Nasser_alfea

a month ago

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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

a month ago

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