/* set the graphics environment */ goptions reset=global gunit=pct border ftext=swissb htitle=6 htext=3; data computer; input city$ prop dollars; label prop ='Proportion likely to purchase' dollars = 'Hundreds of Dollars Spent'; cards; A 0.90 1.0 A 0.80 2.5 A 0.65 5.0 A 0.46 10.0 A 0.34 20.0 A 0.26 30.0 A 0.17 40.0 A 0.15 50.0 A 0.06 75.0 A 0.04 100.0 B 0.93 1.0 B 0.77 2.5 B 0.63 5.0 B 0.50 10.0 B 0.30 20.0 B 0.24 30.0 B 0.19 40.0 B 0.12 50.0 B 0.08 75.0 B 0.05 100.0 ; run; /* Fit the linear regression first to obtain initial estimates */ proc reg; model prop = dollars; run; proc model; prop = gamma0+gamma2*exp(-gamma1*dollars); fit prop start=(gamma0=0 gamma2=0.9922 gamma1=0.007864); run; proc nlin data=computer; model prop = gamma0+gamma2*exp(-gamma1*dollars); parms gamma0=0 gamma2=0.9922 gamma1=0.007864; der.gamma0 = 1; der.gamma2 = exp(-gamma1*dollars); der.gamma1 = -gamma1*gamma2*exp(-gamma1*dollars); output out=nout p=pred r=resid parms=gamma0 gamma1 gamma2; run; /* define symbol characteristics */ symbol1 interpol=none value=diamond height=3 cv=red ci=blue co=green width=2; symbol2 interpol=spline value=dot height=3 cv=blue ci=blue co=green width=2; symbol3 interpol=none value=dot height=3 cv=green ci=blue co=green width=2; data nout2; set nout; /*do newcon=1 to 40 by .1; do reactnew = (gam0*newcon)/(gam1+newcon); output; end; end; */ /* produce plot */ proc gplot data=nout2; plot prop*dollars pred*dollars/overlay; plot resid*dollars/vref=0 cvref=blue; plot resid*pred/vref=0 cvref=blue; run; proc gplot data=nout; plot pred*dollars; run; /*find the normal probability quantiles for the ratios*/ proc rank data=nout out=ranks; var resid ; ranks residrks; data n1; set ranks; r1=residrks/21; /*add one to sample size*/ z1=probit(r1); label z1='normal score for residuals'; proc gplot data=n1; title 'normal probability plot of residuals'; plot resid*z1; run;