Resources

OLS Single Nonlinear Equation

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: modex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The MODEL Procedure
       Title: OLS Single Nonlinear Equation
     Product: SAS/ETS Software
        Keys: nonlinear simultaneous equation models
        PROC: MODEL
       Notes:

--------------------------------------------------------------*/

title 'Logistic Growth Curve Model of U.S. Population';
data uspop;
   input pop :6.3 @@;
   retain year 1780;
   year=year+10;
   label pop='U.S. Population in Millions';
   datalines;
3929  5308  7239   9638  12866  17069  23191  31443  39818 50155
62947 75994 91972 105710 122775 131669 151325 179323 203211
226542 248710
;

proc model data=uspop;
   label a = 'Maximum Population'
         b = 'Location Parameter'
         c = 'Initial Growth Rate';
   pop = a / ( 1 + exp( b - c * (year-1790) ) );
   fit pop start=(a 1000  b 5.5  c .02) / out=resid outresid;
run;

title2 "Residuals Plot";
proc sgplot data=resid;
   refline 0;
   scatter x=year y=pop / markerattrs=(symbol=circlefilled);
   xaxis values=(1780 to 2000 by 20);
run;