23.07.2013 Views

Fitting Curves and Surfaces Using SAS Software - ISS - University of ...

Fitting Curves and Surfaces Using SAS Software - ISS - University of ...

Fitting Curves and Surfaces Using SAS Software - ISS - University of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Fitting</strong> <strong>Curves</strong> <strong>and</strong> <strong>Surfaces</strong> <strong>Using</strong> <strong>SAS</strong> <strong>S<strong>of</strong>tware</strong><br />

Version 1.1 (February 2007)<br />

(viii) Open the file loess3.sas. (The code is shown below).<br />

proc loess data=Results;<br />

by SmoothingParameter;<br />

ods output OutputStatistics=residout;<br />

model Residual=Year/smooth=0.3;<br />

run;<br />

(ix) Submit the program by pressing F8.<br />

The results are stored in the output data set residout.<br />

(x) Open the file loess3g.sas. (The program <strong>and</strong> the graphs produced are shown below).<br />

(xi) Submit the program by pressing F8. The program plots the results in the same fashion as before using<br />

PROC GREPLAY.<br />

axis1 label = (angle=90 rotate=0)<br />

order = (-0.8 to 0.8 by 0.4);<br />

goptions nodisplay;<br />

proc gplot data=residout;<br />

by SmoothingParameter;<br />

plot DepVar*Year<br />

Pred*Year/&opts vref=0 lv=2<br />

vm=1 name='resids';<br />

run;<br />

goptions display ;<br />

proc greplay n<strong>of</strong>s tc=sashelp.templt<br />

template=l2r2;<br />

igout gseg;<br />

treplay 1:resids 2:resids2<br />

3:resids1 4:resids3;<br />

run; quit;<br />

title;<br />

Residual plots for the four models<br />

An inspection <strong>of</strong> these plots suggests that a value <strong>of</strong> 0.2 for the smoothing parameter provides a good<br />

compromise between representing the general trend in the data <strong>and</strong> tracking the detailed fluctuations<br />

about that trend.<br />

If the observations are independently <strong>and</strong> identically distributed <strong>and</strong> follow the Normal distribution, we<br />

can obtain confidence limits for the model predictions by adding the clm option in the model<br />

statement. By default, 95% limits are produced, but this can be changed by using the alpha= option in<br />

the model statement.<br />

(xii) To complete this sequence, open the file loess4.sas.<br />

(xiii) This final step specifies alpha=0.1, causing 90% confidence limits to be included in the Results<br />

data set <strong>and</strong> produces the fitted curve with confidence limits superimposed. The program <strong>and</strong> the<br />

graph are shown below.<br />

Information Systems Services Page 12 <strong>of</strong> 22<br />

Version 1.1 (Feb 2007) tut125.doc

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!