BookmarkSubscribeRSS Feed
bjbreitling
Calcite | Level 5

I have several plots with confidence intervals that I would like to plot with sg plot.  My issue is that the intial parameters I provide do not allow for very good fits for some of the curves that I would like to fit.  I would like to provide different inital conditions for the different curves but the code I found on the web didn't work.  Below is the SAS code I'm using:

DATA zein;

   INPUT X Y Zein $;

   DATALINES;

0.400091049 78 F4000

...

;

ods graphics on;

data test;

      input Parameter Estimate Zein;

      datalines;

a -3.40 LF0817

b .0000000000595 LF0817

c -31.3 LF0817

d 3451.4 LF0817

f 11.44 LF0817

a -26.9 2323

b .0004 2323

c -13.8 2323

d 1612.8 2323

f 7.06 2323

a -31.4 1223

b .02576 1223

c -8.90 1223

d 1544 1223

f 6.94 1223

a 575.6 F4000

b -492689 F4000

c -2 F4000

d 492362.7 F4000

f -2 F4000

;

proc nlin data=zein outest=est plots(stats=all)=(diagnostics);

parameters

a=575.6

b=-492689

c=-2

d=492362.7

f=-2

;

model Y = a+b*exp(-c*X)+d*exp(-f*X);

BY Zein;

*/ContourFitPlot;

output out=b L95=low U95= up predicted=yp;

run;

proc sgplot data=b ;

yaxis label='Observed or Predicted';

*/By Zein;

scatter y=Y x=X / group=Zein;

*/band x=X upper=up lower=low;

series y=low x=X / group=Zein curvelabel;

series y=up x=X / group=Zein;

*/series y=yp x=X / group=Zein;

*/series y=yp x=X;

run;

ods graphics off;

2 REPLIES 2
SteveDenham
Jade | Level 19

This model and these parameters look like a train wreck about to happen.  With those initial parameters, the two exponential terms essentially cancel one another, and unless you have a lot of data, that negative correlation is going to dominate everything.  Some things to consider:  Scale X carefully.  Try a grid search for starting values, such as:

parms a=0 to 1000 by 200

          b= -5 to 5 by 1

          c= -2 to 2 by 1

          d= -5 to 5 by 1

          e= -2 to 2 by 1;

Now that still involves over 15,000 initial fits before the model ever starts to be fit iteratively.

What I see as the problem is that the two pool model you have here is almost certainly overspecified for the data (and that's coming from the king of overspecifying models)..

Steve Denham

bjbreitling
Calcite | Level 5

Thanks Steven.  That should help.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 364 views
  • 0 likes
  • 2 in conversation