Smoothing Splines Examples for PROC TRANSREG
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: TREGSMO */
/* TITLE: Smoothing Splines Examples for PROC TRANSREG */
/* PRODUCT: STAT */
/* SYSTEM: ALL */
/* KEYS: regression analysis, transformations */
/* PROCS: TRANSREG GPLOT */
/* DATA: */
/* */
/* SUPPORT: saswfk UPDATE: July 25, 2010 */
/* REF: PROC TRANSREG, DETAILS, SMOOTHING SPLINES */
/* MISC: */
/****************************************************************/
title h=1.5 'Smoothing Splines';
ods graphics on;
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 p;
run;
proc gplot;
axis1 minor=none label=(angle=90 rotate=0);
axis2 minor=none;
symbol1 color=blue v=circle i=none; /* data */
symbol2 color=blue v=none i=sm50; /* gplot's smooth */
symbol3 color=red v=dot i=none; /* transreg's smooth */
plot y*x=1 y*x=2 py*x=3 / overlay haxis=axis2 vaxis=axis1 frame;
run; quit;
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 ss2 data=x;
model identity(y) = class(group / zero=none) *
smooth(x / sm=50);
output p;
run;