An example of polynomial regression using proc reg in SAS.
The motorcycle data are
here. I have created a data set using import wizard called
MCycle with two variables: times = time after impact and
accel = acceleration of the rider's head. Submit the following code in the editor window to
perform linear, quadratic, and cubic regressions.
data Mcycle;
set Mcycle;
TIMES2=TIMES*TIMES;
TIMES3=TIMES2*TIMES;
run;
proc reg data=Mcycle;
title "Linear fit";
model ACCEL = TIMES;
run;
proc reg data=Mcycle;
title "Quadratic fit";
model ACCEL = TIMES TIMES2;
run;
proc reg data=Mcycle;
title "Cubic fit";
model ACCEL = TIMES TIMES2 TIMES3;
linear: test TIMES2, TIMES3;
quadratic: test TIMES3;
run;