How to prespecify several initial parameters with nonlinear fit

Reply
Contributor
Posts: 23

How to prespecify several initial parameters with nonlinear fit

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;

Respected Advisor
Posts: 2,655

Re: How to prespecify several initial parameters with nonlinear fit

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

Contributor
Posts: 23

Re: How to prespecify several initial parameters with nonlinear fit

Thanks Steven.  That should help.

Ask a Question
Discussion stats
  • 2 replies
  • 156 views
  • 0 likes
  • 2 in conversation