The TPSPLINE Procedure |
This example analyzes the data set Measure that was introduced in the section Getting Started: TPSPLINE Procedure. That analysis determined that the final estimated surface can be represented by a quadratic function for one or both of the independent variables. This example illustrates how you can use PROC TPSPLINE to fit a partial spline model. The data set Measure is fit by using the following model:
The model has a parametric component (associated with the variable) and a nonparametric component (associated with the variable). The following statements fit a partial spline model:
data Measure; set Measure; x1sq = x1*x1; run; data pred; do x1=-1 to 1 by 0.1; do x2=-1 to 1 by 0.1; x1sq = x1*x1; output; end; end; run; proc tpspline data= measure; model y = x1 x1sq (x2); score data = pred out = predy; run;
Output 89.1.1 displays the results from these statements.
Summary of Input Data Set | |
---|---|
Number of Non-Missing Observations | 50 |
Number of Missing Observations | 0 |
Unique Smoothing Design Points | 5 |
As displayed in Output 89.1.1, there are five unique design points for the smoothing variable and two regression variables in the model . The dimension of the polynomial space is . The standard deviation of the estimate is much larger than the one based on the model with both and as smoothing variables ( compared to ). One of the many possible explanations might be that the number of unique design points of the smoothing variable is too small to warrant an accurate estimate for .
The following statements produce a surface plot for the partial spline model by using the surface template defined in :
ods graphics on; proc sgrender data=predy template=surface; dynamic _X='x1' _Y='x2' _Z='P_y' _T='Plot of Fitted Surface on a Fine Grid'; run; ods graphics off;
The surface displayed in Output 89.1.2 is similar to the one estimated by using the full nonparametric model (displayed in Output 89.5).
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.