Original Program from program editor.


options ps=256 ls=99 nocenter nodate nonumber nolabel;
TITLE1 'Example of Multiple Regression (MLR)';

DATA SENIC; Infile cards missover;
  TITLE2 'SENIC database from NKNW 1996 (Appendix C)';
  INPUT IDNo LtofStay Age InfRisk CulRatio XRay NoBeds MedSch Region Census Nurses Services;
*** label IDNo   = 'Identification number'
        LtofStay = 'Length of stay (days)'
        Age      = 'Patient age (years)'
        InfRisk  = 'Average Infection risk (%)'
        CulRatio = 'ratio cultures to patients w/o symptoms'
        XRay     = 'ratio xrays to patients w/o symptoms'
        NoBeds   = 'Average no. of beds in hosp.'
        MedSch   = 'Med School Affiliation'
        Region   = 'Region NE, NC, S, W'
        Census   = 'Average no. patients in hosp.'
        Nurses   = 'Av. no. nurses'
        Services = '% of 35 potential service facilities';
CARDS; Run;
  1   7.13  55.7  4.1   9.0   39.6  279  2  4  207  241  60.0
  2   8.82  58.2  1.6   3.8   51.7   80  2  2   51   52  40.0
  3   8.34  56.9  2.7   8.1   74.0  107  2  3   82   54  20.0
  4   8.95  53.7  5.6  18.9  122.8  147  2  4   53  148  40.0
  5  11.20  56.5  5.7  34.5   88.9  180  2  1  134  151  40.0
  6   9.76  50.9  5.1  21.9   97.0  150  2  2  147  106  40.0
  7   9.68  57.8  4.6  16.7   79.0  186  2  3  151  129  40.0
  8  11.18  45.7  5.4  60.5   85.8  640  1  2  399  360  60.0
  9   8.67  48.2  4.3  24.4   90.8  182  2  3  130  118  40.0
 10   8.84  56.3  6.3  29.6   82.6   85  2  1   59   66  40.0
 11  11.07  53.2  4.9  28.5  122.0  768  1  1  591  656  80.0
 12   8.30  57.2  4.3   6.8   83.8  167  2  3  105   59  40.0
 13  12.78  56.8  7.7  46.0  116.9  322  1  1  252  349  57.1
 14   7.58  56.7  3.7  20.8   88.0   97  2  2   59   79  37.1
 15   9.00  56.3  4.2  14.6   76.4   72  2  3   61   38  17.1
 16  11.08  50.2  5.5  18.6   63.6  387  2  3  326  405  57.1
 17   8.28  48.1  4.5  26.0  101.8  108  2  4   84   73  37.1
 18  11.62  53.9  6.4  25.5   99.2  133  2  1  113  101  37.1
 19   9.06  52.8  4.2   6.9   75.9  134  2  2  103  125  37.1
 20   9.35  53.8  4.1  15.9   80.9  833  2  3  547  519  77.1
 21   7.53  42.0  4.2  23.1   98.9   95  2  4   47   49  17.1
 22  10.24  49.0  4.8  36.3  112.6  195  2  2  163  170  37.1
 23   9.78  52.3  5.0  17.6   95.9  270  1  1  240  198  57.1
 24   9.84  62.2  4.8  12.0   82.3  600  2  3  468  497  57.1
 25   9.20  52.2  4.0  17.5   71.1  298  1  4  244  236  57.1
 26   8.28  49.5  3.9  12.0  113.1  546  1  2  413  436  57.1
 27   9.31  47.2  4.5  30.2  101.3  170  2  1  124  173  37.1
 28   8.19  52.1  3.2  10.8   59.2  176  2  1  156   88  37.1
 29  11.65  54.5  4.4  18.6   96.1  248  2  1  217  189  37.1
 30   9.89  50.5  4.9  17.7  103.6  167  2  2  113  106  37.1
 31  11.03  49.9  5.0  19.7  102.1  318  2  1  270  335  57.1
 32   9.84  53.0  5.2  17.7   72.6  210  2  2  200  239  54.3
 33  11.77  54.1  5.3  17.3   56.0  196  2  1  164  165  34.3
 34  13.59  54.0  6.1  24.2  111.7  312  2  1  258  169  54.3
 35   9.74  54.4  6.3  11.4   76.1  221  2  2  170  172  54.3
 36  10.33  55.8  5.0  21.2  104.3  266  2  1  181  149  54.3
 37   9.97  58.2  2.8  16.5   76.5   90  2  2   69   42  34.3
 38   7.84  49.1  4.6   7.1   87.9   60  2  3   50   45  34.3
 39  10.47  53.2  4.1   5.7   69.1  196  2  2  168  153  54.3
 40   8.16  60.9  1.3   1.9   58.0   73  2  3   49   21  14.3
 41   8.48  51.1  3.7  12.1   92.8  166  2  3  145  118  34.3
 42  10.72  53.8  4.7  23.2   94.1  113  2  3   90  107  34.3
 43  11.20  45.0  3.0   7.0   78.9  130  2  3   95   56  34.3
 44  10.12  51.7  5.6  14.9   79.1  362  1  3  313  264  54.3
 45   8.37  50.7  5.5  15.1   84.8  115  2  2   96   88  34.3
 46  10.16  54.2  4.6   8.4   51.5  831  1  4  581  629  74.3
 47  19.56  59.9  6.5  17.2  113.7  306  2  1  273  172  51.4
 48  10.90  57.2  5.5  10.6   71.9  593  2  2  446  211  51.4
 49   7.67  51.7  1.8   2.5   40.4  106  2  3   93   35  11.4
 50   8.88  51.5  4.2  10.1   86.9  305  2  3  238  197  51.4
 51  11.48  57.6  5.6  20.3   82.0  252  2  1  207  251  51.4
 52   9.23  51.6  4.3  11.6   42.6  620  2  2  413  420  71.4
 53  11.41  61.1  7.6  16.6   97.9  535  2  3  330  273  51.4
 54  12.07  43.7  7.8  52.4  105.3  157  2  2  115   76  31.4
 55   8.63  54.0  3.1   8.4   56.2   76  2  1   39   44  31.4
 56  11.15  56.5  3.9   7.7   73.9  281  2  1  217  199  51.4
 57   7.14  59.0  3.7   2.6   75.8   70  2  4   37   35  31.4
 58   7.65  47.1  4.3  16.4   65.7  318  2  4  265  314  51.4
 59  10.73  50.6  3.9  19.3  101.0  445  1  2  374  345  51.4
 60  11.46  56.9  4.5  15.6   97.7  191  2  3  153  132  31.4
 61  10.42  58.0  3.4   8.0   59.0  119  2  1   67   64  31.4
 62  11.18  51.0  5.7  18.8   55.9  595  1  2  546  392  68.6
 63   7.93  64.1  5.4   7.5   98.1   68  2  4   42   49  28.6
 64   9.66  52.1  4.4   9.9   98.3   83  2  2   66   95  28.6
 65   7.78  45.5  5.0  20.9   71.6  489  2  3  391  329  48.6
 66   9.42  50.6  4.3  24.8   62.8  508  2  1  421  528  48.6
 67  10.02  49.5  4.4   8.3   93.0  265  2  2  191  202  48.6
 68   8.58  55.0  3.7   7.4   95.9  304  2  3  248  218  48.6
 69   9.61  52.4  4.5   6.9   87.2  487  2  3  404  220  48.6
 70   8.03  54.2  3.5  24.3   87.3   97  2  1   65   55  28.6
 71   7.39  51.0  4.2  14.6   88.4   72  2  2   38   67  28.6
 72   7.08  52.0  2.0  12.3   56.4   87  2  3   52   57  28.6
 73   9.53  51.5  5.2  15.0   65.7  298  2  3  241  193  48.6
 74  10.05  52.0  4.5  36.7   87.5  184  1  1  144  151  68.6
 75   8.45  38.8  3.4  12.9   85.0  235  2  2  143  124  48.6
 76   6.70  48.6  4.5  13.0   80.8   76  2  4   51   79  28.6
 77   8.90  49.7  2.9  12.7   86.9   52  2  1   37   35  28.6
 78  10.23  53.2  4.9   9.9   77.9  752  1  2  595  446  68.6
 79   8.88  55.8  4.4  14.1   76.8  237  2  2  165  182  48.6
 80  10.30  59.6  5.1  27.8   88.9  175  2  2  113   73  45.7
 81  10.79  44.2  2.9   2.6   56.6  461  1  2  320  196  65.7
 82   7.94  49.5  3.5   6.2   92.3  195  2  2  139  116  45.7
 83   7.63  52.1  5.5  11.6   61.1  197  2  4  109  110  45.7
 84   8.77  54.5  4.7   5.2   47.0  143  2  4   85   87  25.7
 85   8.09  56.9  1.7   7.6   56.9   92  2  3   61   61  45.7
 86   9.05  51.2  4.1  20.5   79.8  195  2  3  127  112  45.7
 87   7.91  52.8  2.9  11.9   79.5  477  2  3  349  188  65.7
 88  10.39  54.6  4.3  14.0   88.3  353  2  2  223  200  65.7
 89   9.36  54.1  4.8  18.3   90.6  165  2  1  127  158  45.7
 90  11.41  50.4  5.8  23.8   73.0  424  1  3  359  335  45.7
 91   8.86  51.3  2.9   9.5   87.5  100  2  3   65   53  25.7
 92   8.93  56.0  2.0   6.2   72.5   95  2  3   59   56  25.7
 93   8.92  53.9  1.3   2.2   79.5   56  2  2   40   14   5.7
 94   8.15  54.9  5.3  12.3   79.8   99  2  4   55   71  25.7
 95   9.77  50.2  5.3  15.7   89.7  154  2  2  123  148  25.7
 96   8.54  56.1  2.5  27.0   82.5   98  2  1   57   75  45.7
 97   8.66  52.8  3.8   6.8   69.5  246  2  3  178  177  45.7
 98  12.01  52.8  4.8  10.8   96.9  298  2  1  237  115  45.7
 99   7.95  51.8  2.3   4.6   54.9  163  2  3  128   93  42.9
100  10.15  51.9  6.2  16.4   59.2  568  1  3  452  371  62.9
101   9.76  53.2  2.6   6.9   80.1   64  2  4   47   55  22.9
102   9.89  45.2  4.3  11.8  108.7  190  2  1  141  112  42.9
103   7.14  57.6  2.7  13.1   92.6   92  2  4   40   50  22.9
104  13.95  65.9  6.6  15.6  133.5  356  2  1  308  182  62.9
105   9.44  52.5  4.5  10.9   58.5  297  2  3  230  263  42.9
106  10.80  63.9  2.9   1.6   57.4  130  2  3   69   62  22.9
107   7.14  51.7  1.4   4.1   45.7  115  2  3   90   19  22.9
108   8.02  55.0  2.1   3.8   46.5   91  2  2   44   32  22.9
109  11.80  53.8  5.7   9.1  116.9  571  1  2  441  469  62.9
110   9.50  49.3  5.8  42.0   70.9   98  2  3   68   46  22.9
111   7.70  56.9  4.4  12.2   67.9  129  2  4   85  136  62.9
112  17.94  56.2  5.9  26.4   91.8  835  1  1  791  407  62.9
113   9.41  59.5  3.1  20.6   91.7   29  2  3   20   22  22.9
;
OPTIONS PS=50 LS=120;
proc plot data=senic; PLOT InfRisk*ltofstay;
   TITLE3 'Scatter plot on one of the independent variables';
run;
OPTIONS PS=256 LS=99;

proc reg data=SENIC LINEPRINTER;
   TITLE3'PROC REG analysis with selected variables';
   model InfRisk = LtofStay Age Nurses;
   output out=next1 p=YHat r=e;
run;
   OPTIONS PS=50 LS=120; PLOT RESIDUAL.*PREDICTED. / VREF=0;
Run;  OPTIONS PS=256 LS=99;

proc univariate data=next1 normal plot; var e;
    TITLE4 'Univariate analysis of residuals';
run;
OPTIONS PS=50 LS=120;
proc plot data=next1; PLOT e*YHat / VREF=0;
    TITLE4 'Residual plot';
run;    OPTIONS PS=256 LS=99;

proc reg data=SENIC;
   TITLE3 'Stepwise regression - backward selection';
   model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services
                 / selection=backward;
Run;

proc reg data=SENIC;
   TITLE3 'Stepwise regression - stepwise selection';
   model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services
                 / selection=stepwise;
Run;

proc reg data=SENIC;
   TITLE3 'Multiple regression - RSquare option';
   model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services
                 / selection=rsquare start=3 stop=6 best=8;
Run;

proc glm data=SENIC;
   TITLE3 'Full Model done in GLM';
   model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services;
RUN;
QUIT;

Proc reg data=senic;
   TITLE3 'Extra sum of squares';
    model InfRisk = LtofStay / ss1 ss2;
    model InfRisk = Age / ss1 ss2;
    model InfRisk = Nurses / ss1 ss2;
    model InfRisk = LtofStay Age / ss1 ss2;
    model InfRisk = LtofStay Nurses / ss1 ss2;
    model InfRisk = Age Nurses / ss1 ss2;
    model InfRisk = LtofStay Age Nurses / ss1 ss2;
run;



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



1          options ps=256 ls=99 nocenter nodate nonumber nolabel;
2          TITLE1 'Example of Multiple Regression (MLR)';
3    
4          DATA SENIC; Infile cards missover;
5            TITLE2 'SENIC database from NKNW 1996 (Appendix C)';
6            INPUT IDNo LtofStay Age InfRisk CulRatio XRay NoBeds MedSch Region Census Nurses
6        ! Services;
7          *** label IDNo   = 'Identification number'
8                  LtofStay = 'Length of stay (days)'
9                  Age      = 'Patient age (years)'
10                 InfRisk  = 'Average Infection risk (%)'
11                 CulRatio = 'ratio cultures to patients w/o symptoms'
12                 XRay     = 'ratio xrays to patients w/o symptoms'
13                 NoBeds   = 'Average no. of beds in hosp.'
14                 MedSch   = 'Med School Affiliation'
15                 Region   = 'Region NE, NC, S, W'
16                 Census   = 'Average no. patients in hosp.'
17                 Nurses   = 'Av. no. nurses'
18                 Services = '% of 35 potential service facilities';
19         CARDS;
NOTE: The data set WORK.SENIC has 113 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

19       !        Run;
133        ;
134        OPTIONS PS=50 LS=120;
135        proc plot data=senic; PLOT InfRisk*ltofstay;
136           TITLE3 'Scatter plot on one of the independent variables';
137        run;
138        OPTIONS PS=256 LS=99;
139  
NOTE: There were 113 observations read from the data set WORK.SENIC.
NOTE: The PROCEDURE PLOT printed page 1.
NOTE: PROCEDURE PLOT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
Scatter plot on one of the independent variables

                             Plot of InfRisk*LtofStay.  Legend: A = 1 obs, B = 2 obs, etc.

       InfRisk |
             8 +
               |                                         A    A
               |                                     A
               |
               |
             7 +
               |
               |                                                      A                                   A
               |                    A     A            A
               |                             A                     A
             6 +                                                                                A
               |                         A          BA  A
               |             A   A   A       A    AA  A
               |               AA          A        A   A
               |                         AAA  A
             5 +              A            B AA    B
               |                    A   A  A  A  A       A
               |       A      A  A      BAA AA       A
               |             B   A A A AA AAA  A       A
               |         A AA        AC A      A
             4 +                 A     A         A A
               |         A  A     AB
               |               B
               |                  A            A
               |                A  A    A
             3 +              A      B           B  A
               |         A       A          A
               |                   A      A
               |               A
               |               A
             2 +         A           A
               |             A  A
               |                    A
               |         A      A    A
               |
             1 +
               |
               ---+------------+------------+------------+------------+------------+------------+------------+--
                  6            8           10           12           14           16           18           20
                                                            LtofStay



140        proc reg data=SENIC LINEPRINTER;
141           TITLE3'PROC REG analysis with selected variables';
142           model InfRisk = LtofStay Age Nurses;
143           output out=next1 p=YHat r=e;
144        run;
NOTE: 113 observations read.
NOTE: 113 observations used in computations.
145           OPTIONS PS=50 LS=120; PLOT RESIDUAL.*PREDICTED. / VREF=0;
146        Run;
146      !       OPTIONS PS=256 LS=99;
147
NOTE: The data set WORK.NEXT1 has 113 observations and 14 variables.
NOTE: The PROCEDURE REG printed pages 2-3.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
PROC REG analysis with selected variables

The REG Procedure
Model: MODEL1
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     3       68.46806       22.82269      18.72    <.0001
Error                   109      132.91176        1.21937
Corrected Total         112      201.37982

Root MSE              1.10425    R-Square     0.3400
Dependent Mean        4.35487    Adj R-Sq     0.3218
Coeff Var            25.35675

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|
Intercept     1        1.89700        1.29112       1.47      0.1446
LtofStay      1        0.32864        0.05968       5.51      <.0001
Age           1       -0.02057        0.02412      -0.85      0.3958
Nurses        1        0.00220     0.00080714       2.73      0.0074




           ------+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-------
  RESIDUAL |                                                                                                           |
           |                                                                                                           |
         3 +                                                                                                           +
           |                                                                                                           |
           |                     1                       1  1                                                          |
           |                                                                                                           |
           |           1                                                                                               |
         2 +                 1              1                          1                                               +
           |                     1                                                                                     |
           |                 1        11              1                                                                |
           |                                                                                                           |
           |          1                                  1                                                             |
         1 +                1                       1               1                                                  +
R          |             1  11   11      111 2      2                                                                  |
e          |       1         1           1  1 2 1         1                                                            |
s          |             1    1  1    1 1                       11    1                                                |
i          |                         11 11  1   1 1      1       1                                                     |
d        0 +                1         1  1    21                 1     1                                               +
u          |                    1  1  1       1  1   1  11  1 1                                                        |
a          |        1                 1     1    11  1                                                                 |
l          |                   2                1        1                                                             |
           |                 1   1      1 1                1                                                           |
        -1 +                     111                  1  1         1       1                              1            +
           |           1       1      1                     1                                                          |
           |              1   1           1                                                                            |
           |              1             1                                                                   1          |
           |         1     1     1                   1                                                                 |
        -2 +            1                               1                                                              +
           |                   1                                                                                       |
           |                    1                                                                                      |
           |                                                                                                           |
           |                                                                                                           |
        -3 +                                                                                                           +
           |                                                                                                           |
           |                                                                                                           |
           ------+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-------
               3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50 6.75 7.00 7.25 7.50 7.75
                                                Predicted Value of InfRisk     PRED





148        proc univariate data=next1 normal plot; var e;
149            TITLE4 'Univariate analysis of residuals';
150        run;
NOTE: The PROCEDURE UNIVARIATE printed page 4.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
PROC REG analysis with selected variables
Univariate analysis of residuals

The UNIVARIATE Procedure
Variable:  e

Moments
N                         113    Sum Weights                113
Mean                        0    Sum Observations             0
Std Deviation       1.0893632    Variance            1.18671217
Skewness           0.12446139    Kurtosis            -0.1681454
Uncorrected SS     132.911763    Corrected SS        132.911763
Coeff Variation             .    Std Error Mean      0.10247867

Basic Statistical Measures
    Location                    Variability

Mean     0.000000     Std Deviation            1.08936
Median   0.034938     Variance                 1.18671
Mode      .           Range                    5.11840
                      Interquartile Range      1.52582

Tests for Location: Mu0=0n
Test           -Statistic-    -----p Value------
Student's t    t         0    Pr > |t|    1.0000
Sign           M       2.5    Pr >= |M|   0.7069
Signed Rank    S     -34.5    Pr >= |S|   0.9218

Tests for Normality
Test                  --Statistic---    -----p Value------
Shapiro-Wilk          W     0.989495    Pr < W      0.5355
Kolmogorov-Smirnov    D     0.054321    Pr > D     >0.1500
Cramer-von Mises      W-Sq  0.036762    Pr > W-Sq  >0.2500
Anderson-Darling      A-Sq  0.282125    Pr > A-Sq  >0.2500

Quantiles (Definition 5)
Quantile      Estimate
100% Max       2.6675258
99%            2.6081781
95%            1.9417749
90%            1.5398900
75% Q3         0.7101761
50% Median     0.0349382
25% Q1        -0.8156473
10%           -1.3721342
5%            -1.8199663
1%            -2.1133088
0% Min        -2.4508710

Extreme Observations
------Lowest-----        -----Highest-----

   Value      Obs           Value      Obs

-2.45087       93         2.00204       13
-2.11331        2         2.10713       63
-2.07257       40         2.51020       10
-2.06595       81         2.60818       53
-1.82215      107         2.66753       54

   Stem Leaf  Boxplot
     26 17                       2     |
     24 1                        1     |
     22                                |
     20 01                       2     |
     18 24                       2     |
     16 900                      3     |
     14 47                       2     |
     12 23                       2     |
     10 47                       2     |
      8 01456805                 8     |
      6 312368                   6  +-----+
      4 235773366899            12  |     |
      2 88013                    5  |     |
      0 013440345779            12  *--+--*
     -0 965420                   6  |     |
     -2 7738554321              10  |     |
     -4 1987                     4  |     |
     -6 51622                    5  |     |
     -8 98774211972             11  +-----+
    -10                                |
    -12 7758742                  7     |
    -14 3                        1     |
    -16 833                      3     |
    -18 220                      3     |
    -20 177                      3     |
    -22                                |
    -24 5                        1     |
        ----+----+----+----+
    Multiply Stem.Leaf by 10**-1

Normal Probability Plot
     2.7+                                               * +*
        |                                             *  +
        |                                              ++
        |                                          * *+
        |                                         *++
        |                                       **+
        |                                      *+
        |                                     *
        |                                   +*
        |                                 ****
        |                               ***
        |                            ****
        |                           **
     0.1+                         ***
        |                       **
        |                     ***
        |                    **
        |                  +**
        |               ****
        |              ++
        |            ****
        |           +*
        |         +**
        |       +**
        |   * **
        |   ++
    -2.5+* +
         +----+----+----+----+----+----+----+----+----+----+
             -2        -1         0        +1        +2





151        OPTIONS PS=50 LS=120;
152        proc plot data=next1; PLOT e*YHat / VREF=0;
153            TITLE4 'Residual plot';
154        run;
154      !         OPTIONS PS=256 LS=99;
155
NOTE: There were 113 observations read from the data set WORK.NEXT1.
NOTE: The PROCEDURE PLOT printed page 5.
NOTE: PROCEDURE PLOT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds






Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
PROC REG analysis with selected variables
Residual plot

                                  Plot of e*YHat.  Legend: A = 1 obs, B = 2 obs, etc.

 3 +
   |
   |                                              A  A
   |                   A
   |
   |        A
 2 +               A                A                            A
   |
   |               A    A     A
   |                         A                A
   |
   |        A                                     A
 1 +              A                         A                 A
   |           A  A      A       BA  B      A
   |    A          AA  A         A      A    A
 e |                A  A        A   A B            A      A     A
   |           A            A A                   A       A
   |                         A A A  A   A A                A
 0 +--------------A----------A--A-----BA-------------------A-----A-----------------------------------------------------
   |                  A   A  A        A   A      AA  A A
   |                         A      A     A  A
   |      A           A                  A   A
   |                  A A      A        A         A
   |               A              A               A  A       A
-1 +                    AB                    A                       A                                 A
   |                  A                              A
   |        A   A   A         A   A
   |                           A
   |           A                                                                                          A
   |       A     A      A                    A
-2 +          A                                  A
   |                  A
   |
   |                   A
   |
   |
-3 +
   ---+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+--
     3.0        3.5        4.0        4.5        5.0        5.5        6.0        6.5        7.0        7.5        8.0
                                                           Yhat



156        proc reg data=SENIC;
157           TITLE3 'Stepwise regression - backward selection';
158           model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services
159                         / selection=backward;
160        Run;
NOTE: 113 observations read.
NOTE: 113 observations used in computations.
161
NOTE: The PROCEDURE REG printed page 6.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
Stepwise regression - backward selection

The REG Procedure
Model: MODEL1
Dependent Variable: InfRisk

Backward Elimination: Step 0

All Variables Entered: R-Square = 0.5251 and C(p) = 9.0000

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     8      105.74000       13.21750      14.37    <.0001
Error                   104       95.63982        0.91961
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept     -0.74726      1.20763      0.35211     0.38  0.5374
LtofStay       0.17693      0.06906      6.03648     6.56  0.0118
Age            0.01621      0.02226      0.48809     0.53  0.4679
CulRatio       0.04699      0.01075     17.57678    19.11  <.0001
XRay           0.01204      0.00549      4.42782     4.81  0.0304
NoBeds        -0.00145      0.00271      0.26220     0.29  0.5945
Census      0.00072796      0.00347      0.04044     0.04  0.8343
Nurses         0.00191      0.00175      1.08719     1.18  0.2794
Services       0.01628      0.01019      2.34765     2.55  0.1131

Bounds on condition number: 34.702, 674.59
---------------------------------------------------------------------------------------------

Backward Elimination: Step 1
Variable Census Removed: R-Square = 0.5249 and C(p) = 7.0440

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     7      105.69957       15.09994      16.57    <.0001
Error                   105       95.68026        0.91124
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept     -0.76082      1.20039      0.36606     0.40  0.5276
LtofStay       0.18363      0.06095      8.27183     9.08  0.0032
Age            0.01557      0.02195      0.45899     0.50  0.4795
CulRatio       0.04665      0.01057     17.73508    19.46  <.0001
XRay           0.01196      0.00545      4.39134     4.82  0.0303
NoBeds     -0.00094901      0.00130      0.48680     0.53  0.4665
Nurses         0.00199      0.00170      1.24827     1.37  0.2445
Services       0.01614      0.01012      2.31695     2.54  0.1138
Bounds on condition number: 7.7057, 162.09
----------------------------------------------------------------------------------------------

Backward Elimination: Step 2
Variable Age Removed: R-Square = 0.5226 and C(p) = 5.5431

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     6      105.24057       17.54010      19.34    <.0001
Error                   106       96.13925        0.90697
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept     -0.01195      0.57099   0.00039725     0.00  0.9833
LtofStay       0.19699      0.05783     10.52453    11.60  0.0009
CulRatio       0.04448      0.01010     17.59563    19.40  <.0001
XRay           0.01189      0.00543      4.33823     4.78  0.0309
NoBeds        -0.00103      0.00129      0.57917     0.64  0.4260
Nurses         0.00200      0.00170      1.26422     1.39  0.2404
Services       0.01637      0.01009      2.38761     2.63  0.1077
Bounds on condition number: 7.6446, 129.79
----------------------------------------------------------------------------------------------

Backward Elimination: Step 3
Variable NoBeds Removed: R-Square = 0.5197 and C(p) = 4.1729

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     5      104.66141       20.93228      23.16    <.0001
Error                   107       96.71842        0.90391
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept      0.08173      0.55788      0.01940     0.02  0.8838
LtofStay       0.18315      0.05508      9.99423    11.06  0.0012
CulRatio       0.04567      0.00997     18.96154    20.98  <.0001
XRay           0.01247      0.00538      4.86433     5.38  0.0223
Nurses      0.00093910      0.00105      0.72307     0.80  0.3731
Services       0.01400      0.00963      1.91090     2.11  0.1489
Bounds on condition number: 2.6532, 46.546
----------------------------------------------------------------------------------------------

Backward Elimination: Step 4
Variable Nurses Removed: R-Square = 0.5161 and C(p) = 2.9592

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     4      103.93833       25.98458      28.80    <.0001
Error                   108       97.44149        0.90224
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept     -0.06358      0.53321      0.01283     0.01  0.9053
LtofStay       0.18841      0.05471     10.69867    11.86  0.0008
CulRatio       0.04645      0.00992     19.76510    21.91  <.0001
XRay           0.01205      0.00535      4.57751     5.07  0.0263
Services       0.02047      0.00635      9.37912    10.40  0.0017
Bounds on condition number: 1.3578, 20.506
----------------------------------------------------------------------------------------------

All variables left in the model are significant at the 0.1000 level.

                          Summary of Backward Elimination
        Variable     Number     Partial      Model
Step    Removed      Vars In    R-Square    R-Square     C(p)      F Value    Pr > F
  1     Census           7       0.0002      0.5249      7.0440       0.04    0.8343
  2     Age              6       0.0023      0.5226      5.5431       0.50    0.4795
  3     NoBeds           5       0.0029      0.5197      4.1729       0.64    0.4260
  4     Nurses           4       0.0036      0.5161      2.9592       0.80    0.3731



162        proc reg data=SENIC;
163           TITLE3 'Stepwise regression - stepwise selection';
164           model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services
165                         / selection=stepwise;
166        Run;
NOTE: 113 observations read.
NOTE: 113 observations used in computations.
167
NOTE: The PROCEDURE REG printed page 7.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
Stepwise regression - stepwise selection

The REG Procedure
Model: MODEL1
Dependent Variable: InfRisk

Stepwise Selection: Step 1
Variable CulRatio Entered: R-Square = 0.3127 and C(p) = 41.5161

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     1       62.96314       62.96314      50.49    <.0001
Error                   111      138.41668        1.24700
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept      3.19790      0.19377    339.64906   272.37  <.0001
CulRatio       0.07326      0.01031     62.96314    50.49  <.0001
Bounds on condition number: 1, 1
----------------------------------------------------------------------------------------------

Stepwise Selection: Step 2
Variable LtofStay Entered: R-Square = 0.4504 and C(p) = 13.3525

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     2       90.70199       45.35099      45.07    <.0001
Error                   110      110.67784        1.00616
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept      0.80549      0.48776      2.74400     2.73  0.1015
LtofStay       0.27547      0.05246     27.73885    27.57  <.0001
CulRatio       0.05645      0.00980     33.39688    33.19  <.0001
Bounds on condition number: 1.1195, 4.4779
----------------------------------------------------------------------------------------------

Stepwise Selection: Step 3

Variable Services Entered: R-Square = 0.4934 and C(p) = 5.9368
Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     3       99.36082       33.12027      35.39    <.0001
Error                   109      102.01900        0.93595
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept      0.49133      0.48164      0.97402     1.04  0.3099
LtofStay       0.22391      0.05337     16.47665    17.60  <.0001
CulRatio       0.05420      0.00948     30.59828    32.69  <.0001
Services       0.01963      0.00645      8.65884     9.25  0.0029
Bounds on condition number: 1.2451, 10.57
----------------------------------------------------------------------------------------------

Stepwise Selection: Step 4
Variable XRay Entered: R-Square = 0.5161 and C(p) = 2.9592

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     4      103.93833       25.98458      28.80    <.0001
Error                   108       97.44149        0.90224
Corrected Total         112      201.37982

             Parameter     Standard
Variable      Estimate        Error   Type II SS  F Value  Pr > F
Intercept     -0.06358      0.53321      0.01283     0.01  0.9053
LtofStay       0.18841      0.05471     10.69867    11.86  0.0008
CulRatio       0.04645      0.00992     19.76510    21.91  <.0001
XRay           0.01205      0.00535      4.57751     5.07  0.0263
Services       0.02047      0.00635      9.37912    10.40  0.0017
Bounds on condition number: 1.3578, 20.506
----------------------------------------------------------------------------------------------

All variables left in the model are significant at the 0.1500 level.

No other variable met the 0.1500 significance level for entry into the model.

                                  Summary of Stepwise Selection
        Variable     Variable     Number     Partial      Model
Step    Entered      Removed      Vars In    R-Square    R-Square     C(p)      F Value    Pr > F
  1     CulRatio                      1       0.3127      0.3127     41.5161      50.49    <.0001
  2     LtofStay                      2       0.1377      0.4504     13.3525      27.57    <.0001
  3     Services                      3       0.0430      0.4934      5.9368       9.25    0.0029
  4     XRay                          4       0.0227      0.5161      2.9592       5.07    0.0263




168        proc reg data=SENIC;
169           TITLE3 'Multiple regression - RSquare option';
170           model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services
171                         / selection=rsquare start=3 stop=6 best=8;
172        Run;
NOTE: 113 observations read.
NOTE: 113 observations used in computations.
173
NOTE: The PROCEDURE REG printed page 8.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
Multiple regression - RSquare option

The REG Procedure
Model: MODEL1
Dependent Variable: InfRisk

R-Square Selection Method

Number in
  Model      R-Square    Variables in Model

       3       0.4934    LtofStay CulRatio Services
       3       0.4852    LtofStay CulRatio Nurses
       3       0.4736    LtofStay CulRatio NoBeds
       3       0.4735    LtofStay CulRatio Census
       3       0.4696    LtofStay CulRatio XRay
       3       0.4630    CulRatio XRay Services
       3       0.4619    CulRatio XRay Census
       3       0.4538    CulRatio XRay Nurses
----------------------------------------------------------------------------------
       4       0.5161    LtofStay CulRatio XRay Services
       4       0.5102    LtofStay CulRatio XRay Nurses
       4       0.5000    LtofStay CulRatio XRay Census
       4       0.4997    LtofStay CulRatio XRay NoBeds
       4       0.4956    LtofStay CulRatio Nurses Services
       4       0.4956    LtofStay Age CulRatio Services
       4       0.4935    LtofStay CulRatio NoBeds Services
       4       0.4934    LtofStay CulRatio Census Services
----------------------------------------------------------------------------------
       5       0.5197    LtofStay CulRatio XRay Nurses Services
       5       0.5183    LtofStay Age CulRatio XRay Services
       5       0.5166    LtofStay CulRatio XRay Census Services
       5       0.5163    LtofStay CulRatio XRay NoBeds Services
       5       0.5130    LtofStay Age CulRatio XRay Nurses
       5       0.5107    LtofStay CulRatio XRay NoBeds Nurses
       5       0.5106    LtofStay CulRatio XRay Census Nurses
       5       0.5033    LtofStay Age CulRatio XRay Census
----------------------------------------------------------------------------------
       6       0.5226    LtofStay CulRatio XRay NoBeds Nurses Services
       6       0.5225    LtofStay Age CulRatio XRay Nurses Services
       6       0.5216    LtofStay CulRatio XRay Census Nurses Services
       6       0.5191    LtofStay Age CulRatio XRay Census Services
       6       0.5187    LtofStay Age CulRatio XRay NoBeds Services
       6       0.5169    LtofStay CulRatio XRay NoBeds Census Services
       6       0.5134    LtofStay Age CulRatio XRay NoBeds Nurses
       6       0.5132    LtofStay Age CulRatio XRay Census Nurses





174        proc glm data=SENIC;
175           TITLE3 'Full Model done in GLM';
176           model InfRisk = LtofStay Age CulRatio XRay NoBeds Census Nurses Services;
177        RUN;
178        QUIT;
NOTE: The PROCEDURE GLM printed pages 9-10.
NOTE: PROCEDURE GLM used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
Full Model done in GLM

The GLM Procedure
Number of observations    113



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
Full Model done in GLM

The GLM Procedure

Dependent Variable: InfRisk
                                        Sum of
Source                      DF         Squares     Mean Square    F Value    Pr > F
Model                        8     105.7400031      13.2175004      14.37    <.0001
Error                      104      95.6398199       0.9196137
Corrected Total            112     201.3798230

R-Square     Coeff Var      Root MSE    InfRisk Mean
0.525077      22.02053      0.958965        4.354867

Source                      DF       Type I SS     Mean Square    F Value    Pr > F
LtofStay                     1     57.30510979     57.30510979      62.31    <.0001
Age                          1      2.07505963      2.07505963       2.26    0.1361
CulRatio                     1     31.45734721     31.45734721      34.21    <.0001
XRay                         1      3.84764876      3.84764876       4.18    0.0433
NoBeds                       1      6.51641887      6.51641887       7.09    0.0090
Census                       1      0.17435655      0.17435655       0.19    0.6642
Nurses                       1      2.01641616      2.01641616       2.19    0.1417
Services                     1      2.34764618      2.34764618       2.55    0.1131

Source                      DF     Type III SS     Mean Square    F Value    Pr > F
LtofStay                     1      6.03647547      6.03647547       6.56    0.0118
Age                          1      0.48809372      0.48809372       0.53    0.4679
CulRatio                     1     17.57677710     17.57677710      19.11    <.0001
XRay                         1      4.42781800      4.42781800       4.81    0.0304
NoBeds                       1      0.26219566      0.26219566       0.29    0.5945
Census                       1      0.04043524      0.04043524       0.04    0.8343
Nurses                       1      1.08719258      1.08719258       1.18    0.2794
Services                     1      2.34764618      2.34764618       2.55    0.1131

                                  Standard
Parameter         Estimate           Error    t Value    Pr > |t|
Intercept     -.7472552477      1.20762993      -0.62      0.5374
LtofStay      0.1769313961      0.06905830       2.56      0.0118
Age           0.0162135960      0.02225515       0.73      0.4679
CulRatio      0.0469933765      0.01074904       4.37      <.0001
XRay          0.0120368799      0.00548557       2.19      0.0304
NoBeds        -.0014471797      0.00271027      -0.53      0.5945
Census        0.0007279559      0.00347158       0.21      0.8343
Nurses        0.0019062110      0.00175316       1.09      0.2794
Services      0.0162795745      0.01018895       1.60      0.1131





180        Proc reg data=senic;
181           TITLE3 'Extra sum of squares';
182            model InfRisk = LtofStay / ss1 ss2;
183            model InfRisk = Age / ss1 ss2;
184            model InfRisk = Nurses / ss1 ss2;
185            model InfRisk = LtofStay Age / ss1 ss2;
186            model InfRisk = LtofStay Nurses / ss1 ss2;
187            model InfRisk = Age Nurses / ss1 ss2;
188            model InfRisk = LtofStay Age Nurses / ss1 ss2;
189        run;
NOTE: 113 observations read.
NOTE: 113 observations used in computations.
NOTE: The PROCEDURE REG printed pages 11-17.
NOTE: PROCEDURE REG used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           1.23 seconds
      cpu time            0.39 seconds



Example of Multiple Regression (MLR)
SENIC database from NKNW 1996 (Appendix C)
Extra sum of squares

The REG Procedure
Model: MODEL1
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     1       57.30511       57.30511      44.15    <.0001
Error                   111      144.07471        1.29797
Corrected Total         112      201.37982

Root MSE              1.13929    R-Square     0.2846
Dependent Mean        4.35487    Adj R-Sq     0.2781
Coeff Var            26.16119

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS
Intercept     1        0.74430        0.55386       1.34      0.1817     2143.03018        2.34406
LtofStay      1        0.37422        0.05632       6.64      <.0001       57.30511       57.30511


The REG Procedure
Model: MODEL2
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     1     0.00024065     0.00024065       0.00    0.9908
Error                   111      201.37958        1.81423
Corrected Total         112      201.37982

Root MSE              1.34693    R-Square     0.0000
Dependent Mean        4.35487    Adj R-Sq    -0.0090
Coeff Var            30.92939

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS
Intercept     1        4.33738        1.52379       2.85      0.0053     2143.03018       14.69937
Age           1     0.00032854        0.02853       0.01      0.9908     0.00024065     0.00024065


The REG Procedure
Model: MODEL3
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     1       31.25844       31.25844      20.40    <.0001
Error                   111      170.12139        1.53263
Corrected Total         112      201.37982

Root MSE              1.23799    R-Square     0.1552
Dependent Mean        4.35487    Adj R-Sq     0.1476
Coeff Var            28.42779

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS
Intercept     1        3.69766        0.18639      19.84      <.0001     2143.03018      603.19681
Nurses        1        0.00379     0.00083997       4.52      <.0001       31.25844       31.25844


The REG Procedure
Model: MODEL4
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     2       59.38017       29.69008      23.00    <.0001
Error                   110      141.99965        1.29091
Corrected Total         112      201.37982

Root MSE              1.13618    R-Square     0.2949
Dependent Mean        4.35487    Adj R-Sq     0.2820
Coeff Var            26.08990

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS
Intercept     1        2.26591        1.32115       1.72      0.0891     2143.03018        3.79730
LtofStay      1        0.38792        0.05720       6.78      <.0001       57.30511       59.37993
Age           1       -0.03107        0.02450      -1.27      0.2075        2.07506        2.07506


The REG Procedure
Model: MODEL5
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     2       67.58193       33.79096      27.78    <.0001
Error                   110      133.79789        1.21634
Corrected Total         112      201.37982

Root MSE              1.10288    R-Square     0.3356
Dependent Mean        4.35487    Adj R-Sq     0.3235
Coeff Var            25.32523

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS
Intercept     1        0.89701        0.53873       1.67      0.0987     2143.03018        3.37223
LtofStay      1        0.31685        0.05798       5.46      <.0001       57.30511       36.32349
Nurses        1        0.00231     0.00079582       2.91      0.0044       10.27682       10.27682


The REG Procedure
Model: MODEL6
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     2       31.48971       15.74485      10.19    <.0001
Error                   110      169.89011        1.54446
Corrected Total         112      201.37982

Root MSE              1.24276    R-Square     0.1564
Dependent Mean        4.35487    Adj R-Sq     0.1410
Coeff Var            28.53729

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS
Intercept     1        3.14892        1.43036       2.20      0.0298     2143.03018        7.48526
Age           1        0.01022        0.02641       0.39      0.6995     0.00024065        0.23127
Nurses        1        0.00382     0.00084613       4.52      <.0001       31.48947       31.48947


The REG Procedure
Model: MODEL7
Dependent Variable: InfRisk

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F
Model                     3       68.46806       22.82269      18.72    <.0001
Error                   109      132.91176        1.21937
Corrected Total         112      201.37982

Root MSE              1.10425    R-Square     0.3400
Dependent Mean        4.35487    Adj R-Sq     0.3218
Coeff Var            25.35675

Parameter Estimates
                     Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|      Type I SS     Type II SS
Intercept     1        1.89700        1.29112       1.47      0.1446     2143.03018        2.63234
LtofStay      1        0.32864        0.05968       5.51      <.0001       57.30511       36.97835
Age           1       -0.02057        0.02412      -0.85      0.3958        2.07506        0.88613
Nurses        1        0.00220     0.00080714       2.73      0.0074        9.08789        9.08789





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