Ch.2 Stata

C1
(i)

sum prate mrate

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
       prate |      1534    87.36291    16.71654          3        100
       mrate |      1534    .7315124    .7795393        .01       4.91

平均参加率87.36%,平均リターンは73%である.

(ii)
regress prate mrate

使用したサンプルは1534であり,決定係数は0.075である.

prate=83.08+mrate*5.86

(iii)
企業によるリターンが0の場合,平均的な参加率は83.08%となる.企業によるリターンが1ドルにつき1どるである企業では,平均参加率は5.86%高い.

(iv)
mrate=3.5とすると,prate=83.08+3.5*5.86となり,prate=103.59という結果が得られる.
prateの上限は100%であるので,この予測は上限を超えてしまっている.そのため,上限がある従属変数に対して,線形回帰を当てはめるたときに起こる,問題をこの単回帰の結果は示している.

C2
(i)

 sum salary ceoten

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      salary |       177    865.8644    587.5893        100       5299
      ceoten |       177    7.954802    7.150826          0         37

平均収入(1000$)は865.86であり,CEOとしての平均年数は,7.95である.

(ii)

 tabulate ceoten

   years as |
   ceo with |
    company |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          5        2.82        2.82
          1 |         19       10.73       13.56
          2 |         10        5.65       19.21
          3 |         21       11.86       31.07
          4 |         21       11.86       42.94
          5 |         10        5.65       48.59
          6 |         11        6.21       54.80
          7 |          6        3.39       58.19
          8 |         11        6.21       64.41
          9 |          8        4.52       68.93
         10 |          8        4.52       73.45
         11 |          4        2.26       75.71
         12 |          7        3.95       79.66
         13 |          7        3.95       83.62
         14 |          5        2.82       86.44
         15 |          2        1.13       87.57
         16 |          2        1.13       88.70
         17 |          2        1.13       89.83
         18 |          1        0.56       90.40
         19 |          2        1.13       91.53
         20 |          4        2.26       93.79
         21 |          1        0.56       94.35
         22 |          1        0.56       94.92
         24 |          3        1.69       96.61
         26 |          2        1.13       97.74
         28 |          1        0.56       98.31
         34 |          1        0.56       98.87
         37 |          2        1.13      100.00
------------+-----------------------------------
      Total |        177      100.00

1年目は5人,最大は37年.

(ii)

reg lsalary ceoten

      Source |       SS       df       MS              Number of obs =     177
-------------+------------------------------           F(  1,   175) =    2.33
       Model |  .850907024     1  .850907024           Prob > F      =  0.1284
    Residual |   63.795306   175  .364544606           R-squared     =  0.0132
-------------+------------------------------           Adj R-squared =  0.0075
       Total |  64.6462131   176  .367308029           Root MSE      =  .60378

------------------------------------------------------------------------------
     lsalary |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      ceoten |   .0097236   .0063645     1.53   0.128    -.0028374    .0222846
       _cons |   6.505498   .0679911    95.68   0.000      6.37131    6.639686
------------------------------------------------------------------------------

一年CEOとして多く働いている人は,そうでない人と比べて,9.77%(e^{.0097236})収入が多い.

C3
(i)

 reg sleep totwrk

      Source |       SS       df       MS              Number of obs =     706
-------------+------------------------------           F(  1,   704) =   81.09
       Model |  14381717.2     1  14381717.2           Prob > F      =  0.0000
    Residual |   124858119   704  177355.282           R-squared     =  0.1033
-------------+------------------------------           Adj R-squared =  0.1020
       Total |   139239836   705  197503.313           Root MSE      =  421.14

------------------------------------------------------------------------------
       sleep |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      totwrk |  -.1507458   .0167403    -9.00   0.000    -.1836126    -.117879
       _cons |   3586.377   38.91243    92.17   0.000     3509.979    3662.775
------------------------------------------------------------------------------

n=706, 決定係数は0.103である.
{\it sleep}=\beta_0+\beta_1{\it totwrk}+{\it u},であるので,
{\it sleep}=3586.38-.151*{\it totwrk} となる.
切片は全く働いていない人の睡眠時間(分表記)を表している.

(iii)
2時間働いている人は,{\it sleep}=3586.38-.151*60*2となる18分程度睡眠時間が少ないことになる.それほど大きい差ではない.

C4
(i)

 sum wage IQ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        wage |       935    957.9455    404.3608        115       3078
          IQ |       935    101.2824    15.05264         50        145

平均的な月収は,957.95であり,平均的なIQは101.28であり,その標準偏差は,15.05である.

(ii)

      Source |       SS       df       MS              Number of obs =     935
-------------+------------------------------           F(  1,   933) =   98.55
       Model |  14589782.6     1  14589782.6           Prob > F      =  0.0000
    Residual |   138126386   933  148045.429           R-squared     =  0.0955
-------------+------------------------------           Adj R-squared =  0.0946
       Total |   152716168   934  163507.675           Root MSE      =  384.77

------------------------------------------------------------------------------
        wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          IQ |   8.303064   .8363951     9.93   0.000     6.661631    9.944498
       _cons |   116.9916   85.64153     1.37   0.172    -51.08078    285.0639
------------------------------------------------------------------------------

wage=116.99+8.30*{\it IQ}
IQが15高い人は,wageが124.5高い.決定係数は,9.6%なのでそれほど高くない.

(iii)

 reg lwage IQ

      Source |       SS       df       MS              Number of obs =     935
-------------+------------------------------           F(  1,   933) =  102.62
       Model |  16.4150939     1  16.4150939           Prob > F      =  0.0000
    Residual |  149.241189   933  .159958402           R-squared     =  0.0991
-------------+------------------------------           Adj R-squared =  0.0981
       Total |  165.656283   934  .177362188           Root MSE      =  .39995

------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          IQ |   .0088072   .0008694    10.13   0.000      .007101    .0105134
       _cons |   5.886994   .0890206    66.13   0.000     5.712291    6.061698
------------------------------------------------------------------------------

IQが1高い人は,8.8%月収が高い.IQが15高いと13.2%収入が高い.決定係数は,0.099である.

C5
(i)
log(rd)=\beta_0+\beta_1*log(sales)+u
constant elasticityは\beta_1が示している.
(ii)

      Source |       SS       df       MS              Number of obs =      32
-------------+------------------------------           F(  1,    30) =  302.72
       Model |  84.8395785     1  84.8395785           Prob > F      =  0.0000
    Residual |  8.40768588    30  .280256196           R-squared     =  0.9098
-------------+------------------------------           Adj R-squared =  0.9068
       Total |  93.2472644    31  3.00797627           Root MSE      =  .52939

------------------------------------------------------------------------------
         lrd |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lsales |   1.075731   .0618275    17.40   0.000     .9494619    1.201999
       _cons |  -4.104722   .4527678    -9.07   0.000    -5.029398   -3.180047
------------------------------------------------------------------------------

推定された式はlog(rd)=-4.11+1.08*log(sales)となる.salesが1%上がると,rdは1.08%上がることを示している.

C6
(i)
資源を投入していっても際限なく合格率が上がるとは思えない.最初は傾きが大きいが,徐々にその傾きは緩やかになるだろう.

(ii)
math10=\beta_0+\beta_1log(expend)+uで,\beta_1/100はexpendの支出が1%増えた際,以前の支出と比べて,math10に及ぼす効果のパーセンテージを示している.\beta_1/10は100ではなく,10で\beta_1を割っているので,10%増えた際の効果を求めていることになる.
(iii)

 reg math10 lexpend

      Source |       SS       df       MS              Number of obs =     408
-------------+------------------------------           F(  1,   406) =   12.41
       Model |  1329.42517     1  1329.42517           Prob > F      =  0.0005
    Residual |  43487.7553   406  107.112698           R-squared     =  0.0297
-------------+------------------------------           Adj R-squared =  0.0273
       Total |  44817.1805   407  110.115923           Root MSE      =   10.35

------------------------------------------------------------------------------
      math10 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lexpend |   11.16439   3.169011     3.52   0.000     4.934677    17.39411
       _cons |   -69.3411   26.53013    -2.61   0.009    -121.4947   -17.18753
------------------------------------------------------------------------------

math10=-69.34+11.16*log(expend)であり,サンプルサイズは,408,決定係数は,0.03である.
(iv)
10%の支出が多いと,数学の合格率が1.1単位高い.あまり大きくない.

(v)
expendとmath10の相関や,散布図を見ればわかるが,これらの間に強い線形の関係はない.
また,(100-69.3411/11.16439)\approx 41.82なので,exp(41.82)のexpendがあれば,100を超えるが,
そこまでexpendが大きい標本はない.ので,100を超える心配をする必要がない.

C7
(i)

 sum gift

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        gift |      4268     7.44447    15.06256          0        250

平均的な贈り物の量は,7.44である.

tab gift

  amount of |
gift, Dutch |
   guilders |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,561       60.00       60.00
          2 |         25        0.59       60.59
          3 |          6        0.14       60.73
          4 |          1        0.02       60.75
          5 |        158        3.70       64.46
          7 |         14        0.33       64.78
          8 |          1        0.02       64.81
         10 |        702       16.45       81.26
         12 |          1        0.02       81.28
         15 |        152        3.56       84.84
         20 |         86        2.01       86.86
         22 |          2        0.05       86.90
         24 |          1        0.02       86.93
         25 |        387        9.07       95.99
         30 |         36        0.84       96.84
         35 |          7        0.16       97.00
         40 |          4        0.09       97.09
         50 |         86        2.01       99.11
         55 |          1        0.02       99.13
         60 |          1        0.02       99.16
         75 |          3        0.07       99.23
         90 |          1        0.02       99.25
         95 |          1        0.02       99.27
        100 |         25        0.59       99.86
        120 |          1        0.02       99.88
        150 |          1        0.02       99.91
        200 |          1        0.02       99.93
        250 |          3        0.07      100.00
------------+-----------------------------------
      Total |      4,268      100.00

贈り物をしていない人は,60%を占めている.
(ii)

 sum mailsyear

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
   mailsyear |      4268    2.049555      .66758        .25        3.5

平均的な手紙のやりとりは,2.05であり,最小値は.25であり,最大値は3.5である.
(iii)

 reg gift mailsyear

      Source |       SS       df       MS              Number of obs =    4268
-------------+------------------------------           F(  1,  4266) =   59.65
       Model |  13349.7251     1  13349.7251           Prob > F      =  0.0000
    Residual |  954750.114  4266  223.804528           R-squared     =  0.0138
-------------+------------------------------           Adj R-squared =  0.0136
       Total |   968099.84  4267  226.880675           Root MSE      =   14.96

------------------------------------------------------------------------------
        gift |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   mailsyear |   2.649546   .3430598     7.72   0.000     1.976971    3.322122
       _cons |    2.01408   .7394696     2.72   0.006     .5643347    3.463825
------------------------------------------------------------------------------

gift=2.05+2.65*mailsyear+uであり,使用されたサンプルは4268であり,決定係数は0
014である.
(iv)
1通の手紙を送るのに,1ギルダーかかったとしても,その結果2.65ギルダーの募金?が得られるので,手紙を送っても純利益は得られる.
(v)
mailsyearは0以上をとるため,予測される最小値は,2.01であり,0は予測されない.
C8
(i)

clear
set obs 500
gene x = runiform()*10
sum x

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           x |       500    5.008077    2.858507   .0070969   9.931726

サンプルの平均は,5.01であり,標準偏差は,2.86である.
(ii)

gene e=rnormal(0,6)
sum e

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           e |       500   -.0135714    6.121691  -16.42945    18.4913

平均は,-.014であり,標準偏差は,6.12である.乱数なので,平均が正確に0になっているわけではない.
(iii)

gene y=1+2*x+e
sum y

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           y |       500    11.00258    8.533333  -11.14159   32.40562
reg y x

      Source |       SS       df       MS              Number of obs =     500
-------------+------------------------------           F(  1,   498) =  471.06
       Model |  17662.9654     1  17662.9654           Prob > F      =  0.0000
    Residual |  18673.1025   498  37.4961898           R-squared     =  0.4861
-------------+------------------------------           Adj R-squared =  0.4851
       Total |   36336.068   499  72.8177715           Root MSE      =  6.1234

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   2.081336   .0958968    21.70   0.000     1.892924    2.269748
       _cons |   .5790901   .5528477     1.05   0.295    -.5071112    1.665291
------------------------------------------------------------------------------

xの係数についてはほぼ適切に推定できているが,切片については,過小に推定している.
(iv)

 predict res, residuals

sum res

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
         res |       500    1.03e-08    6.117274  -16.33084   18.54772

残さについては,ほぼ平均0になっている.
(v)

reg y x e

      Source |       SS       df       MS              Number of obs =     500
-------------+------------------------------           F(  2,   497) =       .
       Model |   36336.068     2   18168.034           Prob > F      =       .
    Residual |           0   497           0           R-squared     =  1.0000
-------------+------------------------------           Adj R-squared =  1.0000
       Total |   36336.068   499  72.8177715           Root MSE      =       0

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |          2          .        .       .            .           .
           e |          1          .        .       .            .           .
       _cons |          1          .        .       .            .           .
------------------------------------------------------------------------------

(方程式通りなので)決定係数が1である.
(vi)

 set obs 500
obs was 0, now 500

. gene x = runiform()*10

. gene e=rnormal(0,6)

. gene y=1+2*x+e

. reg y x

      Source |       SS       df       MS              Number of obs =     500
-------------+------------------------------           F(  1,   498) =  402.23
       Model |  15569.4954     1  15569.4954           Prob > F      =  0.0000
    Residual |  19276.7792   498   38.708392           R-squared     =  0.4468
-------------+------------------------------           Adj R-squared =  0.4457
       Total |  34846.2746   499  69.8322136           Root MSE      =  6.2216

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.969698   .0982121    20.06   0.000     1.776737    2.162659
       _cons |   1.368813   .5788605     2.36   0.018     .2315036    2.506123
------------------------------------------------------------------------------

もう一回別のデータで繰り返すと,違う結果が得られる.シミュレーションの場合は何度も繰り返すことが肝要である.
今回は,xの係数は前回のものよりよく推定できている,切片の推定もより正確である.