The SCORE Procedure

Example 102.2 Regression Parameter Estimates

In this example, PROC REG computes regression parameter estimates for the Fitness data. (See Example 102.1 to for more information about how to create the Fitness data set.) The parameter estimates are output to a data set and used as scoring coefficients. For the first part of this example, PROC SCORE is used to score the Fitness data, which are the same data used in the regression.

In the second part of this example, PROC SCORE is used to score a new data set, Fitness2. For PROC SCORE, the TYPE= specification is PARMS, and the names of the score variables are found in the variable _MODEL_, which gets its values from the model label. The following code produces Output 102.2.1 through Output 102.2.3:

proc reg data=Fitness outest=RegOut;
   OxyHat: model Oxygen=Age Weight RunTime RunPulse RestPulse;
   title 'Regression Scoring Example';
run;
proc print data=RegOut;
   title2 'OUTEST= Data Set from PROC REG';
run;
proc score data=Fitness score=RegOut out=RScoreP type=parms;
   var Age Weight RunTime RunPulse RestPulse;
run;
proc print data=RScoreP;
   title2 'Predicted Scores for Regression';
run;
proc score data=Fitness score=RegOut out=RScoreR type=parms;
   var Oxygen Age Weight RunTime RunPulse RestPulse;
run;
proc print data=RScoreR;
   title2 'Negative Residual Scores for Regression';
run;

Output 102.2.1 shows the PROC REG output. The column labeled "Parameter Estimates" lists the parameter estimates. These estimates are output to the RegOut data set.

Output 102.2.1: Creating an OUTEST= Data Set with PROC REG

Regression Scoring Example

The REG Procedure
Model: OxyHat
Dependent Variable: Oxygen

Number of Observations Read12
Number of Observations Used12

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model5509.62201101.9244015.800.0021
Error638.700606.45010  
Corrected Total11548.32261   

Root MSE2.53970R-Square0.9294
Dependent Mean48.38942Adj R-Sq0.8706
Coeff Var5.24847  

Parameter Estimates
VariableDFParameter
Estimate
Standard
Error
t ValuePr > |t|
Intercept1151.9155031.047384.890.0027
Age1-0.630450.42503-1.480.1885
Weight1-0.105860.11869-0.890.4068
RunTime1-1.756980.93844-1.870.1103
RunPulse1-0.228910.12169-1.880.1090
RestPulse1-0.179100.13005-1.380.2176


Output 102.2.2 lists the RegOut data set. Note that _TYPE_=’PARMS’ and _MODEL_=’OXYHAT’, which are from the label in the MODEL statement in PROC REG.

Output 102.2.2: OUTEST= Data Set from PROC REG Reproduced with PROC PRINT

Regression Scoring Example
OUTEST= Data Set from PROC REG

Obs_MODEL__TYPE__DEPVAR__RMSE_InterceptAgeWeightRunTimeRunPulseRestPulseOxygen
1OxyHatPARMSOxygen2.53970151.916-0.63045-0.10586-1.75698-0.22891-0.17910-1


Output 102.2.3 lists the data sets created by PROC SCORE. Since the SCORE= data set does not contain observations with _TYPE_=’MEAN’ or _TYPE_=’STD’, the data in the Fitness data set are not standardized before scoring. The SCORE= data set contains the variable Intercept, so this intercept value is used in computing the score. To produce the RScoreP data set, the VAR statement in PROC SCORE includes only the independent variables from the model in PROC REG. As a result, the OxyHat variable contains predicted values. To produce the RScoreR data set, the VAR statement in PROC SCORE includes both the dependent variables and the independent variables from the model in PROC REG. As a result, the OxyHat variable contains negative residuals (PREDICT–ACTUAL) as shown in Output 102.2.4. If the RESIDUAL option is specified, the variable OxyHat contains positive residuals (ACTUAL–PREDICT). If the PREDICT option is specified, the OxyHat variable contains predicted values.

Output 102.2.3: Predicted Scores from the OUT= Data Set Created by PROC SCORE

Regression Scoring Example
Predicted Scores for Regression

ObsAgeWeightOxygenRunTimeRestPulseRunPulseOxyHat
14489.4744.60911.376217842.8771
24075.0745.31310.076218547.6050
34485.8454.2978.654515656.1211
44268.1559.5718.174016658.7044
53889.0249.8749.225517851.7386
64777.4544.81111.635817642.9756
74075.9845.68111.957017644.8329
84381.1949.09110.856416248.6020
94481.4239.44213.086317441.4613
103881.8760.0558.634817056.6171
114473.0350.54110.134516852.1299
124587.6637.38814.035618637.0080


Output 102.2.4: Residual Scores from the OUT= Data Set Created by PROC SCORE

Regression Scoring Example
Negative Residual Scores for Regression

ObsAgeWeightOxygenRunTimeRestPulseRunPulseOxyHat
14489.4744.60911.3762178-1.73195
24075.0745.31310.07621852.29197
34485.8454.2978.65451561.82407
44268.1559.5718.1740166-0.86657
53889.0249.8749.22551781.86460
64777.4544.81111.6358176-1.83542
74075.9845.68111.9570176-0.84811
84381.1949.09110.8564162-0.48897
94481.4239.44213.08631742.01935
103881.8760.0558.6348170-3.43787
114473.0350.54110.13451681.58892
124587.6637.38814.0356186-0.38002


The second part of this example uses the parameter estimates to score a new data set. The following statements produce Output 102.2.5 and Output 102.2.6:

   /* The FITNESS2 data set contains observations 13-16 from */
   /* the FITNESS data set used in EXAMPLE 2 in the PROC REG */
   /* chapter.                                               */
data Fitness2;
   input Age Weight Oxygen RunTime RestPulse RunPulse;
   datalines;
45  66.45  44.754  11.12  51  176
47  79.15  47.273  10.60  47  162
54  83.12  51.855  10.33  50  166
49  81.42  49.156   8.95  44  180
;
proc print data=Fitness2;
   title 'Regression Scoring Example';
   title2 'New Raw Data Set to be Scored';
run;
proc score data=Fitness2 score=RegOut out=NewPred type=parms
           nostd predict;
   var Oxygen Age Weight RunTime RunPulse RestPulse;
run;
proc print data=NewPred;
   title2 'Predicted Scores for Regression';
   title3 'for Additional Data from FITNESS2';
run;

Output 102.2.5 lists the Fitness2 data set.

Output 102.2.5: Listing of the Fitness2 Data Set

Regression Scoring Example
New Raw Data Set to be Scored

ObsAgeWeightOxygenRunTimeRestPulseRunPulse
14566.4544.75411.1251176
24779.1547.27310.6047162
35483.1251.85510.3350166
44981.4249.1568.9544180


PROC SCORE scores the Fitness2 data set by using the parameter estimates in the RegOut data set. These parameter estimates result from fitting a regression equation to the Fitness data set. The NOSTD option is specified, so the raw data are not standardized before scoring. (However, the NOSTD option is not necessary here. The SCORE= data set does not contain observations with _TYPE_=’MEAN’ or _TYPE_=’STD’, so standardization is not performed.) The VAR statement contains the dependent variables and the independent variables used in PROC REG. In addition, the PREDICT option is specified. This combination gives predicted values for the new score variable. The name of the new score variable is OxyHat, from the value of the _MODEL_ variable in the SCORE= data set. Output 102.2.6 shows the data set produced by PROC SCORE.

Output 102.2.6: Predicted Scores from the OUT= Data Set Created by PROC SCORE and Reproduced Using PROC PRINT

Regression Scoring Example
Predicted Scores for Regression
for Additional Data from FITNESS2

ObsAgeWeightOxygenRunTimeRestPulseRunPulseOxyHat
14566.4544.75411.125117647.5507
24779.1547.27310.604716249.7802
35483.1251.85510.335016643.9682
44981.4249.1568.954418047.5949