BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nasser_DRMCP
Lapis Lazuli | Level 10

 

%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
Rick_SAS
SAS Super FREQ

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?

View solution in original post

9 REPLIES 9
Nasser_DRMCP
Lapis Lazuli | Level 10

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

Rick_SAS
SAS Super FREQ

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);

Nasser_DRMCP
Lapis Lazuli | Level 10

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 .

Rick_SAS
SAS Super FREQ

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

Nasser_DRMCP
Lapis Lazuli | Level 10

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.

 

Rick_SAS
SAS Super FREQ

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;
Nasser_DRMCP
Lapis Lazuli | Level 10

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 ?

Rick_SAS
SAS Super FREQ

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?

Nasser_DRMCP
Lapis Lazuli | Level 10

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

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Discussion stats
  • 9 replies
  • 2347 views
  • 2 likes
  • 2 in conversation