Original Program from program editor.


****************************************************;
*** Multiple Regression Example                  ***;
***                                              ***;
****************************************************;
options ps=256 ls=99 nocenter nodate nonumber;
title1 'Generic multiple regression introduction';

data one; infile cards missover;
   input Y X1  X2  X3;
cards; run;
1      2      9      2
3      4      6      5
5      7      7      9
3      3      5      5
6      5      8      9
4      3      4      2
2      2      3      6
8      6      2      1
9      7      5      3
3      8      2      4
5      7      3      7
6      9      1      4
;
proc print data=one; title2 'Raw data listing'; run;

title2 'All possible models with PROC REG';
proc reg data=one; model y = x1/ ss1 ss2; run;
proc reg data=one; model y = x2 / ss1 ss2; run;
proc reg data=one; model y = x3 / ss1 ss2; run;
proc reg data=one; model y = x1 x2 / ss1 ss2; run;
proc reg data=one; model y = x1 x3 / ss1 ss2; run;
proc reg data=one; model y = x2 x3 / ss1 ss2; run;
proc reg data=one; model y = x1 x2 x3 / ss1 ss2; run;

proc mixed data=one; model y = x1 x2 x3 / solution HType=1 2 3;
   title2 'Multiple Regression with PROC MIXED';
run;
proc glm data=one; model y = x1 x2 x3 / solution ss1 ss2 ss3 ss4;
   title2 'Multiple Regression with PROC GLM';
run;


Below is output from the SAS log (bold) and output from the SAS Output window.



1          ****************************************************;
2          *** Multiple Regression Example                  ***;
3          ***                                              ***;
4          ****************************************************;
5          options ps=256 ls=99 nocenter nodate nonumber;
6          title1 'Generic multiple regression introduction';
7    
8          data one; infile cards missover;
9             input Y X1  X2  X3;
10         cards;
NOTE: The data set WORK.ONE has 12 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
10       !        run;
23         ;
24         proc print data=one; title2 'Raw data listing'; run;
NOTE: There were 12 observations read from the data set WORK.ONE.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


Generic multiple regression introduction
Raw data listing

Obs    Y    X1    X2    X3
  1    1     2     9     2
  2    3     4     6     5
  3    5     7     7     9
  4    3     3     5     5
  5    6     5     8     9
  6    4     3     4     2
  7    2     2     3     6
  8    8     6     2     1
  9    9     7     5     3
 10    3     8     2     4
 11    5     7     3     7
 12    6     9     1     4



26         title2 'All possible models with PROC REG';
27         proc reg data=one; model y = x1/ ss1 ss2; run;
NOTE: 12 observations read.
NOTE: 12 observations used in computations.
NOTE: The PROCEDURE REG printed page 2.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds



Generic multiple regression introduction
All possible models with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     1       23.97763       23.97763       6.16    0.0325
Error                    10       38.93904        3.89390 
Corrected Total          11       62.91667                

Root MSE              1.97330    R-Square     0.3811
Dependent Mean        4.58333    Adj R-Sq     0.3192
Coeff Var            43.05377   

        Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS

Intercept     1        1.37613        1.41242       0.97      0.3529      252.08333        3.69640
X1            1        0.61089        0.24618       2.48      0.0325       23.97763       23.97763


28         proc reg data=one; model y = x2 / ss1 ss2; run;
NOTE: 12 observations read.
NOTE: 12 observations used in computations.
NOTE: The PROCEDURE REG printed page 3.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


Generic multiple regression introduction
All possible models with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     1        4.11526        4.11526       0.70    0.4224
Error                    10       58.80141        5.88014 
Corrected Total          11       62.91667                

Root MSE              2.42490    R-Square     0.0654
Dependent Mean        4.58333    Adj R-Sq    -0.0281
Coeff Var            52.90691   

        Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS

Intercept     1        5.68743        1.49393       3.81      0.0034      252.08333       85.22336
X2            1       -0.24089        0.28795      -0.84      0.4224        4.11526        4.11526



29         proc reg data=one; model y = x3 / ss1 ss2; run;
NOTE: 12 observations read.
NOTE: 12 observations used in computations.
NOTE: The PROCEDURE REG printed page 4.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


Generic multiple regression introduction
All possible models with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     1        0.23689        0.23689       0.04    0.8498
Error                    10       62.67978        6.26798 
Corrected Total          11       62.91667                

Root MSE              2.50359    R-Square     0.0038
Dependent Mean        4.58333    Adj R-Sq    -0.0959
Coeff Var            54.62385   

        Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS

Intercept     1        4.84809        1.54176       3.14      0.0104      252.08333       61.97728
X3            1       -0.05574        0.28671      -0.19      0.8498        0.23689        0.23689



30         proc reg data=one; model y = x1 x2 / ss1 ss2; run;
NOTE: 12 observations read.
NOTE: 12 observations used in computations.
NOTE: The PROCEDURE REG printed page 5.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


Generic multiple regression introduction
All possible models with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     2       24.07446       12.03723       2.79    0.1141
Error                     9       38.84220        4.31580 
Corrected Total          11       62.91667                

Root MSE              2.07745    R-Square     0.3826
Dependent Mean        4.58333    Adj R-Sq     0.2454
Coeff Var            45.32619   

        Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS

Intercept     1        1.07558        2.49743       0.43      0.6768      252.08333        0.80049
X1            1        0.63159        0.29369       2.15      0.0600       23.97763       19.95921
X2            1        0.04187        0.27955       0.15      0.8842        0.09684        0.09684



31         proc reg data=one; model y = x1 x3 / ss1 ss2; run;
NOTE: 12 observations read.
NOTE: 12 observations used in computations.
NOTE: The PROCEDURE REG printed page 6.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


Generic multiple regression introduction
All possible models with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     2       25.37078       12.68539       3.04    0.0980
Error                     9       37.54588        4.17176 
Corrected Total          11       62.91667                

Root MSE              2.04249    R-Square     0.4032
Dependent Mean        4.58333    Adj R-Sq     0.2706
Coeff Var            44.56341   

        Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS

Intercept     1        1.91576        1.73473       1.10      0.2981      252.08333        5.08794
X1            1        0.63161        0.25732       2.45      0.0365       23.97763       25.13390
X3            1       -0.13650        0.23621      -0.58      0.5775        1.39316        1.39316



32         proc reg data=one; model y = x2 x3 / ss1 ss2; run;
NOTE: 12 observations read.
NOTE: 12 observations used in computations.
NOTE: The PROCEDURE REG printed page 7.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


Generic multiple regression introduction
All possible models with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     2        4.13721        2.06860       0.32    0.7363
Error                     9       58.77946        6.53105 
Corrected Total          11       62.91667                

Root MSE              2.55559    R-Square     0.0658
Dependent Mean        4.58333    Adj R-Sq    -0.1419
Coeff Var            55.75837   

        Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS

Intercept     1        5.62891        1.87021       3.01      0.0147      252.08333       59.16272
X2            1       -0.24662        0.31913      -0.77      0.4595        4.11526        3.90032
X3            1        0.01784        0.30776       0.06      0.9550        0.02195        0.02195



33         proc reg data=one; model y = x1 x2 x3 / ss1 ss2; run;
NOTE: 12 observations read.
NOTE: 12 observations used in computations.
34   
NOTE: The PROCEDURE REG printed page 8.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


Generic multiple regression introduction
All possible models with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     3       26.18995        8.72998       1.90    0.2078
Error                     8       36.72672        4.59084 
Corrected Total          11       62.91667                

Root MSE              2.14262    R-Square     0.4163
Dependent Mean        4.58333    Adj R-Sq     0.1974
Coeff Var            46.74817   

        Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS

Intercept     1        1.14454        2.57778       0.44      0.6688      252.08333        0.90503
X1            1        0.70578        0.32202       2.19      0.0598       23.97763       22.05274
X2            1        0.13483        0.31918       0.42      0.6838        0.09684        0.81916
X3            1       -0.18621        0.27431      -0.68      0.5164        2.11548        2.11548



35         proc mixed data=one; model y = x1 x2 x3 / solution HType=1 2 3;
36            title2 'Multiple Regression with PROC MIXED';
37         run;
NOTE: The PROCEDURE MIXED printed page 9.
NOTE: PROCEDURE MIXED used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds



Generic multiple regression introduction
Multiple Regression with PROC MIXED

The Mixed Procedure

Model Information
Data Set                     WORK.ONE  
Dependent Variable           Y    
Covariance Structure         Diagonal  
Estimation Method            REML 
Residual Variance Method     Profile   
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Residual  

Dimensions
Covariance Parameters             1
Columns in X                      4
Columns in Z                      0
Subjects                          1
Max Obs Per Subject              12
Observations Used                12
Observations Not Used             0
Total Observations               12

Covariance Parameter Estimates
Cov Parm   Estimate
Residual       4.5908

Fit Statistics
-2 Res Log Likelihood            49.7
AIC (smaller is better)          51.7
AICC (smaller is better)         52.3
BIC (smaller is better)          51.7

Solution for Fixed Effects
                         Standard
Effect       Estimate       Error      DF    t Value    Pr > |t|
Intercept      1.1445      2.5778       8       0.44      0.6688
X1             0.7058      0.3220       8       2.19      0.0598
X2             0.1348      0.3192       8       0.42      0.6838
X3            -0.1862      0.2743       8      -0.68      0.5164

Type 1 Tests of Fixed Effects

              Num     Den
Effect         DF      DF    F Value    Pr > F
X1              1       8       5.22    0.0516
X2              1       8       0.02    0.8881
X3              1       8       0.46    0.5164

Type 2 Tests of Fixed Effects

              Num     Den
Effect         DF      DF    F Value    Pr > F
X1              1       8       4.80    0.0598
X2              1       8       0.18    0.6838
X3              1       8       0.46    0.5164

Type 3 Tests of Fixed Effects
              Num     Den
Effect         DF      DF    F Value    Pr > F
X1              1       8       4.80    0.0598
X2              1       8       0.18    0.6838
X3              1       8       0.46    0.5164



38         proc glm data=one; model y = x1 x2 x3 / solution ss1 ss2 ss3 ss4;
39            title2 'Multiple Regression with PROC GLM';
40         run;
41   
NOTE: The PROCEDURE GLM printed pages 10-11.
NOTE: PROCEDURE GLM used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           1.42 seconds
      cpu time            0.43 seconds


Generic multiple regression introduction
Multiple Regression with PROC GLM

The GLM Procedure

Number of observations    12


Dependent Variable: Y  

                                        Sum of
Source                      DF         Squares     Mean Square    F Value    Pr > F
Model                        3     26.18994658      8.72998219       1.90    0.2078
Error                        8     36.72672008      4.59084001 
Corrected Total             11     62.91666667                 

R-Square     Coeff Var      Root MSE        Y Mean
0.416264      46.74817      2.142625      4.583333

Source                      DF       Type I SS     Mean Square    F Value    Pr > F
X1                           1     23.97762646     23.97762646       5.22    0.0516
X2                           1      0.09683730      0.09683730       0.02    0.8881
X3                           1      2.11548283      2.11548283       0.46    0.5164

Source                      DF      Type II SS     Mean Square    F Value    Pr > F
X1                           1     22.05273729     22.05273729       4.80    0.0598
X2                           1      0.81916182      0.81916182       0.18    0.6838
X3                           1      2.11548283      2.11548283       0.46    0.5164

Source                      DF     Type III SS     Mean Square    F Value    Pr > F
X1                           1     22.05273729     22.05273729       4.80    0.0598
X2                           1      0.81916182      0.81916182       0.18    0.6838
X3                           1      2.11548283      2.11548283       0.46    0.5164

Source                      DF      Type IV SS     Mean Square    F Value    Pr > F
X1                           1     22.05273729     22.05273729       4.80    0.0598
X2                           1      0.81916182      0.81916182       0.18    0.6838
X3                           1      2.11548283      2.11548283       0.46    0.5164

                                  Standard
Parameter         Estimate           Error    t Value    Pr > |t|
Intercept      1.144541173      2.57777758       0.44      0.6688
X1             0.705779391      0.32202071       2.19      0.0598
X2             0.134827053      0.31918191       0.42      0.6838
X3            -0.186211994      0.27431463      -0.68      0.5164




Last modified
by James P. Geaghan
on Wednesday, August 14, 2003