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 ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Information Systems Services<br />
<strong>Fitting</strong> <strong>Curves</strong> <strong>and</strong> <strong>Surfaces</strong> <strong>Using</strong><br />
<strong>SAS</strong> <strong>S<strong>of</strong>tware</strong><br />
TUT125<br />
Version 1.1 (February 2007)
<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 />
Contents<br />
1. Introduction ............................................................................................................................................ 3<br />
1.1 Documentation ........................................................................................................................... 3<br />
1.2 Getting Started ........................................................................................................................... 4<br />
2. <strong>Using</strong> Interpolating Splines in <strong>SAS</strong>/GRAPH ........................................................................................... 4<br />
3. <strong>SAS</strong>/STAT Modelling Procedures .......................................................................................................... 5<br />
3.1 Parametric Modelling using REG <strong>and</strong> NLIN ............................................................................... 6<br />
3.2 Non-Parametric Modelling using Loess Smoothing .................................................................. 10<br />
3.3 Semi-Parametric Modelling using Thin-Plate Splines ............................................................... 13<br />
3.4 Generalised Additive Models ................................................................................................... 17<br />
References ..................................................................................................................................................... 19<br />
Annex ............................................................................................................................................................. 20<br />
Format Conventions<br />
In this document the following format conventions are used:<br />
Menu items <strong>and</strong> comm<strong>and</strong>s that you must type Name<br />
in are shown in bold<br />
Keys that you press <strong>and</strong> options that you or <br />
select are enclosed in angle brackets.<br />
Feedback<br />
If you notice any mistakes in this document please contact the Information Officer. Email should be<br />
sent to the address info-<strong>of</strong>ficer@leeds.ac.uk<br />
Copyright<br />
This document is copyright <strong>University</strong> <strong>of</strong> Leeds. Permission to use material in this document should be<br />
obtained from the Information Officer (email should be sent to the address info-<strong>of</strong>ficer@leeds.ac.uk)<br />
Information Systems Services Page 2 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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. Introduction<br />
In studies involving continuous valued variables, a common requirement is the ability to predict the value <strong>of</strong><br />
one variable given the value <strong>of</strong> another variable. As a first step, the relationship between a pair <strong>of</strong> variables<br />
can be examined using a scatter plot. It may be sufficient to obtain a visual impression <strong>of</strong> the relationship<br />
between the variables by smoothing the data - for example, by using a smoothing spline, specified on a<br />
SYMBOL statement. Alternatively, it may be required, to obtain a deeper underst<strong>and</strong>ing about how changes in<br />
one variable (referred to as the independent or explanatory variable) influence values <strong>of</strong> another variable,<br />
referred to as the dependent variable. For values <strong>of</strong> the independent variable within the range <strong>of</strong> the current<br />
data, this is referred to as interpolation. For values <strong>of</strong> the independent variable outside the range <strong>of</strong> the current<br />
data, the problem is referred to as extrapolation.<br />
Whilst the use <strong>of</strong> the SYMBOL spline facility may be adequate for visual interpolation, it does not provide<br />
numerical representations <strong>of</strong> interpolated values <strong>and</strong> cannot be relied upon for extrapolation. Consider the two<br />
graphs below.<br />
Both curves appear to fit the data equally well. In the first graph, y increases exponentially as x increases – in<br />
the second graph y tails <strong>of</strong>f asymptotically as x increases. Which curve represents ‘the best fit’? The answer is,<br />
<strong>of</strong> course, that there is no such thing as an absolute best fit. This demonstrates an idea central to curve fitting<br />
– that an underst<strong>and</strong>ing <strong>of</strong> the nature <strong>of</strong> the variables is essential if meaningful predictions are to be made. If it<br />
is known that y settles down to a finite value as x increases, a functional form expressing that relationship is<br />
essential if extrapolations are to be made. Thus, an alternative to the simple smoothing approach is the<br />
modelling approach in which a mathematical function, based upon knowledge <strong>of</strong> the data, is sought to<br />
describe the relationship between the two variables.<br />
This document looks at a range <strong>of</strong> methods available in <strong>SAS</strong> for smoothing <strong>and</strong> modelling data. A familiarity<br />
with the basics <strong>of</strong> <strong>SAS</strong>/GRAPH is assumed.<br />
1.1 Documentation<br />
The main reference documentation for the facilities described in this document are as follows:<br />
• <strong>SAS</strong>/GRAPH Reference Manual Vols. 1 & 2<br />
• <strong>SAS</strong>/STAT Reference Manual Vols. 1 & 2<br />
The Reference Manuals are also available in the on-line Help system.<br />
The <strong>SAS</strong> Sample Library, accessible from within a <strong>SAS</strong> session, also contains the numerous examples found<br />
in the above volumes.<br />
Information Systems Services Page 3 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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
<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 />
For this data set, a value <strong>of</strong> nn <strong>of</strong> about 30 or less gives a result from using SMnn equivalent to that obtained<br />
from using the SPLINE method.<br />
3. <strong>SAS</strong>/STAT Modelling Procedures<br />
<strong>SAS</strong>/STAT has a number <strong>of</strong> procedures that can be used for curve fitting. Some use a purely modelling<br />
approach, others adopt the smoothing approach <strong>and</strong> one is a hybrid method using a mixture <strong>of</strong> modelling <strong>and</strong><br />
smoothing. Amongst the procedures currently available, the following are the ones most useful for curve fitting:<br />
PROC REG - multiple linear regression modelling<br />
PROC NLIN - non-linear regression modelling<br />
PROC LOESS - median smoothing<br />
PROC TPSPLINE - thin-plate spline smoothing<br />
PROC GAM - generalised additive modelling<br />
The REG procedure is a general-purpose procedure for multiple linear regression <strong>and</strong> is the simplest <strong>of</strong> all<br />
these procedures to use. It is appropriate when a functional form, linear in the parameters, can be specified for<br />
the model.<br />
The NLIN procedure fits models which are non-linear in the parameters. NLIN requires more information to be<br />
specified than REG, including initial estimates <strong>of</strong> parameter values <strong>and</strong> mathematical expressions for the<br />
functional form <strong>and</strong> its derivatives with respect to each parameter. In some cases, NLIN may fail to produce a<br />
globally optimal solution. Repeated alterations to the starting values may be required before a successful fit<br />
can be achieved.<br />
The table below contains some functions commonly used for curve fitting. Some <strong>of</strong> these will be used in the<br />
examples that follow to illustrate the different procedures <strong>and</strong> to indicate some <strong>of</strong> the pitfalls that can arise in<br />
fitting curves to data.<br />
Some Functions Commonly Used in Curve <strong>Fitting</strong><br />
Description Functional form<br />
Straight line Y = β0 + β1X<br />
Polynomial Y = β0 + β1X + β2X 2 + … βkX k<br />
Exponential Y = β0 e β 1 X<br />
Negative exponential Y = β0(1 – e -β 1 X )<br />
Logistic Y = β2/(1 + e -(β 0 + β 1 X) )<br />
Inverse linear polynomial Y = 1/(β0 + β1/X)<br />
Information Systems Services Page 5 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
Inverse quadratic polynomial Y= 1/( β0 + β1/X + β2X)<br />
Both REG <strong>and</strong> NLIN are useful when you know the functional form <strong>of</strong> the model you want to fit. However,<br />
when you have no prior knowledge about the model, or when you know that the data cannot be represented<br />
by a model with a fixed number <strong>of</strong> parameters, two other procedures can be used – LOESS <strong>and</strong> TPSPLINE.<br />
PROC LOESS uses a non-parametric method called Loess Smoothing for estimating regression surfaces.<br />
This approach makes no assumptions about the parametric form <strong>of</strong> the regression surface <strong>and</strong> as a result<br />
<strong>of</strong>fers greater flexibility for model fitting. In particular, the LOESS procedure is suitable when there are outliers<br />
in the data <strong>and</strong> a robust fitting method is necessary.<br />
The TPSPLINE procedure uses a method called penalised least squares to fit non-parametric <strong>and</strong> semiparametric<br />
models. TPSPLINE uses thin-plate smoothing splines to approximate smooth multivariate functions<br />
observed with noise. The degree <strong>of</strong> smoothing can be controlled using the generalised cross validation<br />
function (GCV).<br />
The GAM procedure fits Generalised Additive Models as defined by Hastie <strong>and</strong> Tibshirani (1990). These<br />
models are extensions <strong>of</strong> the generalised linear model, allowing functions to take the place <strong>of</strong> individual<br />
explanatory variables in the model.<br />
A full description <strong>of</strong> these procedures is beyond the scope <strong>of</strong> this text. The user is referred to the <strong>SAS</strong>/STAT<br />
User Guide (available within the online Help system within <strong>SAS</strong>) for details. The examples below illustrate their<br />
use on the sample data sets described in the Annex.<br />
3.1 Parametric Modelling using REG <strong>and</strong> NLIN<br />
Example 2: A Comparison <strong>of</strong> REG, NLIN <strong>and</strong> I=SPLINE<br />
PROC REG <strong>and</strong> PROC NLIN are the main procedures for curve fitting when a functional form for a suitable<br />
curve can be found. This example shows how to use both REG <strong>and</strong> NLIN <strong>and</strong> compares a variety <strong>of</strong> curves<br />
fitted to the same data.<br />
(i) Open the file curve.sas. The program, shown below, creates a small data set used for the example.<br />
data curve1;<br />
input x y @@;<br />
xsq=x*x;<br />
datalines;<br />
0.3 0.2 0.5 0.33 1.0 0.5 1.5 0.6 2.0 0.67 2.5 0.72 3.0 0.75 4.0 0.8<br />
5.0 0.85 6.0 0.87 7.0 0.89 8.0 0.9 9.0 0.91 12.0 0.92 13.0 . 14.0 . 15.0 .<br />
;<br />
run;<br />
(ii) Submit the program by pressing F8.<br />
The last three observations are included with missing values for Y. It will be instructive to see how well<br />
each model performs in estimating values <strong>of</strong> Y for these observations.<br />
A very simple approach would be to use the SYMBOL statement to fit a simple polynomial to the data.<br />
(iii) Open the file splineq.sas. This program uses I=RQ to fit a quadratic to the data.<br />
(iv) Submit the program by pressing F8. The results should correspond to the display shown below.<br />
Information Systems Services Page 6 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
title ‘Quadratic using SYMBOL<br />
I=RQ’;<br />
proc gplot;<br />
plot y*x y*x/overlay;<br />
symbol1 v=star c=blue I=none;<br />
symbol2 v=none c=red I=RQ;<br />
run;<br />
A better way to fit polynomials is to use PROC REG. Note that the data step above created a variable<br />
called XSQ as the square <strong>of</strong> X. The next solution uses PROC REG to fit a quadratic polynomial to the<br />
data.<br />
(v) Open the file regq.sas.<br />
(vi) Submit the program by pressing F8.<br />
The model statement includes both X <strong>and</strong> XSQ in the model. The fitted values estimated by the model<br />
are saved in an output data set fitquad specified on the OUTPUT statement. The fitted values are<br />
stored in a variable yfit. PROC GPLOT takes the output data set saved by PROC REG, which contains<br />
both the original data values <strong>and</strong> the fitted values, <strong>and</strong> plots the raw data points <strong>and</strong> the fitted values<br />
overlaid. Note that since the fitted values already lie on a smooth curve, the use <strong>of</strong> I=SPLINE merely<br />
serves to deliver a curve connecting the fitted values <strong>and</strong> does not contribute any further smoothing.<br />
proc reg data=curve1;<br />
model y=x xsq;<br />
output out=fitquad p=yfit r=resid;<br />
run;<br />
title ‘Quadratic using PROC REG’;<br />
proc gplot data=fitquad;<br />
plot y*x yfit*x/overlay;<br />
symbol1 v=star c=blue I=none;<br />
symbol2 v=none c=red I=spline;<br />
run;<br />
Both <strong>of</strong> these examples show the limitations <strong>of</strong> using polynomials. Although they may <strong>of</strong>fer a<br />
reasonable approximation to the shape <strong>of</strong> data, they may be useless for prediction beyond the range <strong>of</strong><br />
the data or for interpolation within the range <strong>of</strong> the data.<br />
The next two solutions use PROC NLIN to fit non-linear functions. Both functions have been chosen to<br />
model the behaviour <strong>of</strong> the data at extreme values <strong>of</strong> X, something which a polynomial is unable to do<br />
with this data.<br />
PROC NLIN requires the form <strong>of</strong> the curve to be fitted to be specified as a mathematical equation using<br />
a model statement. The derivatives <strong>of</strong> the curve with respect to each parameter must also be<br />
specified. Initial guesses at the values <strong>of</strong> the parameters must be specified using a parms statement.<br />
Single or multiple values may be specified.<br />
Information Systems Services Page 7 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
(vii) Open the file negexp.sas. This program fits a negative exponential (see the table above for a<br />
description <strong>of</strong> the functional form <strong>of</strong> this, <strong>and</strong> other curves).<br />
(viii) Submit the program by pressing F8. The program <strong>and</strong> resulting fit are shown below.<br />
Information Systems Services Page 8 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
proc nlin data=curve1;<br />
parms b0=1 b1=0.2 to 0.4 by 0.1;<br />
model y=b0*(1-exp(-b1*x));<br />
der.b0=1-exp(-b1*x);<br />
der.b1=b0*x*exp(-b1*x);<br />
output out=fitexp p=yfit r=resid;<br />
run;<br />
title ‘Negative Exponential using PROC<br />
NLIN’;<br />
proc gplot data=fitexp;<br />
plot y*x yfit*x/overlay;<br />
symbol1 v=star c=blue I=none;<br />
symbol2 v=none c=red I=spline;<br />
run;<br />
The fitted values are saved in the data set fitexp <strong>and</strong> plotted using the technique described in the<br />
previous example.<br />
(ix) Open the file invpoly.sas. This program fits an inverse polynomial to the data.<br />
Inverse polynomials are an under-used class <strong>of</strong> functions that are highly suited to small data sets by<br />
virtue <strong>of</strong> their having very few parameters.<br />
(x) Submit the program by pressing F8. The program <strong>and</strong> resulting fit are shown below.<br />
proc nlin data=curve1;<br />
parms b0=1 b1=1;<br />
model y=1/(b0+b1/x);<br />
der.b0 = -1/((b0+b1/x)**2);<br />
der.b1 = -1/(x*((b0+b1/x)**2));<br />
output out=fitinvp p=yfit r=resid;<br />
run;<br />
title ‘Inverse Polynomial using PROC<br />
NLIN’;<br />
proc gplot data=fitinvp;<br />
plot y*x yfit*x/overlay;<br />
symbol1 v=star c=blue I=none;<br />
symbol2 v=none c=red I=spline;<br />
run;<br />
The fitted values are saved in the data set fitinvp. The fit is an improvement upon the negative<br />
exponential. In fact, the data has been generated to conform to an inverse polynomial for the purpose<br />
<strong>of</strong> illustration. However, this does not detract from the message that consideration <strong>of</strong> the nature <strong>of</strong> the<br />
data is essential in guiding the user to an appropriate choice <strong>of</strong> model.<br />
Information Systems Services Page 9 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
3.2 Non-Parametric Modelling using Loess Smoothing<br />
The technique <strong>of</strong> locally weighted scatterplot smoothing, or Loess (alt. Lowess), was originally proposed by<br />
Clevel<strong>and</strong> (1979) <strong>and</strong> further developed by Clevel<strong>and</strong> <strong>and</strong> Devlin (1988). Loess smoothing uses weighted<br />
least squares to fit linear or quadratic functions <strong>of</strong> the explanatory variables at the centres <strong>of</strong> neighbourhoods.<br />
The radius <strong>of</strong> each neighbourhood is chosen so that the neighbourhood contains a specified percentage <strong>of</strong> the<br />
data points. The fraction <strong>of</strong> the data in each local neighbourhood, referred to as the smoothing parameter,<br />
controls the smoothness <strong>of</strong> the estimated surface. Data points in a given local neighbourhood are weighted by<br />
a smooth decreasing function <strong>of</strong> their distance from the centre <strong>of</strong> the neighbourhood.<br />
The technique is implemented in the <strong>SAS</strong>/STAT procedure LOESS. The Loess technique also allows<br />
confidence intervals to be computed for the smoothed estimates, subject to assumptions <strong>of</strong> Normality in the<br />
data. (In fact, by using iterative re-weighting, the LOESS procedure can also provide statistical inference when<br />
the error distribution is symmetric but not necessarily Normal).<br />
Example 3: Non-parametric Smoothing using PROC LOESS<br />
The following example is taken from the <strong>SAS</strong> Sample Library <strong>and</strong> illustrates the application <strong>of</strong> LOESS to the<br />
melanoma data listed in Annex 1. The data is taken from the Connecticut Tumour Registry, <strong>and</strong> represents<br />
age-adjusted numbers <strong>of</strong> melanoma incidences per 100,000 people for 37 years from 1936 to 1972.<br />
(Houghton, Flannery <strong>and</strong> Viola, 1980).<br />
(i) Open the file melanoma.sas. (This is described in Annex 1).<br />
(ii) Submit the program by pressing F8.<br />
The data set sasgraph.melanoma will be created.<br />
(iii) Open the file loess1.sas.<br />
As a first step, this program contains the following code to execute the LOESS procedure using default<br />
choices for all parameters.<br />
proc loess data=sasgraph.melanoma;<br />
model Incidences=Year;<br />
ods output OutputStatistics=Results;<br />
run;<br />
(iv) Submit the program by pressing F8.<br />
The fitted values are captured using the Output Delivery System in a data set called Results.<br />
The plot below shows the raw data with the loess fit superimposed.<br />
Information Systems Services Page 10 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
goptions reset=all;<br />
symbol1 c=blue v=dot;<br />
symbol2 c=red i=join v=none;<br />
%let opts=vaxis=axis1 hm=3 vm=3<br />
overlay;<br />
axis1 label=(f=zapf h=2 a=90 r=0);<br />
title1 'Melanoma Data with Default<br />
LOESS Fit';<br />
proc gplot data=Results;<br />
plot depvar*year<br />
pred*year/&opts;<br />
run;<br />
title;<br />
Melanoma data with default LOESS fit<br />
The degree <strong>of</strong> smoothing can be controlled using the smooth option. In the next step, four different fits<br />
are produced, each with a different value <strong>of</strong> the smoothing parameter.<br />
(v) Open the file loess2.sas. (The PROC LOESS step uses 4 different values for the smoothing parameter<br />
as shown below).<br />
proc loess data=sasgraph.melanoma;<br />
model Incidences=Year/<br />
smooth=0.1 0.2 0.3 0.4 residual;<br />
ods output OutputStatistics=Results;<br />
run;<br />
(vi) Submit the program by pressing F8.<br />
The results from all four models are stored in the output data set Results.<br />
(vii) Open the file loess2g.sas. This program plots each set <strong>of</strong> results <strong>and</strong> replays all four graphs in a<br />
single display using PROC GREPLAY. The code <strong>and</strong> results are shown below.<br />
goptions nodisplay;<br />
proc gplot data=Results;<br />
by SmoothingParameter;<br />
plot depvar*year pred*year/<br />
&opts name='fit';<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:fit 2:fit2 3:fit1 4:fit3;<br />
run;<br />
LOESS fits with different values <strong>of</strong> the<br />
smoothing parameter<br />
Examination <strong>of</strong> the residuals associated with each model can help in the selection <strong>of</strong> the best value <strong>of</strong><br />
the smoothing parameter. The step below applies PROC LOESS to the residuals from each model.<br />
Information Systems Services Page 11 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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
<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 />
proc loess data=sasgraph.melanoma;<br />
model Incidences=Year/smooth=0.2<br />
residual clm alpha=0.1;<br />
ods output<br />
OutputStatistics=Results;<br />
run;<br />
symbol3 c=green i=join value=none;<br />
symbol4 c=green i=join v=none;<br />
axis1 label = (a=90 r=0) order = (0 to 6);<br />
title1 'Age-adjusted Melanoma<br />
Incidences for 37 Years';<br />
proc gplot data=Results;<br />
plot DepVar*Year Pred*Year<br />
LowerCl*Year<br />
UpperCL*Year/&opts;<br />
run;<br />
Age-adjusted Melanoma Incidences for 37<br />
Years<br />
A facility for performing LOESS smoothing is also provided in <strong>SAS</strong>/INSIGHT.<br />
3.3 Semi-Parametric Modelling using Thin-Plate Splines<br />
PROC TPSPLINE <strong>of</strong>fers a hybrid approach to curve fitting by allowing both a parametric component <strong>and</strong> a<br />
non-parametric component to be included in a model. The general form <strong>of</strong> the model estimated by TPSPLINE<br />
is<br />
yi = f( xi) + ziβ + εI<br />
where yi is the ith observation, xi is a d-dimensional vector <strong>of</strong> covariates <strong>and</strong> zi is a p-dimensional vector <strong>of</strong><br />
covariates. The term f( xi) is the non-parametric component, where f is an unknown function that is assumed to<br />
be reasonably smooth. The xi are the smoothing variables. The parametric component, ziβ, models a linear<br />
regression relationship with the yi. The zi are the regression variables. (If the non-parametric component is<br />
absent, the model reduces to a fully parametric linear model for which PROC REG would be a more suitable<br />
tool).<br />
The TPSPLINE procedure estimates f( xi) <strong>and</strong> β using penalised least squares. This is<br />
an extension <strong>of</strong> the ordinary least squares technique in which a penalty function is added to the least squares<br />
objective function. The function to be minimised has the form<br />
n<br />
S i<br />
1<br />
( λ ) = ( ( x ) )<br />
2<br />
∑<br />
yi<br />
− f i − z β + λP(<br />
f )<br />
where P( f ) is the penalty on the roughness <strong>of</strong> f. The λ term is the smoothing parameter which controls the<br />
balance between smoothness <strong>and</strong> goodness <strong>of</strong> fit.<br />
The choice <strong>of</strong> the smoothing parameter is critical. The simplest way is to try a range <strong>of</strong> values for λ <strong>and</strong> choose<br />
the value that gives the best result. Provided that sufficient data is available (n>25 at least), <strong>and</strong> that the<br />
observations are not highly correlated, a more objective way to proceed is to use the Generalised Cross<br />
Validation (GCV) function proposed by Wahba (1990). (For full details <strong>of</strong> this function <strong>and</strong> the criteria<br />
governing its use, see the section on PROC TPSPLINE in <strong>SAS</strong> OnlineDoc).<br />
Information Systems Services Page 13 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
Example 4: Surface <strong>Fitting</strong> using Thin-Plate Smoothing Splines<br />
The following example is taken from the <strong>SAS</strong> Sample Library <strong>and</strong> illustrates the use <strong>of</strong> TPSPLINE to fit a<br />
smooth surface to the sulphate data listed in Annex 1. The data represent the deposition <strong>of</strong> sulphate (SO4) at<br />
179 sites in 48 contiguous states <strong>of</strong> the United States in 1990. Each observation records the latitude <strong>and</strong><br />
longitude <strong>of</strong> the site as well as the SO4 deposition at the site measured in gram per square meter (g/m 2 ).<br />
(i) Open the file tpsplin1.sas.<br />
(ii) Submit the program by pressing F8.<br />
The DATA step (shown below) creates a data set pred containing values <strong>of</strong> latitude <strong>and</strong> longitude over<br />
a finely divided lattice. This data set will be <strong>of</strong>fered to TPSPLINE as a scoring data set upon which the<br />
estimated surface will be based.<br />
data pred;<br />
do latitude = 25 to 47 by 1;<br />
do longitude = 68 to 124 by 1;<br />
output;<br />
end;<br />
end;<br />
run;<br />
The TPSPLINE step specifies a range <strong>of</strong> values for the smoothing parameter.<br />
proc tpspline data=sasgraph.so4;<br />
ods output GCVFunction=gcv;<br />
model so4 = (latitude longitude) /lognlambda=(-6 to 1 by 0.1);<br />
score data=pred out=prediction1;<br />
run;<br />
The ods statement saves values <strong>of</strong> the generalised cross validation function, gcv, for the different<br />
values <strong>of</strong> λ (or more precisely lognlambda (=log10(n*λ))) in an output data set called gcv. A plot <strong>of</strong><br />
gcv against lognlambda is presented below.<br />
goptions reset=all;<br />
axis1 minor=none;<br />
axis2 minor=none;<br />
title 'GCV Function';<br />
proc gplot data=gcv;<br />
plot gcv*lognlambda/ cframe=white<br />
vaxis=axis1 haxis=axis2 ;<br />
format gcv lognlambda d5.2;<br />
symbol1 c=blue i=join v=none w=2;<br />
run;<br />
The gcv plot reveals a local minimum at around –2.56 <strong>and</strong> a global minimum around 0.277. The fitted<br />
estimates saved in the data set prediction1 are based upon the global minimum.<br />
It is instructive to compare the results with estimates based upon the local minimum.<br />
Information Systems Services Page 14 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
(iii) Open the file tpsplin2.sas. This program executes TPSPLINE specifying a single value <strong>of</strong> lognlambda<br />
<strong>of</strong> –2.56 (shown below). The results are stored in prediction2.<br />
proc tpspline data=sasgraph.so4;<br />
model so4 = (latitude longitude) /lognlambda0 = -2.56;<br />
score data=pred out=prediction2;<br />
run;<br />
(iv) Submit the program by pressing F8.<br />
A convenient way to inspect the results is to use PROC GCONTOUR (or G3D).<br />
(iv) Open file tpsplin3.sas. It contains two steps <strong>of</strong> the form<br />
legend1 frame cborder=black position=center ;<br />
proc gcontour data=;<br />
plot latitude*longitude = P_so4/<br />
legend=legend1 hreverse<br />
vaxis=axis1 haxis=axis2<br />
caxis=blue cframe=white;<br />
run;<br />
producing contour plots for each set <strong>of</strong> predictions, as shown below.<br />
(v) Submit the program by pressing F8. The results are shown below.<br />
TPSPLINE fit with lognlambda = 0.277 TPSPLINE fit with lognlambda = -.56<br />
An alternative way to view the results is to use the ACTIVEX device driver (see Chapter 4 <strong>of</strong> ‘An<br />
Introduction to <strong>SAS</strong>/GRAPH’). This allows the predicted surface <strong>and</strong> the contour lines to viewed<br />
simultaneously in a Web browser.<br />
(vi) Open the file tpsplin4.sas.<br />
(vii) Submit the program by pressing F8.<br />
This program plots the two sets <strong>of</strong> predictions using PROC G3D <strong>and</strong> uses the Output Delivery System<br />
to save HTML output in a file. The graph will be displayed automatically in the Web browser. The<br />
resulting surface for predictions1 should resemble that shown alongside the code below.<br />
Information Systems Services Page 15 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
ods html<br />
file=”C:\temp\sas\graph\s04.html”;<br />
goptions device=activex;<br />
proc g3d data=prediction1;<br />
plot latitude*longitude = P_so4;<br />
run;<br />
ods html close;<br />
ods listing;<br />
The activex driver allows further modifications to the display to be carried out.<br />
(viii) Click the right mouse button anywhere within the frame <strong>of</strong> the graph <strong>and</strong> from the pop-up menu<br />
displayed select Surface Options.<br />
(ix) Under Appearance, specify B<strong>and</strong>ed Gradient for Surface <strong>and</strong> Below for Contour. Click OK.<br />
(x) Click the right mouse button again <strong>and</strong> select Options … Colors from the pop-up menu. Change the<br />
colours <strong>of</strong> the walls <strong>and</strong> the floor to a colour <strong>of</strong> your choice. Click OK.<br />
The ACTIVEX device driver allows keyboard controls to be used to shift, rotate <strong>and</strong> zoom the graph,<br />
allowing the fitted surface to be inspected more thoroughly. Table 1, below, describes these controls.<br />
Keyboard Action Effect<br />
Ctrl + LMB Rotate<br />
Alt + LMB Shift<br />
Shift + LMB Zoom<br />
Table 1: Activex Keyboard Modifiers<br />
(xi) To rotate the graph, keep the Ctrl key <strong>and</strong> left mouse button depressed <strong>and</strong> move the mouse.<br />
(xii) To zoom-in, keep the Alt key <strong>and</strong> left mouse button depressed <strong>and</strong> move the mouse.<br />
The graphs below show the results for each <strong>of</strong> the two data sets predictions1 <strong>and</strong> predictions2.<br />
Information Systems Services Page 16 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
TPSPLINE fit with lognlambda = 0.277<br />
TPSPLINE fit with lognlambda = -2.56<br />
The contour b<strong>and</strong>s <strong>and</strong> the projected contour lines were added using the procedure described in (v) above. It<br />
is clear from these displays that the two values <strong>of</strong> lognlambda correspond to very different models. The value<br />
<strong>of</strong> 0.277 generates a model which represents the overall trend in the data. The lower value <strong>of</strong> –2.56 results in<br />
a model which has a greater goodness <strong>of</strong> fit but which is more dominated by noise.<br />
3.4 Generalised Additive Models<br />
The non-parametric methods described above, Loess smoothing <strong>and</strong> thin-plate spline smoothing, tend not to<br />
perform well when the number <strong>of</strong> variables in the model is large. The increasing dimensionality <strong>of</strong> the<br />
multivariate space defined by the variables has the effect <strong>of</strong> increasing the variance <strong>of</strong> the fitted values. The<br />
idea <strong>of</strong> additive models was introduced by Stone (1985) in an attempt to address this problem.<br />
In contrast with ordinary multiple linear regression, in which the expected value <strong>of</strong> the dependent variable Y is<br />
expressed as a linear function <strong>of</strong> the dependent variables <strong>of</strong> the form<br />
E(Y) = β0 + β1X1 + … + βpXp<br />
the additive model expresses the expected value <strong>of</strong> Y as<br />
E(Y) = S0 + S1(X1) + … + Sp(Xp)<br />
where the functions Si(Xi) are smooth functions to be estimated non-parametrically.<br />
The concept was subsequently extended by Hastie <strong>and</strong> Tibshirani (1990) to allow the dependent variable to<br />
have a distribution from the exponential family <strong>of</strong> distributions rather than being restricted to the Normal<br />
distribution. The extended model is called the generalised additive model. PROC GAM implements the<br />
generalised additive model <strong>and</strong> recognises data from Normal, Binomial, Poisson <strong>and</strong> Gamma distributions.<br />
The methodology <strong>of</strong> implementing this model is beyond the scope <strong>of</strong> this document. The reader is referred to<br />
the <strong>SAS</strong>/STAT User Guide for full details. The following example illustrates an application <strong>of</strong> the technique to<br />
the sulphate data used earlier in Example 4 to illustrate the thin-plate spline smoothing method.<br />
Information Systems Services Page 17 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
Example 5: <strong>Fitting</strong> a Generalised Additive Model using PROC GAM<br />
(i) Open the file gam.sas <strong>and</strong> execute the program by pressing F8.<br />
ods html<br />
file="c:\temp\sas\graph\so4b.htm";<br />
goptions reset=all device=activex;<br />
proc gam data=sasgraph.so4;<br />
model so4=spline(longitude)<br />
spline(latitude)<br />
score data=pred out=prediction3;<br />
run;<br />
ods html close;<br />
ods listing;<br />
The surface is much smoother than that produced by TPSPLINE. However, GAM uses much less cpu<br />
time than TPSPLINE. In this example, GAM ran in less than a fifth <strong>of</strong> the time taken by TPSPLINE. The<br />
contour b<strong>and</strong>s <strong>and</strong> the projected contour lines were added using the technique described in 1.2.3.<br />
Information Systems Services Page 18 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
References<br />
Hastie, T.J. <strong>and</strong> Tibshirani, R.J. (1990), Generalized Additive Models, New York: Chapman <strong>and</strong> Hall<br />
Clevel<strong>and</strong>, W.S., Devlin, S.J., <strong>and</strong> Grosse, E. (1988), "Regression By Local <strong>Fitting</strong>," Journal <strong>of</strong> Econometrics,<br />
37, 87 -114.<br />
Houghton, A.N., Flannery, J., <strong>and</strong> Viola, M.V. (1980), "Malignant Melanoma in Connecticut <strong>and</strong> Denmark,"<br />
International Journal <strong>of</strong> Cancer, 25, 95 -104.<br />
Wahba, G., (1990), Spline Models for Observational Data, Philadelphia: Society for Industrial <strong>and</strong> Applied<br />
Mathematics.<br />
Information Systems Services Page 19 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
Annex<br />
This annex describes the data sets used in the examples <strong>and</strong> the DATA step code required to read the data.<br />
In some cases, the raw data is also stored separately in a file <strong>of</strong> type .dat. (All files are assumed to be held in<br />
the directory C:\temp\sas\graph.)<br />
Data set name: melanoma<br />
Description: The data is taken from the Connecticut Tumour Registry, <strong>and</strong> represents age-adjusted numbers<br />
<strong>of</strong> melanoma incidences per 100,000 people for 37 years from 1936 to 1972. (Houghton, Flannery <strong>and</strong> Viola,<br />
1980).<br />
Program name: melanoma.sas<br />
libname sasgraph ‘c:\temp\sas\graph’;<br />
data sasgraph.melanoma;<br />
input Year Incidences @@;<br />
format year d4.0;<br />
format incidences d4.1;<br />
cards;<br />
1936 0.9 1937 0.8 1938 0.8 1939 1.3<br />
1940 1.4 1941 1.2 1942 1.7 1943 1.8<br />
1944 1.6 1945 1.5 1946 1.5 1947 2.0<br />
1948 2.5 1949 2.7 1950 2.9 1951 2.5<br />
1952 3.1 1953 2.4 1954 2.2 1955 2.9<br />
1956 2.5 1957 2.6 1958 3.2 1959 3.8<br />
1960 4.2 1961 3.9 1962 3.7 1963 3.3<br />
1964 3.7 1965 3.9 1966 4.1 1967 3.8<br />
1968 4.7 1969 4.4 1970 4.8 1971 4.8<br />
1972 4.8<br />
run;<br />
Information Systems Services Page 20 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
Data set name: so4<br />
Description: The data represent the deposition <strong>of</strong> sulphate (SO4) at 179 sites in 48 contiguous states <strong>of</strong> the<br />
United States in 1990. Each observation records the latitude <strong>and</strong> longitude <strong>of</strong> the site as well as the SO4<br />
deposition at the site measured in gram per square meter (g/m 2 ).<br />
Program name: so4.sas<br />
libname sasgraph ‘c:\temp\sas\graph’;<br />
data sasgraph.so4;<br />
input latitude longitude so4 @@;<br />
cards;<br />
32.45833 87.24222 1.403 34.28778 85.96889 2.103<br />
33.07139 109.86472 0.299 36.07167 112.15500 0.304<br />
31.95056 112.80000 0.263 33.60500 92.09722 1.950<br />
34.17944 93.09861 2.168 36.08389 92.58694 1.578<br />
36.10056 94.17333 1.708 39.00472 123.08472 0.096<br />
36.56694 118.77722 0.259 41.76583 122.47833 0.065<br />
34.80611 119.01139 0.053 38.53528 121.77500 0.135<br />
37.44139 105.86528 0.247 38.11778 103.31611 0.326<br />
39.99389 105.48000 0.687 39.40306 107.34111 0.225<br />
39.42722 107.37972 0.339 37.19806 108.49028 0.559<br />
40.50750 107.70194 0.250 40.36417 105.58194 0.307<br />
40.53472 106.78000 0.564 37.75139 107.68528 0.557<br />
39.10111 105.09194 0.371 40.80639 104.75472 0.286<br />
29.97472 82.19806 1.279 28.54278 80.64444 1.564<br />
25.39000 80.68000 0.912 30.54806 84.60083 1.243<br />
27.38000 82.28389 0.991 32.14111 81.97139 1.225<br />
33.17778 84.40611 1.580 31.47306 83.53306 0.851<br />
43.46139 113.55472 0.180 43.20528 116.74917 0.103<br />
44.29778 116.06361 0.161 40.05333 88.37194 2.940<br />
41.84139 88.85111 2.090 41.70111 87.99528 3.171<br />
37.71000 89.26889 2.523 38.71000 88.74917 2.317<br />
37.43556 88.67194 3.077 40.93333 90.72306 2.006<br />
40.84000 85.46389 2.725 38.74083 87.48556 3.158<br />
41.63250 87.08778 3.443 40.47528 86.99222 2.775<br />
42.90972 91.47000 1.154 40.96306 93.39250 1.423<br />
37.65111 94.80361 1.863 39.10222 96.60917 0.898<br />
38.67167 100.91639 0.536 37.70472 85.04889 2.693<br />
37.07778 82.99361 2.195 38.11833 83.54694 2.762<br />
36.79056 88.06722 2.377 29.92972 91.71528 1.276<br />
30.81139 90.18083 1.393 44.37389 68.26056 2.268<br />
46.86889 68.01472 1.551 44.10750 70.72889 1.631<br />
45.48917 69.66528 1.369 39.40889 76.99528 2.535<br />
38.91306 76.15250 2.477 41.97583 70.02472 1.619<br />
42.39250 72.34444 2.156 42.38389 71.21472 2.417<br />
45.56083 84.67833 1.701 46.37417 84.74139 1.539<br />
47.10472 88.55139 1.048 42.41028 85.39278 3.107<br />
44.22389 85.81806 2.258 47.53111 93.46861 0.550<br />
47.94639 91.49611 0.563 46.24944 94.49722 0.591<br />
44.23722 95.30056 0.604 32.30667 90.31833 1.614<br />
32.33472 89.16583 1.135 34.00250 89.80000 1.503<br />
38.75361 92.19889 1.814 36.91083 90.31861 2.435<br />
45.56861 107.43750 0.217 48.51028 113.99583 0.387<br />
48.49917 109.79750 0.100 46.48500 112.06472 0.209<br />
41.15306 96.49278 0.743 41.05917 100.74639 0.391<br />
36.13583 115.42556 0.139 41.28528 115.85222 0.075<br />
38.79917 119.25667 0.053 39.00500 114.21583 0.273<br />
43.94306 71.70333 2.391 40.31500 74.85472 2.593<br />
33.22028 108.23472 0.377 35.78167 106.26750 0.315<br />
32.90944 105.47056 0.355 36.04083 106.97139 0.376<br />
36.77889 103.98139 0.326 42.73389 76.65972 3.249<br />
42.29944 79.39639 3.344 43.97306 74.22306 2.322<br />
Information Systems Services Page 21 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc
<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 />
44.39333 73.85944 2.111 41.35083 74.04861 3.306<br />
43.52611 75.94722 3.948 42.10639 77.53583 2.231<br />
41.99361 74.50361 3.022 36.13250 77.17139 1.857<br />
35.06056 83.43056 2.393 35.69694 80.62250 2.082<br />
35.02583 78.27833 1.729 34.97083 79.52833 1.959<br />
35.72833 78.68028 1.780 47.60139 103.26417 0.354<br />
48.78250 97.75417 0.306 47.12556 99.23694 0.273<br />
39.53139 84.72417 3.828 40.35528 83.06611 3.401<br />
39.79278 81.53111 3.961 40.78222 81.92000 3.349<br />
36.80528 98.20056 0.603 34.98000 97.52139 0.994<br />
36.59083 101.61750 0.444 44.38694 123.62306 0.629<br />
44.63472 123.19000 0.329 45.44917 122.15333 0.716<br />
43.12167 121.05778 0.050 44.21333 122.25333 0.423<br />
43.89944 117.42694 0.071 45.22444 118.51139 0.109<br />
40.78833 77.94583 3.275 41.59778 78.76750 4.336<br />
40.65750 77.93972 3.352 41.32750 74.82028 3.081<br />
33.53944 80.43500 1.456 44.35500 98.29083 0.372<br />
43.94917 101.85833 0.224 35.96139 84.28722 3.579<br />
35.18250 87.19639 2.148 35.66444 83.59028 2.474<br />
35.46778 89.15861 1.811 33.95778 102.77611 0.376<br />
28.46667 97.70694 0.886 29.66139 96.25944 0.934<br />
30.26139 100.55500 0.938 32.37861 94.71167 2.229<br />
31.56056 94.86083 1.472 33.27333 99.21528 0.890<br />
33.39167 97.63972 1.585 37.61861 112.17278 0.237<br />
41.65833 111.89694 0.271 38.99833 110.16528 0.143<br />
41.35750 111.04861 0.172 42.87611 73.16333 2.412<br />
44.52833 72.86889 2.549 38.04056 78.54306 2.478<br />
37.33139 80.55750 1.650 38.52250 78.43583 2.360<br />
47.86000 123.93194 1.144 48.54056 121.44528 0.837<br />
46.83528 122.28667 0.635 46.76056 117.18472 0.255<br />
37.98000 80.95000 2.396 39.08972 79.66222 3.291<br />
45.79639 88.39944 1.054 45.05333 88.37278 1.457<br />
44.66444 89.65222 1.044 43.70194 90.56861 1.309<br />
46.05278 89.65306 1.132 42.57917 88.50056 1.809<br />
45.82278 91.87444 0.984 41.34028 106.19083 0.335<br />
42.73389 108.85000 0.236 42.49472 108.82917 0.313<br />
42.92889 109.78667 0.182 43.22278 109.99111 0.161<br />
43.87333 104.19222 0.306 44.91722 110.42028 0.210<br />
45.07611 72.67556 2.646<br />
run;<br />
Information Systems Services Page 22 <strong>of</strong> 22<br />
Version 1.1 (Feb 2007) tut125.doc