多変量解析のプロシジャー、お役立ち情報、まとめ

統計モデル解析特論I/II : 第14回 (01/26/21)

 最終回の今回は、Q3で紹介した多変量解析の手法について、SASでの実行方法を示すと共に、 その他 SAS を利用する上で参考になるサイトを紹介し、最後にまとめを行う。
  1. 前回のショート課題: 6名

  2. 回帰分析: proc reg

  3. 回帰分析における変数選択 : 説明変数の取捨選択(変数選択)について説明する。

    1. プログラム : les1402.sas

       /* Lesson 14-02 */
       /*    File Name = les1402.sas   01/26/21   */
      
      options nocenter linesize=78 pagesize=30;
      options locale='en_US';
      /* options locale='ja_JP'; */
      proc printto print = 'StatM20/les1402-Results.txt' new;
      ods listing gpath='StatM20/SAS_ODS14'; 
      
      data air;
        infile 'StatM20/usair2.txt';
        input id $ y x1 x2 x3 x4 x5 x6;
      /*
        label y='SO2 of air in micrograms per cubic metre'
              x1='Average annual temperature in F'
              x2='Number of manufacturing enterprises employing 20 or more workers'
              x3='Population size (1970 census); in thousands'
              x4='Average annual wind speed in miles per hour'
              x5='Average annual precipitation in inches'
              x6='Average number of days with precipitation per year'
      ;
      */
      
      proc print data=air(obs=10);
      run;
      
      proc corr data=air;
      run;
      
      title "*** フルモデル ***";
      proc reg data=air;                                     :
        model y=x1 x2 x3 x4 x5 x6;                           : フルモデル
        output out=out_reg1 predicted=pred1 residual=resid1; :
      run;                                                   :
      
      proc plot data=out_reg1;
        plot resid1*pred1 /vref=0;                           :
        plot resid1*x1    /vref=0;                           : 指定方法1(ズラズラと列記)
        plot resid1*x2    /vref=0;                           :
        plot resid1*x3    /vref=0;                           :
        plot resid1*x4    /vref=0;                           :
        plot resid1*x5    /vref=0;                           :
        plot resid1*x6    /vref=0;                           :
        plot resid1*y     /vref=0;                           :
      run;
      
      title "*** 逐次増減法 ***";
      proc reg data=air;                                     :
        model y=x1-x6 / selection=stepwise;                  : 逐次増減法
        output out=out_reg2 predicted=pred2 residual=resid2; : 連続変数の指定方法(列挙が面倒な場合)
      run;                                                   :
      
      proc print data=out_reg2(obs=15);
      run;
      
      proc plot data=out_reg2;
        plot resid1*pred1               /vref=0;             :
        plot resid1*(x1 x2 x3 x4 x5 x6) /vref=0;             : 指定方法2(上と比較)
        plot resid1*(x1-x6)             /vref=0;             : 指定方法3(何れも同じ指定)
        plot resid1*y                   /vref=0;             :
      run;
      
      title "*** 総当たり法 ***";
      proc reg data=air;                                     :
        model y=x1-x6 / selection=rsquare;                   : 総当たり法
      run;                                                   :
      
    2. 出力結果:
                                            Monday, January 25, 2021 05:43:27 PM 144
      
      Obs    id           y     x1      x2     x3     x4      x5      x6
      
        1    Phoenix     10    70.3    213    582    6.0     7.05     36
        2    Little_R    13    61.0     91    132    8.2    48.52    100
        3    San_Fran    12    56.7    453    716    8.7    20.66     67
        4    Denver      17    51.9    454    515    9.0    12.95     86
        5    Hartford    56    49.1    412    158    9.0    43.37    127
        6    Wilmingt    36    54.0     80     80    9.0    40.25    114
        7    Washingt    29    57.3    434    757    9.3    38.89    111
        8    Jacksonv    14    68.4    136    529    8.8    54.47    116
        9    Miami       10    75.5    207    335    9.0    59.80    128
       10    Atlanta     24    61.5    368    497    9.1    48.34    115
      
                                            Monday, January 25, 2021 05:43:27 PM 145
      The CORR Procedure
      
         7  Variables:    y        x1       x2       x3       x4       x5       x6  
      
                                    Simple Statistics
       
      Variable         N        Mean     Std Dev         Sum     Minimum     Maximum
      
      y               41    30.04878    23.47227        1232     8.00000   110.00000
      x1              41    55.76341     7.22772        2286    43.50000    75.50000
      x2              41   463.09756   563.47395       18987    35.00000        3344
      x3              41   608.60976   579.11302       24953    71.00000        3369
      x4              41     9.44390     1.42864   387.20000     6.00000    12.70000
      x5              41    36.76902    11.77155        1508     7.05000    59.80000
      x6              41   113.90244    26.50642        4670    36.00000   166.00000
      
                                            Monday, January 25, 2021 05:43:27 PM 146
      The CORR Procedure
      
                     Pearson Correlation Coefficients, N = 41 
                             Prob > |r| under H0: Rho=0
       
                 y        x1        x2        x3        x4        x5        x6
      
      y    1.00000  -0.43360   0.64477   0.49378   0.09469   0.05429   0.36956
                      0.0046    <.0001    0.0010    0.5559    0.7360    0.0174
      
      x1  -0.43360   1.00000  -0.19004  -0.06268  -0.34974   0.38625  -0.43024
            0.0046              0.2340    0.6970    0.0250    0.0126    0.0050
      
      x2   0.64477  -0.19004   1.00000   0.95527   0.23795  -0.03242   0.13183
            <.0001    0.2340              <.0001    0.1341    0.8405    0.4113
      
      x3   0.49378  -0.06268   0.95527   1.00000   0.21264  -0.02612   0.04208
            0.0010    0.6970    <.0001              0.1819    0.8712    0.7939
      
      x4   0.09469  -0.34974   0.23795   0.21264   1.00000  -0.01299   0.16411
            0.5559    0.0250    0.1341    0.1819              0.9357    0.3052
      
      x5   0.05429   0.38625  -0.03242  -0.02612  -0.01299   1.00000   0.49610
            0.7360    0.0126    0.8405    0.8712    0.9357              0.0010
      
      x6   0.36956  -0.43024   0.13183   0.04208   0.16411   0.49610   1.00000
            0.0174    0.0050    0.4113    0.7939    0.3052    0.0010
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:27 PM 147
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
      
      Number of Observations Read          41
      Number of Observations Used          41
      
                                   Analysis of Variance
       
                                          Sum of           Mean
      Source                   DF        Squares         Square    F Value    Pr > F
      
      Model                     6          14755     2459.10601      11.48    <.0001
      Error                    34     7283.26641      214.21372                     
      Corrected Total          40          22038                                    
      
      
      Root MSE             14.63604    R-Square     0.6695
      Dependent Mean       30.04878    Adj R-Sq     0.6112
      Coeff Var            48.70761                       
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:27 PM 148
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
      
                              Parameter Estimates
       
                           Parameter       Standard
      Variable     DF       Estimate          Error    t Value    Pr > |t|
      
      Intercept     1      111.72848       47.31810       2.36      0.0241
      x1            1       -1.26794        0.62118      -2.04      0.0491
      x2            1        0.06492        0.01575       4.12      0.0002
      x3            1       -0.03928        0.01513      -2.60      0.0138
      x4            1       -3.18137        1.81502      -1.75      0.0887
      x5            1        0.51236        0.36276       1.41      0.1669
      x6            1       -0.05205        0.16201      -0.32      0.7500
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 149
                Plot of resid1*pred1.  Legend: A = 1 obs, B = 2 obs, etc.
            |
         50 +                                 A
            |
            |
            |
            |
      R     |                         A
      e  25 +
      s     |
      i     |                 A        A
      d     |        A                 A
      u     |             A       A             A    A
      a     |             AA      AAA  A             A
      l   0 +--------------A-A-------A---A---------A--------------------------A-----
            |                    A   A BA
            |                  A A A
            |                    AA  B
            |                        AB A     A
            |
        -25 +                                 A
            -+---------+---------+---------+---------+---------+---------+---------+
            -20        0        20        40        60        80        100      120
                                      Predicted Value of y
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 150
                  Plot of resid1*x1.  Legend: A = 1 obs, B = 2 obs, etc.
             |
          50 +                  A
             |
             |
             |
             |
       R     |                   A
       e  25 +
       s     |
       i     |                          A      A
       d     |              A                                   A
       u     |                         A A  A                A
       a     |                  A A A A  A A                  A
       l   0 +-----------------AAAA--------A-----------------------------A---------
             |                    B     A   A     A
             |                A            A              A
             |                     A           A   A         A
             |        A  A A           A          A
             |
         -25 +                        A
             ---+-------+-------+-------+-------+-------+-------+-------+-------+--
               40      45      50      55      60      65      70      75      80
                                               x1
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 151
                  Plot of resid1*x2.  Legend: A = 1 obs, B = 2 obs, etc.
            |
         50 +       A
            |
            |
            |
            |
      R     |       A
      e  25 +
      s     |
      i     |  A          A
      d     | A  A
      u     |   A     A      A                 A
      a     | AAA  AA      A     A
      l   0 +---AAA--A------------A---------------------------------------------A---
            | A  B  AA
            |  A      A   A
            |    A AA A
            |  A     B  A  A
            |
        -25 +         A
            -+---------+---------+---------+---------+---------+---------+---------+
             0        500      1000      1500      2000      2500      3000     3500
                                               x2
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 152
                  Plot of resid1*x3.  Legend: A = 1 obs, B = 2 obs, etc.
            |
         50 +    A
            |
            |
            |
            |
      R     |          A
      e  25 +
      s     |
      i     |      A           A
      d     |  A         A
      u     |           AA  A                       A
      a     |  A AA      A  B         A
      l   0 +---A--AA---A------------------A------------------------------------A---
            | A    AA  AA
            |    A         A  A
            |       A AA A
            |   A     AA   AA
            |
        -25 +         A
            -+---------+---------+---------+---------+---------+---------+---------+
             0        500      1000      1500      2000      2500      3000     3500
                                               x3
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 153
                  Plot of resid1*x4.  Legend: A = 1 obs, B = 2 obs, etc.
            |
         50 +                                              A
            |
            |
            |
            |
      R     |                                  A
      e  25 +
      s     |
      i     |                                    A         A
      d     |A                           A
      u     |                            A    A AA
      a     |                       A   A AA      A          AA
      l   0 +--------------------------A---B----------A--A----------------------A---
            |     A          A              A  A              A
            |                           A                     A  A
            |                   A    A     A A
            |                      A                 A     A           A     A
            |
        -25 +           A
            -+---------+---------+---------+---------+---------+---------+---------+
             6         7         8         9        10        11        12        13
                                               x4
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 154
                  Plot of resid1*x5.  Legend: A = 1 obs, B = 2 obs, etc.
            |
         50 +                                                 A
            |
            |
            |
            |
      R     |                                          A
      e  25 +
      s     |
      i     |                                               A   A
      d     |          A                            A
      u     |                                         A   AA               A
      a     |           A       A                    A    AA  A     A
      l   0 +------------------------------------B---A--A------A-----------------A--
            |                                   A         A A A     A
            |                         A          A     A
            |                A                                    A  A       A
            |                               A  A       AA           A
            |
        -25 +                                             A
            ---+----------+----------+----------+----------+----------+----------+--
               0         10         20         30         40         50         60
                                               x5
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 155
                  Plot of resid1*x6.  Legend: A = 1 obs, B = 2 obs, etc.
             |
          50 +                                            A
             |
             |
             |
             |
       R     |                                                     A
       e  25 +
       s     |
       i     |                                      A A
       d     |        A                                       A
       u     |                                    A A B
       a     |                 A            A    A    A AA            A
       l   0 +---------------------------A---------------A-BA-A--------------------
             |                                 A      B            A      A
             |                     A   A         A
             |                            A       A  A  A
             |                                  B        A     A          A
             |
         -25 +                                               A
             ---+-------+-------+-------+-------+-------+-------+-------+-------+--
               20      40      60      80      100     120     140     160     180
                                               x6
      
      *** フルモデル ***               Monday, January 25, 2021 05:43:28 PM 156
                  Plot of resid1*y.  Legend: A = 1 obs, B = 2 obs, etc.
               |
            50 +                                                 A
               |
               |
               |
               |
         R     |                                 A
         e  25 +
         s     |
         i     |                  A       A
         d     |       A                 A
         u     |         A       A            A      A
         a     |       AA       BA  A              A
         l   0 +------AA-------A----A---------A--------------------------A-------
               |         A    AA AA
               |       AA  A
               |       B   B
               |        ABA      A
               |
           -25 +              A
               ---+---------+---------+---------+---------+---------+---------+--
                  0        20        40        60        80        100       120
                                                y
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:28 PM 157
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
      
      Number of Observations Read          41
      Number of Observations Used          41
       
      Stepwise Selection: Step 1
      
      Variable x2 Entered: R-Square = 0.4157 and C(p) = 23.1089
      
                                   Analysis of Variance
      
                                          Sum of           Mean
      Source                   DF        Squares         Square    F Value    Pr > F
      
      Model                     1     9161.74469     9161.74469      27.75    <.0001
      Error                    39          12876      330.15789                     
      Corrected Total          40          22038                                    
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:28 PM 158
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
       
      Stepwise Selection: Step 1
      
                   Parameter     Standard
      Variable      Estimate        Error   Type II SS  F Value  Pr > F
      
      Intercept     17.61057      3.69159   7513.50474    22.76  <.0001
      x2             0.02686      0.00510   9161.74469    27.75  <.0001
      
      Bounds on condition number: 1, 1
      ------------------------------------------------------------------------------
      
      Stepwise Selection: Step 2
      
      Variable x3 Entered: R-Square = 0.5863 and C(p) = 7.5586
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:28 PM 159
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
       
      Stepwise Selection: Step 2
      
                                   Analysis of Variance
       
                                          Sum of           Mean
      Source                   DF        Squares         Square    F Value    Pr > F
      
      Model                     2          12921     6460.63359      26.93    <.0001
      Error                    38     9116.63526      239.91145                     
      Corrected Total          40          22038                                    
      
      
                   Parameter     Standard
      Variable      Estimate        Error   Type II SS  F Value  Pr > F
      
      Intercept     26.32508      3.84044        11273    46.99  <.0001
      x2             0.08243      0.01470   7548.02378    31.46  <.0001
      x3            -0.05661      0.01430   3759.52248    15.67  0.0003
      
      Bounds on condition number: 11.434, 45.735
      ------------------------------------------------------------------------------
      
      Stepwise Selection: Step 3
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:28 PM 160
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
       
      Stepwise Selection: Step 3
      
      Variable x6 Entered: R-Square = 0.6174 and C(p) = 6.3610
      
                                   Analysis of Variance
       
                                          Sum of           Mean
      Source                   DF        Squares         Square    F Value    Pr > F
      
      Model                     3          13606     4535.41173      19.90    <.0001
      Error                    37     8431.66725      227.88290                     
      Corrected Total          40          22038                                    
      
                   Parameter     Standard
      Variable      Estimate        Error   Type II SS  F Value  Pr > F
      
      Intercept      6.96585     11.77691     79.72552     0.35  0.5578
      x2             0.07433      0.01507   5547.32154    24.34  <.0001
      x3            -0.04939      0.01454   2628.36952    11.53  0.0016
      x6             0.16436      0.09480    684.96801     3.01  0.0913
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:28 PM 161
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
       
      Stepwise Selection: Step 3
      
      Bounds on condition number: 12.65, 78.633
      ------------------------------------------------------------------------------
      
      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  x2                      1    0.4157   0.4157  23.1089   27.75 <.0001
        2  x3                      2    0.1706   0.5863   7.5586   15.67 0.0003
        3  x6                      3    0.0311   0.6174   6.3610    3.01 0.0913
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 162
      
      Obs  id          y   x1    x2    x3    x4     x5    x6     pred1    resid1
      
        1  Phoenix    10  70.3   213   582   6.0   7.05   36    -0.032   10.0316
        2  Little_R   13  61.0    91   132   8.2  48.52  100    23.646  -10.6461
        3  San_Fran   12  56.7   453   716   8.7  20.66   67    16.285   -4.2849
        4  Denver     17  51.9   454   515   9.0  12.95   86    29.410  -12.4103
        5  Hartford   56  49.1   412   158   9.0  43.37  127    50.661    5.3392
        6  Wilmingt   36  54.0    80    80   9.0  40.25  114    27.698    8.3020
        7  Washingt   29  57.3   434   757   9.3  38.89  111    20.079    8.9208
        8  Jacksonv   14  68.4   136   529   8.8  54.47  116    10.011    3.9887
        9  Miami      10  75.5   207   335   9.0  59.80  128    26.844  -16.8439
       10  Atlanta    24  61.5   368   497   9.1  48.34  115    28.673   -4.6731
       11  Chicago   110  50.6  3344  3369  10.4  34.44  122   109.181    0.8191
       12  Indianap   28  52.3   361   746   9.7  38.74  121    16.840   11.1603
       13  Des_Moin   17  49.0   104   201  11.2  30.85  103    21.697   -4.6973
       14  Wichita     8  56.6   125   277  12.7  30.58   82    16.053   -8.0528
       15  Louisvil   30  55.6   291   593   8.3  43.11  123    19.522   10.4776
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 163
                Plot of resid1*pred1.  Legend: A = 1 obs, B = 2 obs, etc.
            |
            |
         50 +                          A
            |
            |
            |                   A
      R  25 +
      e     |                 B
      s     |  A        AAA                  A
      i     |      A A    AAA A            B
      d   0 +----------------A--AA-----------------------------------------A--------
      u     |           CAAA A A   A                  A
      a     |               B AA
      l     |                AA   A  A  A
        -25 +
            |                        A
            |
            |
        -50 +
            |
            ---+----------+----------+----------+----------+----------+----------+--
               0         20         40         60         80         100        120
                                      Predicted Value of y
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 164
                  Plot of resid1*x1.  Legend: A = 1 obs, B = 2 obs, etc.
             |
             |
          50 +                  A
             |
             |
             |                   A
       R  25 +
       e     |              A           A
       s     |                      A  A A     A                A
       i     |                 A  B   A  A AA                A
       d   0 +------------------AA------A---A--------------------------------------
       u     |                A A B        B   A  AA          A
       a     |                     A   A          A          A
       l     |        A  A            A                   A              A
         -25 +
             |             A
             |
             |
         -50 +
             |
             ---+-------+-------+-------+-------+-------+-------+-------+-------+--
               40      45      50      55      60      65      70      75      80
                                               x1
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 165
                  Plot of resid1*x2.  Legend: A = 1 obs, B = 2 obs, etc.
            |
            |
         50 +       A
            |
            |
            |       A
      R  25 +
      e     | A           A
      s     |  A A AA                          A
      i     | AAB A  AA      A
      d   0 +-A--A----------------A---------------------------------------------A---
      u     |  AAA ABAA    A     A
      a     |  A A   AA
      l     |    A    A A AA
        -25 +
            |        A
            |
            |
        -50 +
            |
            -+---------+---------+---------+---------+---------+---------+---------+
             0        500      1000      1500      2000      2500      3000     3500
                                               x2
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 166
                  Plot of resid1*x3.  Legend: A = 1 obs, B = 2 obs, etc.
            |
            |
         50 +    A
            |
            |
            |          A
      R  25 +
      e     |  A               A
      s     |      A     B  A                       A
      i     |  AAAA     BA  A
      d   0 +-A----A-----------------------A------------------------------------A---
      u     |    A AA AAAA AA         A
      a     |   A   A  B
      l     |       A A    AA A
        -25 +
            |         A
            |
            |
        -50 +
            |
            -+---------+---------+---------+---------+---------+---------+---------+
             0        500      1000      1500      2000      2500      3000     3500
                                               x3
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 167
                  Plot of resid1*x4.  Legend: A = 1 obs, B = 2 obs, etc.
            |
            |
         50 +                                              A
            |
            |
            |                                  A
      R  25 +
      e     |                            A       A
      s     |A                      A            AA        A
      i     |                          AAAAB  A A
      d   0 +-----A----------A------------------------A--A--------------------------
      u     |                   A       A   AA A             AB  A              A
      a     |                      A A     A         A
      l     |           A                  A               A  A        A
        -25 +
            |                                                                A
            |
            |
        -50 +
            |
            -+---------+---------+---------+---------+---------+---------+---------+
             6         7         8         9        10        11        12        13
                                               x4
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 168
                  Plot of resid1*x5.  Legend: A = 1 obs, B = 2 obs, etc.
            |
            |
         50 +                                                 A
            |
            |
            |                                          A
      R  25 +
      e     |                                       A       A
      s     |          A                                  AA  A A
      i     |           A       A                     A A AA   A           A
      d   0 +------------------------------------A---A------A-A---------------------
      u     |                         A         AB   A    A       A BA
      a     |                A                          A           A        A
      l     |                               A  A       A  A                      A
        -25 +
            |                                          A
            |
            |
        -50 +
            |
            ---+----------+----------+----------+----------+----------+----------+--
               0         10         20         30         40         50         60
                                               x5
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 169
                  Plot of resid1*x6.  Legend: A = 1 obs, B = 2 obs, etc.
             |
             |
          50 +                                            A
             |
             |
             |                                                     A
       R  25 +
       e     |                                      A         A
       s     |        A                               B AA
       i     |                 A            A     A A B    A  A
       d   0 +----------------------------------------A--A--A------A---------------
       u     |                     A     A     A BA   A A             A   A
       a     |                            A     B    A
       l     |                         A                 A A A A
         -25 +
             |                                                            A
             |
             |
         -50 +
             |
             ---+-------+-------+-------+-------+-------+-------+-------+-------+--
               20      40      60      80      100     120     140     160     180
                                               x6
      ≪中略≫
      
      *** 逐次増減法 ***               Monday, January 25, 2021 05:43:29 PM 176
                  Plot of resid1*y.  Legend: A = 1 obs, B = 2 obs, etc.
               |
               |
            50 +                                                 A
               |
               |
               |                                 A
         R  25 +
         e     |                         AA
         s     |       A        AAA                  A
         i     |        AA     AAA  A         B
         d   0 +---------------A--A-A------------------------------------A-------
         u     |      ABAA B  A  A                 A
         a     |       A B A
         l     |       B  A   A  A
           -25 +
               |        A
               |
               |
           -50 +
               |
               ---+---------+---------+---------+---------+---------+---------+--
                  0        20        40        60        80        100       120
                                                y
      
      *** 総当たり法 ***               Monday, January 25, 2021 05:43:29 PM 177
      
      The REG Procedure
      Model: MODEL1
      Dependent Variable: y 
       
      R-Square Selection Method
      
      Number of Observations Read          41
      Number of Observations Used          41
      
      Number in
        Model      R-Square    Variables in Model
             1       0.4157    x2                
             1       0.2438    x3                
             1       0.1880    x1                
             1       0.1366    x6                
             1       0.0090    x4                
             1       0.0029    x5                
      -------------------------------------------
             2       0.5863    x2 x3             
             2       0.5161    x1 x2             
             2       0.4981    x2 x6             
             2       0.4214    x2 x5             
             2       0.4194    x2 x4             
             2       0.4066    x1 x3             
             2       0.3657    x3 x6             
             2       0.2483    x3 x5             
             2       0.2458    x1 x5             
             2       0.2439    x3 x4             
             2       0.2291    x1 x6             
             2       0.1917    x1 x4             
             2       0.1587    x5 x6             
             2       0.1378    x4 x6             
             2       0.0120    x4 x5             
      -------------------------------------------
             3       0.6174    x2 x3 x6          
             3       0.6125    x1 x2 x3          
             3       0.5930    x2 x3 x5          
             3       0.5930    x2 x3 x4          
             3       0.5622    x1 x2 x5          
             3       0.5452    x1 x2 x6          
             3       0.5452    x1 x2 x4          
             3       0.5083    x2 x4 x6          
             3       0.5047    x2 x5 x6          
             3       0.4649    x1 x3 x5          
             3       0.4446    x1 x3 x6          
             3       0.4320    x1 x3 x4          
             3       0.4250    x2 x4 x5          
             3       0.3808    x3 x5 x6          
             3       0.3702    x3 x4 x6          
             3       0.2550    x1 x4 x5          
             3       0.2484    x3 x4 x5          
             3       0.2462    x1 x5 x6          
             3       0.2332    x1 x4 x6          
             3       0.1590    x4 x5 x6          
      -------------------------------------------
             4       0.6396    x1 x2 x3 x5       
             4       0.6329    x1 x2 x3 x4       
             4       0.6291    x1 x2 x3 x6       
             4       0.6285    x2 x3 x4 x6       
             4       0.6176    x2 x3 x5 x6       
             4       0.6028    x1 x2 x4 x5       
             4       0.5997    x2 x3 x4 x5       
             4       0.5747    x1 x2 x4 x6       
             4       0.5622    x1 x2 x5 x6       
             4       0.5164    x2 x4 x5 x6       
             4       0.5035    x1 x3 x4 x5       
             4       0.4708    x1 x3 x4 x6       
             4       0.4649    x1 x3 x5 x6       
             4       0.3871    x3 x4 x5 x6       
             4       0.2550    x1 x4 x5 x6       
      -------------------------------------------
             5       0.6685    x1 x2 x3 x4 x5    
             5       0.6501    x1 x2 x3 x4 x6    
             5       0.6396    x1 x2 x3 x5 x6    
             5       0.6290    x2 x3 x4 x5 x6    
             5       0.6040    x1 x2 x4 x5 x6    
             5       0.5043    x1 x3 x4 x5 x6    
      -------------------------------------------
             6       0.6695    x1 x2 x3 x4 x5 x6 
    3. 結果の見方
      • 相関係数(Correlation Coefficient)とゼロと仮定した時の検定結果

      • フルモデル
      • 逐次選択法(stepwise)
        • 変量増減法。
        • 一度取り込まれても、組合わせによっては削除される。
      • 総当たり法(rsquare)
        • 説明変数の組合わせ毎の決定係数(R^2)が表示される : 大きい順に
        • モデルの探索用。
        • 決定係数 : R-Square : 1 に近いほど当てはまりが良いと言える
        • 説明変数が増えると大きくなるのが一般的
        • 興味のある組合わせを見つけ出して、このあと計算させる。残差解析も行うこと。
      • 他に、前進選択法(forward)、後退選択法(backward)
      • 「数値計算上の最適モデル」と「その分野の知識からの最適モデル」には違いがあることを知っておくこと。
      • 残差解析はいつの場合でも必要
        • 残差の性質 ===> 正規性 : 残差プロット、残差解析
        • 均等に散らばっているか?
        • 傾向はないか? : 傾向があると言うことは正規性の仮定が崩れていること
        • ...
      • ...

  4. 主成分分析: proc princomp

  5. 因子分析: proc factor

  6. 全体を通してのデータ分析の手順
     Q3では主に統計手法のアイディアや考え方を、Q4ではそれらを計算する道具立てとしてのSASを習得した。 改めて、データを分析する際の、問題設定から報告までの全体的な流れについて紹介しておく。

    1. 取り組む問題の理解
    2. データ採取計画の立案 <=== 設計は重要
    3. データ収集
      • 試しに採ってみる。気付かなかった齟齬はないか。
      • 正式に大規模に採取。
    4. データクリーニング: 回答ミス、入力ミス等を洗い出す
    5. 基礎統計量
    6. 各種分析: 多変量解析等
    7. 考察
    8. 報告

  7. お役立ちサイト: サンプルデータ

  8. お役立ちサイト: マニュアル

  9. 課題提出(レポート): 詳細は 第13回 第6節 を参照下さい。
    提出期限は「02月17日(水) 夕方」です。厳守。
    ファイルを提出できるように設定しておきましたが、 私の設定ミス等でうまく提出できない場合は電子メールでその旨、ご連絡ください。

  10. まとめ: 講義を終えるにあたって
     この講義を通して、「データとの接し方」や「統計の考え方」が 多少なりとも理解できたであろうか? 大量の数値群からその中に内在する構造を見つけることが 「解析」であり「統計の面白味」でもあると思う。 近年はビッグデータへの注目もあって統計学が脚光を浴びているが、 どのような時代であっても、「データに内在する構造」を明らかにする学問として 今後もいろいろな分野で応用されていくと考えている。 そのためには、統計理論や解析目的を知っている必要があるのは勿論だが、 対象とするデータの背景を知っておくことや、 統計ソフトを"道具"として使いこなす技術も習得する必要がある。
     そうした中でSASは長年の歴史を有した信頼できる統計ソフトであり、 研究での利用に関してフルスペックの機能が無料で使えるという魅力もあり、 知っておいて損のない統計環境だと感じているので、今回講義で利用することにした次第である。
     今後、各自の実験や修論をまとめる際だけでなく、 日頃目にする新聞や雑誌と言った生活等のいろいろな場面で、 種々のデータに出会うことになると思うが、 提示された数値にはどの様な意味(と意図)があり、 どう理解して、個々人としてどうアクションを起すかの、 一つの判断手段として活用してもらえれば幸いである。
     今後、もし統計に関して何か疑問に出会い、 私に連絡・相談してみたいと思った時は、遠慮無くご連絡ください。

     皆さんのご期待にどこまで応えられか心許無い部分もありますが、 Q3、Q4を通しての講義、お疲れ様でした。 COVID-19の動向が不気味ですが、ご健康には留意されてお過ごしください。お元気で。

  11. 連絡したければ

  12. 次回は、... : 02月02日