Chapter Contents |
Previous |
Next |

The TRANSREG Procedure |

You can use PROC TRANSREG to output to a SAS data set the same smoothing
splines that the GPLOT procedure creates. The SMOOTH
transformation is a noniterative
transformation for smoothing splines. The smoothing parameter can be
specified with either the SM= or the PARAMETER= *o-option*. The independent
variable transformation (Tx in this case) contains the
results. The GPLOT request y*x=2 with I=SM50
creates the same curve as Tx*x.

title 'Smoothing Splines'; data x; do x = 1 to 100 by 2; do rep = 1 to 3; y = log(x) + sin(x / 10) + normal(7); output; end; end; run; proc transreg; model identity(y) = smooth(x / sm=50); output; run; %let opts = haxis=axis2 vaxis=axis1 frame cframe=ligr; proc gplot; axis1 minor=none label=(angle=90 rotate=0); axis2 minor=none; plot y*x=1 y*x=2 tx*x=3 / &opts overlay; symbol1 color=blue v=star i=none; symbol2 color=yellow v=none i=sm50; symbol3 color=cyan v=dot i=none; run; quit;

When you cross a SMOOTH variable with a CLASS variable, specify
ZERO=NONE with the CLASS expansion and the AFTER *t-option* with
the SMOOTH transformation so that separate functions
are found within each group.

title2 'Two Groups'; data x; do x = 1 to 100; group = 1; do rep = 1 to 3; y = log(x) + sin(x / 10) + normal(7); output; end; group = 2; do rep = 1 to 3; y = -log(x) + cos(x / 10) + normal(7); output; end; end; run; proc transreg; model identity(y) = class(group / zero=none) | smooth(x / after sm=50); output out=curves; run; data curves2; set curves; if group1 = 0 then tgroup1x = .; if group2 = 0 then tgroup2x = .; run; %let opts = haxis=axis2 vaxis=axis1 frame cframe=ligr; proc gplot; axis1 minor=none label=(angle=90 rotate=0); axis2 minor=none; plot y*x=1 tgroup1x*x=2 tgroup2x*x=2 / &opts overlay; symbol1 color=blue v=star i=none; symbol2 color=yellow v=none i=join; run; quit;

The SMOOTH transformation is valid only with independent
variables; typically, it is
used in models with a single independent and a single dependent variable.
When there are multiple independent variables designated as SMOOTH, the
TRANSREG procedure tries to smooth the *i*th independent variable using
the *i*th dependent variable as a target. When there are more independent
variables than dependent variables, the last dependent variable is
reused as often as is
necessary. For example, for the model

model identity(y1-y3) = smooth(x1-x5);

smoothing is based on the pairs (y1, x1), (y2, x2), (y3, x3), (y3, x4), and (y3, x5).

The SMOOTH transformation is a noniterative transformation; smoothing occurs once per variable before the iterations begin. In contrast, SSPLINE provides an iterative smoothing spline transformation. It does not generally minimize squared error; hence, divergence is possible with SSPLINE.

Chapter Contents |
Previous |
Next |
Top |

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.