The REG Procedure

Example 99.3 Predicting Weight by Height and Age

(View the complete code for this example.)

In this example, the weights of schoolchildren are modeled as a function of their heights and ages. The example shows the use of a BY statement with PROC REG, multiple MODEL statements, and the OUTEST= and OUTSSCP= options, which create data sets. Here are the data:

*------------Data on Age, Weight, and Height of Children-------*
| Age (months), height (inches), and weight (pounds) were      |
| recorded for a group of school children.                     |
| From Lewis and Taylor (1967).                                |
*--------------------------------------------------------------*;

data htwt;
   input sex $ age :3.1 height weight @@;
   datalines;
f 143 56.3  85.0 f 155 62.3 105.0 f 153 63.3 108.0 f 161 59.0  92.0
f 191 62.5 112.5 f 171 62.5 112.0 f 185 59.0 104.0 f 142 56.5  69.0
f 160 62.0  94.5 f 140 53.8  68.5 f 139 61.5 104.0 f 178 61.5 103.5
f 157 64.5 123.5 f 149 58.3  93.0 f 143 51.3  50.5 f 145 58.8  89.0
f 191 65.3 107.0 f 150 59.5  78.5 f 147 61.3 115.0 f 180 63.3 114.0

   ... more lines ...   

m 164 66.5 112.0 m 189 65.0 114.0 m 164 61.5 140.0 m 167 62.0 107.5
m 151 59.3  87.0
;

Modeling is performed separately for boys and girls. Since the BY statement is used, interactive processing is not possible in this example; no statements can appear after the first RUN statement.

The following statements produce Output 99.3.1 through Output 99.3.4:

proc reg outest=est1 outsscp=sscp1 rsquare;
   by sex;
   eq1: model  weight=height;
   eq2: model  weight=height age;
run;

proc print data=sscp1;
   title2 'SSCP type data set';
run;

proc print data=est1;
   title2 'EST type data set';
run;

Output 99.3.1: Height and Weight Data: Submodel for Female Children

The REG Procedure
Model: eq1
Dependent Variable: weight

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model12150721507141.09<.0001
Error10916615152.42739  
Corrected Total11038121   

Root MSE12.34615R-Square0.5642
Dependent Mean98.87838Adj R-Sq0.5602
Coeff Var12.48620  

Parameter Estimates
VariableDFParameter
Estimate
Standard
Error
t ValuePr > |t|
Intercept1-153.1289121.24814-7.21<.0001
height14.163610.3505211.88<.0001


Output 99.3.2: Height and Weight Data: Full Model for Female Children

The REG Procedure
Model: eq2
Dependent Variable: weight

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model2224321121677.21<.0001
Error10815689145.26700  
Corrected Total11038121   

Root MSE12.05268R-Square0.5884
Dependent Mean98.87838Adj R-Sq0.5808
Coeff Var12.18939  

Parameter Estimates
VariableDFParameter
Estimate
Standard
Error
t ValuePr > |t|
Intercept1-150.5969820.76730-7.25<.0001
height13.603780.407778.84<.0001
age11.907030.755432.520.0130


Output 99.3.3: Height and Weight Data: Submodel for Male Children

The REG Procedure
Model: eq1
Dependent Variable: weight

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model13112631126206.24<.0001
Error12418714150.92222  
Corrected Total12549840   

Root MSE12.28504R-Square0.6245
Dependent Mean103.44841Adj R-Sq0.6215
Coeff Var11.87552  

Parameter Estimates
VariableDFParameter
Estimate
Standard
Error
t ValuePr > |t|
Intercept1-125.6980715.99362-7.86<.0001
height13.689770.2569314.36<.0001


Output 99.3.4: Height and Weight Data: Full Model for Male Children

The REG Procedure
Model: eq2
Dependent Variable: weight

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F ValuePr > F
Model23297516487120.24<.0001
Error12316866137.11922  
Corrected Total12549840   

Root MSE11.70979R-Square0.6616
Dependent Mean103.44841Adj R-Sq0.6561
Coeff Var11.31945  

Parameter Estimates
VariableDFParameter
Estimate
Standard
Error
t ValuePr > |t|
Intercept1-113.7134615.59021-7.29<.0001
height12.680750.368097.28<.0001
age13.081670.839273.670.0004


For both female and male children, the overall F statistics for both models are significant, indicating that the model explains a significant portion of the variation in the data. For females, the full model is

and for males, the full model is

The OUTSSCP= data set is shown in Output 99.3.5. Note how the BY groups are separated. Observations with _TYPE_=‘N’ contain the number of observations in the associated BY group. Observations with _TYPE_=‘SSCP’ contain the rows of the uncorrected sums of squares and crossproducts matrix. The observations with _NAME_=‘Intercept’ contain crossproducts for the intercept.

Output 99.3.5: SSCP Matrix

SSCP type data set

Obssex_TYPE__NAME_Interceptheightweightage
1fSSCPIntercept111.06718.4010975.501824.90
2fSSCPheight6718.4407879.32669469.85110818.32
3fSSCPweight10975.5669469.851123360.75182444.95
4fSSCPage1824.9110818.32182444.9530363.81
5fN 111.0111.00111.00111.00
6mSSCPIntercept126.07825.0013034.502072.10
7mSSCPheight7825.0488243.60817919.60129432.57
8mSSCPweight13034.5817919.601398238.75217717.45
9mSSCPage2072.1129432.57217717.4534515.95
10mN 126.0126.00126.00126.00


The OUTEST= data set is displayed in Output 99.3.6; again, the BY groups are separated. The _MODEL_ column contains the labels for models from the MODEL statements. If no labels are specified, the defaults MODEL1 and MODEL2 would appear as values for _MODEL_. Note that _TYPE_=‘PARMS’ for all observations, indicating that all observations contain parameter estimates. The _DEPVAR_ column displays the dependent variable, and the _RMSE_ column gives the root mean square error for the associated model. The Intercept column gives the estimate for the intercept for the associated model, and variables with the same name as variables in the original data set (height, age) give parameter estimates for those variables. The dependent variable, weight, is shown with a value of –1. The _IN_ column contains the number of regressors in the model not including the intercept; _P_ contains the number of parameters in the model; _EDF_ contains the error degrees of freedom; and _RSQ_ contains the R square statistic. Finally, note that the _IN_, _P_, _EDF_, and _RSQ_ columns appear in the OUTEST= data set since the RSQUARE option is specified in the PROC REG statement.

Output 99.3.6: OUTEST Data Set

EST type data set

Obssex_MODEL__TYPE__DEPVAR__RMSE_Interceptheightweightage_IN__P__EDF__RSQ_
1feq1PARMSweight12.3461-153.1294.16361-1.121090.56416
2feq2PARMSweight12.0527-150.5973.60378-11.90703231080.58845
3meq1PARMSweight12.2850-125.6983.68977-1.121240.62451
4meq2PARMSweight11.7098-113.7132.68075-13.08167231230.66161