The REG Procedure

Example 100.2 Aerobic Fitness Prediction

(View the complete code for this example.)

Aerobic fitness (measured by the ability to consume oxygen) is fit to some simple exercise tests. The goal is to develop an equation to predict fitness based on the exercise tests rather than on expensive and cumbersome oxygen consumption measurements. Three model-selection methods are used: forward selection, backward selection, and MAXR selection. Here are the data:

*-------------------Data on Physical Fitness-------------------*
| These measurements were made on men involved in a physical   |
| fitness course at N.C.State Univ. The variables are Age      |
| (years), Weight (kg), Oxygen intake rate (ml per kg body     |
| weight per minute), time to run 1.5 miles (minutes), heart   |
| rate while resting, heart rate while running (same time      |
| Oxygen rate measured), and maximum heart rate recorded while |
| running.                                                     |
| ***Certain values of MaxPulse were changed for this analysis.|
*--------------------------------------------------------------*;
data fitness;
   input Age Weight Oxygen RunTime RestPulse RunPulse MaxPulse @@;
   datalines;
44 89.47 44.609 11.37 62 178 182   40 75.07 45.313 10.07 62 185 185
44 85.84 54.297  8.65 45 156 168   42 68.15 59.571  8.17 40 166 172
38 89.02 49.874  9.22 55 178 180   47 77.45 44.811 11.63 58 176 176
40 75.98 45.681 11.95 70 176 180   43 81.19 49.091 10.85 64 162 170
44 81.42 39.442 13.08 63 174 176   38 81.87 60.055  8.63 48 170 186
44 73.03 50.541 10.13 45 168 168   45 87.66 37.388 14.03 56 186 192
45 66.45 44.754 11.12 51 176 176   47 79.15 47.273 10.60 47 162 164
54 83.12 51.855 10.33 50 166 170   49 81.42 49.156  8.95 44 180 185
51 69.63 40.836 10.95 57 168 172   51 77.91 46.672 10.00 48 162 168
48 91.63 46.774 10.25 48 162 164   49 73.37 50.388 10.08 67 168 168
57 73.37 39.407 12.63 58 174 176   54 79.38 46.080 11.17 62 156 165
52 76.32 45.441  9.63 48 164 166   50 70.87 54.625  8.92 48 146 155
51 67.25 45.118 11.08 48 172 172   54 91.63 39.203 12.88 44 168 172
51 73.71 45.790 10.47 59 186 188   57 59.08 50.545  9.93 49 148 155
49 76.32 48.673  9.40 56 186 188   48 61.24 47.920 11.50 52 170 176
52 82.78 47.467 10.50 53 170 172
;

The following statements demonstrate the FORWARD, BACKWARD, and MAXR model selection methods:

proc reg data=fitness;
   model Oxygen=Age Weight RunTime RunPulse RestPulse MaxPulse
         / selection=forward;
   model Oxygen=Age Weight RunTime RunPulse RestPulse MaxPulse
         / selection=backward;
   model Oxygen=Age Weight RunTime RunPulse RestPulse MaxPulse
         / selection=maxr;
run;

Output 100.2.1 shows the sequence of models produced by the FORWARD model-selection method.

Output 100.2.1: Forward Selection Method: PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Oxygen


 


Forward Selection: Step 1


Variable RunTime Entered: R-Square = 0.7434 and C(p) = 13.6988
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model1632.90010632.9001084.01<.0001
Error29218.481447.53384  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept82.421773.855303443.36654457.05<.0001
RunTime-3.310560.36119632.9001084.01<.0001


Bounds on condition number: 1, 1


Forward Selection: Step 2


Variable Age Entered: R-Square = 0.7642 and C(p) = 12.3894
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model2650.66573325.3328745.38<.0001
Error28200.715817.16842  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept88.462295.372641943.41071271.11<.0001
Age-0.150370.0955117.765632.480.1267
RunTime-3.203950.35877571.6775179.75<.0001


Bounds on condition number: 1.0369, 4.1478


Forward Selection: Step 3


Variable RunPulse Entered: R-Square = 0.8111 and C(p) = 6.9596
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model3690.55086230.1836238.64<.0001
Error27160.830695.95669  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept111.7180610.23509709.69014119.14<.0001
Age-0.256400.0962342.288677.100.0129
RunTime-2.825380.35828370.4352962.19<.0001
RunPulse-0.130910.0505939.885126.700.0154


Bounds on condition number: 1.3548, 11.597


Forward Selection: Step 4


Variable MaxPulse Entered: R-Square = 0.8368 and C(p) = 4.8800
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model4712.45153178.1128833.33<.0001
Error26138.930025.34346  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept98.1478911.78569370.5737369.35<.0001
Age-0.197730.0956422.842314.270.0488
RunTime-2.767580.34054352.9357066.05<.0001
RunPulse-0.348110.1175046.900898.780.0064
MaxPulse0.270510.1336221.900674.100.0533


Bounds on condition number: 8.4182, 76.851


Forward Selection: Step 5


Variable Weight Entered: R-Square = 0.8480 and C(p) = 5.1063
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model5721.97309144.3946227.90<.0001
Error25129.408455.17634  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept102.2042811.97929376.7893572.79<.0001
Age-0.219620.0955027.374295.290.0301
Weight-0.072300.053319.521571.840.1871
RunTime-2.682520.34099320.3596861.89<.0001
RunPulse-0.373400.1171452.5962410.160.0038
MaxPulse0.304910.1339426.826405.180.0316


Bounds on condition number: 8.7312, 104.83


The final variable available to add to the model, RestPulse, is not added since it does not meet the 50% (the default value of the SLE option is 0.5 for FORWARD selection) significance-level criterion for entry into the model.

The BACKWARD model-selection method begins with the full model. Output 100.2.2 shows the steps of the BACKWARD method. RestPulse is the first variable deleted, followed by Weight. No other variables are deleted from the model since the variables remaining (Age, RunTime, RunPulse, and MaxPulse) are all significant at the 10% (the default value of the SLS option is 0.1 for the BACKWARD elimination method) significance level.

Output 100.2.2: Backward Selection Method: PROC REG


 


Backward Elimination: Step 0


All Variables Entered: R-Square = 0.8487 and C(p) = 7.0000
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model6722.54361120.4239322.43<.0001
Error24128.837945.36825  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept102.9344812.40326369.7283168.87<.0001
Age-0.226970.0998427.745775.170.0322
Weight-0.074180.054599.910591.850.1869
RunTime-2.628650.38456250.8221046.72<.0001
RunPulse-0.369630.1198551.058069.510.0051
RestPulse-0.021530.066050.570510.110.7473
MaxPulse0.303220.1365026.491424.930.0360


Bounds on condition number: 8.7438, 137.13


Backward Elimination: Step 1


Variable RestPulse Removed: R-Square = 0.8480 and C(p) = 5.1063
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model5721.97309144.3946227.90<.0001
Error25129.408455.17634  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept102.2042811.97929376.7893572.79<.0001
Age-0.219620.0955027.374295.290.0301
Weight-0.072300.053319.521571.840.1871
RunTime-2.682520.34099320.3596861.89<.0001
RunPulse-0.373400.1171452.5962410.160.0038
MaxPulse0.304910.1339426.826405.180.0316


Bounds on condition number: 8.7312, 104.83


Backward Elimination: Step 2


Variable Weight Removed: R-Square = 0.8368 and C(p) = 4.8800
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model4712.45153178.1128833.33<.0001
Error26138.930025.34346  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept98.1478911.78569370.5737369.35<.0001
Age-0.197730.0956422.842314.270.0488
RunTime-2.767580.34054352.9357066.05<.0001
RunPulse-0.348110.1175046.900898.780.0064
MaxPulse0.270510.1336221.900674.100.0533


Bounds on condition number: 8.4182, 76.851


The MAXR method tries to find the "best" one-variable model, the "best" two-variable model, and so on. Output 100.2.3 shows that the one-variable model contains RunTime; the two-variable model contains RunTime and Age; the three-variable model contains RunTime, Age, and RunPulse; the four-variable model contains Age, RunTime, RunPulse, and MaxPulse; the five-variable model contains Age, Weight, RunTime, RunPulse, and MaxPulse; and finally, the six-variable model contains all the variables in the MODEL statement.

Output 100.2.3: Maximum R-Square Improvement Selection Method: PROC REG


 


Maximum R-Square Improvement: Step 1


Variable RunTime Entered: R-Square = 0.7434 and C(p) = 13.6988
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model1632.90010632.9001084.01<.0001
Error29218.481447.53384  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept82.421773.855303443.36654457.05<.0001
RunTime-3.310560.36119632.9001084.01<.0001


Bounds on condition number: 1, 1


The above model is the best 1-variable model found.


Maximum R-Square Improvement: Step 2


Variable Age Entered: R-Square = 0.7642 and C(p) = 12.3894
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model2650.66573325.3328745.38<.0001
Error28200.715817.16842  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept88.462295.372641943.41071271.11<.0001
Age-0.150370.0955117.765632.480.1267
RunTime-3.203950.35877571.6775179.75<.0001


Bounds on condition number: 1.0369, 4.1478


The above model is the best 2-variable model found.


Maximum R-Square Improvement: Step 3


Variable RunPulse Entered: R-Square = 0.8111 and C(p) = 6.9596
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model3690.55086230.1836238.64<.0001
Error27160.830695.95669  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept111.7180610.23509709.69014119.14<.0001
Age-0.256400.0962342.288677.100.0129
RunTime-2.825380.35828370.4352962.19<.0001
RunPulse-0.130910.0505939.885126.700.0154


Bounds on condition number: 1.3548, 11.597


The above model is the best 3-variable model found.


Maximum R-Square Improvement: Step 4


Variable MaxPulse Entered: R-Square = 0.8368 and C(p) = 4.8800
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model4712.45153178.1128833.33<.0001
Error26138.930025.34346  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept98.1478911.78569370.5737369.35<.0001
Age-0.197730.0956422.842314.270.0488
RunTime-2.767580.34054352.9357066.05<.0001
RunPulse-0.348110.1175046.900898.780.0064
MaxPulse0.270510.1336221.900674.100.0533


Bounds on condition number: 8.4182, 76.851


The above model is the best 4-variable model found.


Maximum R-Square Improvement: Step 5


Variable Weight Entered: R-Square = 0.8480 and C(p) = 5.1063
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model5721.97309144.3946227.90<.0001
Error25129.408455.17634  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept102.2042811.97929376.7893572.79<.0001
Age-0.219620.0955027.374295.290.0301
Weight-0.072300.053319.521571.840.1871
RunTime-2.682520.34099320.3596861.89<.0001
RunPulse-0.373400.1171452.5962410.160.0038
MaxPulse0.304910.1339426.826405.180.0316


Bounds on condition number: 8.7312, 104.83


The above model is the best 5-variable model found.


Maximum R-Square Improvement: Step 6


Variable RestPulse Entered: R-Square = 0.8487 and C(p) = 7.0000
 
 
 
 

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model6722.54361120.4239322.43<.0001
Error24128.837945.36825  
Corrected Total30851.38154   

VariableParameter
Estimate
Standard
Error
Type II SSF ValuePr > F
Intercept102.9344812.40326369.7283168.87<.0001
Age-0.226970.0998427.745775.170.0322
Weight-0.074180.054599.910591.850.1869
RunTime-2.628650.38456250.8221046.72<.0001
RunPulse-0.369630.1198551.058069.510.0051
RestPulse-0.021530.066050.570510.110.7473
MaxPulse0.303220.1365026.491424.930.0360


Bounds on condition number: 8.7438, 137.13


Note that for all three of these methods, RestPulse contributes least to the model. In the case of forward selection, it is not added to the model. In the case of backward selection, it is the first variable to be removed from the model. In the case of MAXR selection, RestPulse is included only for the full model.

For the STEPWISE, BACKWARD, and FORWARD selection methods, you can control the amount of detail displayed by using the DETAILS option, and you can use ODS Graphics to produce plots that show how selection criteria progress as the selection proceeds. For example, the following statements display only the selection summary table for the FORWARD selection method (Output 100.2.4) and produce the plots shown in Output 100.2.5 and Output 100.2.6.

ods graphics on;

proc reg data=fitness plots=(criteria sbc);
   model Oxygen=Age Weight RunTime RunPulse RestPulse MaxPulse
         / selection=forward details=summary;
run;

Output 100.2.4: Forward Selection Summary

The REG Procedure
Model: MODEL1
Dependent Variable: Oxygen
 


 
 
 

Summary of Forward Selection
StepVariable
Entered
Number
Vars In
Partial
R-Square
Model
R-Square
C(p)F ValuePr > F
1RunTime10.74340.743413.698884.01<.0001
2Age20.02090.764212.38942.480.1267
3RunPulse30.04680.81116.95966.700.0154
4MaxPulse40.02570.83684.88004.100.0533
5Weight50.01120.84805.10631.840.1871


Output 100.2.5 show how six fit criteria progress as the forward selection proceeds. The step at which each criterion achieves its best value is indicated. For example, the BIC criterion achieves its minimum value for the model at step 4. Note that this does not mean that the model at step 4 achieves the smallest BIC criterion among all possible models that use a subset of the regressors; the model at step 4 yields the smallest BIC statistic among the models at each step of the forward selection. Output 100.2.6 show the progression of the SBC statistic in its own plot. If you want to see six of the selection criteria in individual plots, you can specify the UNPACK suboption of the PLOTS=CRITERIA option in the PROC REG statement.

Output 100.2.5: Fit Criteria

Fit Criteria


Output 100.2.6: SBC Criterion

SBC Criterion


Next, the RSQUARE model-selection method is used to request R square and statistics for all possible combinations of the six independent variables. The following statements produce Output 100.2.7:

proc reg data=fitness plots=(criteria(label) cp);
   model Oxygen=Age Weight RunTime RunPulse RestPulse MaxPulse
         / selection=rsquare cp;
   title 'Physical fitness data: all models';
run;

Output 100.2.7: All Models by the RSQUARE Method: PROC REG

Physical fitness data: all models

The REG Procedure
Model: MODEL1
Dependent Variable: Oxygen
 
R-Square Selection Method


 

Model
Index
Number in
Model
R-SquareC(p)Variables in Model
110.743413.6988RunTime
210.1595106.3021RestPulse
310.1584106.4769RunPulse
410.0928116.8818Age
510.0560122.7072MaxPulse
610.0265127.3948Weight
720.764212.3894Age RunTime
820.761412.8372RunTime RunPulse
920.745215.4069RunTime MaxPulse
1020.744915.4523Weight RunTime
1120.743515.6746RunTime RestPulse
1220.376073.9645Age RunPulse
1320.300385.9742Age RestPulse
1420.289487.6951RunPulse MaxPulse
1520.260092.3638Age MaxPulse
1620.235096.3209RunPulse RestPulse
1720.1806104.9523Weight RestPulse
1820.1740105.9939RestPulse MaxPulse
1920.1669107.1332Weight RunPulse
2020.1506109.7057Age Weight
2120.0675122.8881Weight MaxPulse
2230.81116.9596Age RunTime RunPulse
2330.81007.1350RunTime RunPulse MaxPulse
2430.781711.6167Age RunTime MaxPulse
2530.770813.3453Age Weight RunTime
2630.767313.8974Age RunTime RestPulse
2730.761914.7619RunTime RunPulse RestPulse
2830.761814.7729Weight RunTime RunPulse
2930.746217.2588Weight RunTime MaxPulse
3030.745217.4060RunTime RestPulse MaxPulse
3130.745117.4243Weight RunTime RestPulse
3230.466661.5873Age RunPulse RestPulse
3330.422368.6250Age RunPulse MaxPulse
3430.409170.7102Age Weight RunPulse
3530.390073.7424Age RestPulse MaxPulse
3630.356879.0013Age Weight RestPulse
3730.353879.4891RunPulse RestPulse MaxPulse
3830.320884.7216Weight RunPulse MaxPulse
3930.290289.5693Age Weight MaxPulse
4030.244796.7952Weight RunPulse RestPulse
4130.1882105.7430Weight RestPulse MaxPulse
4240.83684.8800Age RunTime RunPulse MaxPulse
4340.81658.1035Age Weight RunTime RunPulse
4440.81588.2056Weight RunTime RunPulse MaxPulse
4540.81178.8683Age RunTime RunPulse RestPulse
4640.81049.0697RunTime RunPulse RestPulse MaxPulse
4740.786212.9039Age Weight RunTime MaxPulse
4840.783413.3468Age RunTime RestPulse MaxPulse
4940.775014.6788Age Weight RunTime RestPulse
5040.762316.7058Weight RunTime RunPulse RestPulse
5140.746219.2550Weight RunTime RestPulse MaxPulse
5240.503457.7590Age Weight RunPulse RestPulse
5340.502557.9092Age RunPulse RestPulse MaxPulse
5440.471762.7830Age Weight RunPulse MaxPulse
5540.425670.0963Age Weight RestPulse MaxPulse
5640.385876.4100Weight RunPulse RestPulse MaxPulse
5750.84805.1063Age Weight RunTime RunPulse MaxPulse
5850.83706.8461Age RunTime RunPulse RestPulse MaxPulse
5950.81769.9348Age Weight RunTime RunPulse RestPulse
6050.816110.1685Weight RunTime RunPulse RestPulse MaxPulse
6150.788714.5111Age Weight RunTime RestPulse MaxPulse
6250.554151.7233Age Weight RunPulse RestPulse MaxPulse
6360.84877.0000Age Weight RunTime RunPulse RestPulse MaxPulse

 



The models in Output 100.2.7 are arranged first by the number of variables in the model and then by the magnitude of R square for the model.

Output 100.2.8 shows the panel of fit criteria for the RSQUARE selection method. The best models (based on the R-square statistic) for each subset size are indicated on the plots. The LABEL suboption specifies that these models are labeled by the model number that appears in the summary table shown in Output 100.2.7.

Output 100.2.8: Fit Criteria

Fit Criteria


Output 100.2.9 shows the plot of the criterion by number of regressors in the model. Useful reference lines suggested by Mallows (1973) and Hocking (1976) are included on the plot. However, because all possible subset models are included on this plot, the better models are all compressed near the bottom of the plot.

Output 100.2.9: Criterion

Cp Criterion


The following statements use the BEST=20 option in the model statement and SELECTION=CP to restrict attention to the models that yield the 20 smallest values of the statistic:

proc reg data=fitness plots(only)=cp(label);
   model Oxygen=Age Weight RunTime RunPulse RestPulse MaxPulse
         / selection=cp best=20;
run;

ods graphics off;

Output 100.2.10 shows the summary table listing the regressors in the 20 models that yield the smallest values, and Output 100.2.11 presents the results graphically. Reference lines and are shown on this plot. See the PLOTS=CP option for interpretations of these lines. For the Fitness data, these lines indicate that a six-variable model is a reasonable choice for doing parameter estimation, while a five-variable model might be suitable for doing prediction.

Output 100.2.10: Selection Summary: PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Oxygen
 
C(p) Selection Method


 

Model
Index
Number in
Model
C(p)R-SquareVariables in Model
144.88000.8368Age RunTime RunPulse MaxPulse
255.10630.8480Age Weight RunTime RunPulse MaxPulse
356.84610.8370Age RunTime RunPulse RestPulse MaxPulse
436.95960.8111Age RunTime RunPulse
567.00000.8487Age Weight RunTime RunPulse RestPulse MaxPulse
637.13500.8100RunTime RunPulse MaxPulse
748.10350.8165Age Weight RunTime RunPulse
848.20560.8158Weight RunTime RunPulse MaxPulse
948.86830.8117Age RunTime RunPulse RestPulse
1049.06970.8104RunTime RunPulse RestPulse MaxPulse
1159.93480.8176Age Weight RunTime RunPulse RestPulse
12510.16850.8161Weight RunTime RunPulse RestPulse MaxPulse
13311.61670.7817Age RunTime MaxPulse
14212.38940.7642Age RunTime
15212.83720.7614RunTime RunPulse
16412.90390.7862Age Weight RunTime MaxPulse
17313.34530.7708Age Weight RunTime
18413.34680.7834Age RunTime RestPulse MaxPulse
19113.69880.7434RunTime
20313.89740.7673Age RunTime RestPulse

 



Output 100.2.11: Criterion

Cp Criterion


Before making a final decision about which model to use, you would want to perform collinearity diagnostics. Note that, since many different models have been fit and the choice of a final model is based on R square, the statistics are biased and the p-values for the parameter estimates are not valid.

Last updated: February 13, 2019