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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<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 />

1.2 Getting Started<br />

A variety <strong>of</strong> <strong>SAS</strong> programs <strong>and</strong> data sets will be used for these exercises. These files are stored in a zip file<br />

named sascurve.zip on the <strong>ISS</strong> website. Before starting, it is advised that you download the zip file to your<br />

hard disk. To download the file, open a web browser <strong>and</strong> go to<br />

http://iss.leeds.ac.uk/s<strong>of</strong>tware.<br />

Click on ‘PDF files (suitable for printing)’ <strong>and</strong> scroll down to ‘<strong>SAS</strong> example files’. Right-click on ‘sascurve.zip’.<br />

Select Save Link As… (Save Target As… in Internet Explorer). When the Save As dialog box appears,<br />

select a suitable directory (see below) <strong>and</strong> click Save. Go into Windows Explorer <strong>and</strong> double click the zip file.<br />

Click File/Extract All to unzip the files.<br />

A directory such as C:\courses\sas\graph is recommended as the location in which to save the data files. If<br />

you are working in a public cluster, you may find it necessary to use the Temp directory instead (eg use<br />

C:\temp\sas\graph). This is the path used in the example programs. If you store your files in a different<br />

directory, you will need to change the Filename <strong>and</strong> Libname statements used in the example files<br />

accordingly.<br />

To start <strong>SAS</strong>, locate <strong>SAS</strong> from the Statistics menu <strong>and</strong> double-click to open <strong>SAS</strong>. After a short period, the <strong>SAS</strong><br />

data editor window will be displayed.<br />

2. <strong>Using</strong> Interpolating Splines in <strong>SAS</strong>/GRAPH<br />

The INTERPOL= option (or I=) <strong>of</strong> the SYMBOL statement <strong>of</strong>fers a number <strong>of</strong> spline interpolation algorithms for<br />

smoothing data.<br />

The first method uses I=SPLINE, to fit a cubic spline with continuous second derivatives. The second method,<br />

I=SMnn, is more appropriate for noisy data <strong>and</strong> allows the degree <strong>of</strong> smoothing to be varied by specifying a<br />

parameter nn as a number in the range 0 to 99. Larger values <strong>of</strong> nn produce more smoothing. The methods<br />

are compared in the following example.<br />

Example 1: Comparison <strong>of</strong> Spline Interpolation Methods<br />

The effect <strong>of</strong> using SPLINE <strong>and</strong> SM with varying degrees <strong>of</strong> smoothing is illustrated in the graphs below. (The<br />

program to produce these graphs is in file splines.sas).<br />

Information Systems Services Page 4 <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!