|
Chapter Contents |
Previous |
Next |
| The TPSPLINE Procedure |
The following statements generate the data set large:
data large;
do x=-5 to 5 by 0.02;
y=5*sin(3*x)+1*rannor(57391);
output;
end;
run;
The data set large contains 501 observations with one independent variable x and one dependent variable y. The following statements invoke PROC TPSPLINE to produce a thin-plate smoothing spline estimate and the associated 99% confidence interval. The output statistics are saved in the data set fit1.
proc tpspline data=large;
model y =(x) /lambda=(-5 to -1 by 0.2) alpha=0.01;
output out=fit1 pred LCLM UCLM;
run;
The results from this MODEL statement are displayed in Output 64.4.1.
Output 64.4.1: Output from PROC TPSPLINE without the D= Option|
| ||||||||||||||||
proc tpspline data=large;
model y =(x) /lambda=(-5 to -1 by 0.2) d=0.05 alpha=0.01;
output out=fit2 pred LCLM UCLM;
run;
The output is displayed in Output 64.4.2.
Output 64.4.2: Output from PROC TPSPLINE with the D= Option|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||
The difference between the two estimates is minimal. However, the CPU time for the second MODEL statement is only about 1/8 of the CPU time used in the first model fit.
The following statements produce a plot for comparison of the two estimates:
data fit2;
set fit2;
P1_y = P_y;
LCLM1_y = LCLM_y;
UCLM1_y = UCLM_y;
drop P_y
LCLM_y
UCLM_y;
proc sort data=fit1;
by x y;
proc sort data=fit2;
by x y;
data comp;
merge fit1 fit2;
by x y;
label p1_y ="Yhat1" p_y="Yhat0"
lclm_y ="Lower CL"
uclm_y ="Upper CL";
symbol1 i=join v=none ;
symbol2 i=join v=none ;
symbol3 i=join v=none color=cyan;
symbol4 i=join v=none color=cyan;
title 'Comparison of Two Estimates';
title2 'with and without the D= Option';
proc gplot data=comp;
plot P_y*x=1
P1_y*x=2
LCLM_y*x=4
UCLM_y*x=4/overlay legend=legend1
vaxis=axis1 haxis=axis2
frame cframe=ligr;
run;
The estimates fit1 and fit2 are displayed in Output 64.4.3 with the 99% confidence interval from the fit1 output data set.
Output 64.4.3: Comparison of Two Fits with and without the D= Option
|
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.