Stata Commands Class 5

*Class 10/7/2011

. sysuse auto
(1978 Automobile Data)

. regress price mpg weight length foreign

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  4,    69) =   21.01
       Model |   348708940     4    87177235           Prob > F      =  0.0000
    Residual |   286356456    69  4150093.57           R-squared     =  0.5491
-------------+------------------------------           Adj R-squared =  0.5230
       Total |   635065396    73  8699525.97           Root MSE      =  2037.2

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -13.40719   72.10761    -0.19   0.853    -157.2579    130.4436
      weight |   5.716181   1.016095     5.63   0.000     3.689127    7.743235
      length |  -92.48018    33.5912    -2.75   0.008    -159.4928   -25.46758
     foreign |   3550.194   655.4564     5.42   0.000     2242.594    4857.793
       _cons |    5515.58   5241.941     1.05   0.296    -4941.807    15972.97
------------------------------------------------------------------------------

. regress price  foreign

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  1,    72) =    0.17
       Model |  1507382.66     1  1507382.66           Prob > F      =  0.6802
    Residual |   633558013    72  8799416.85           R-squared     =  0.0024
-------------+------------------------------           Adj R-squared = -0.0115
       Total |   635065396    73  8699525.97           Root MSE      =  2966.4

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     foreign |   312.2587   754.4488     0.41   0.680    -1191.708    1816.225
       _cons |   6072.423    411.363    14.76   0.000     5252.386     6892.46
------------------------------------------------------------------------------

.
.
. regress price mpg weight length foreign

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  4,    69) =   21.01
       Model |   348708940     4    87177235           Prob > F      =  0.0000
    Residual |   286356456    69  4150093.57           R-squared     =  0.5491
-------------+------------------------------           Adj R-squared =  0.5230
       Total |   635065396    73  8699525.97           Root MSE      =  2037.2

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -13.40719   72.10761    -0.19   0.853    -157.2579    130.4436
      weight |   5.716181   1.016095     5.63   0.000     3.689127    7.743235
      length |  -92.48018    33.5912    -2.75   0.008    -159.4928   -25.46758
     foreign |   3550.194   655.4564     5.42   0.000     2242.594    4857.793
       _cons |    5515.58   5241.941     1.05   0.296    -4941.807    15972.97
------------------------------------------------------------------------------

. testparm mpg=0 weight=0 length=0
=exp not allowed
r(101);

. test mpg=0 weight=0 length=0
invalid 'weight'
r(198);

. test mpg=0 weight=0 length=0
invalid 'weight'
r(198);

. test mpg=0

 ( 1)  mpg = 0

       F(  1,    69) =    0.03
            Prob > F =    0.8530

. test weight=0, accum

 ( 1)  mpg = 0
 ( 2)  weight = 0

       F(  2,    69) =   17.88
            Prob > F =    0.0000

. test length=0, accum

 ( 1)  mpg = 0
 ( 2)  weight = 0
 ( 3)  length = 0

       F(  3,    69) =   27.89
            Prob > F =    0.0000

. help test

. test mpg weight length

 ( 1)  mpg = 0
 ( 2)  weight = 0
 ( 3)  length = 0

       F(  3,    69) =   27.89
            Prob > F =    0.0000

. regress price mpg weight length foreign

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  4,    69) =   21.01
       Model |   348708940     4    87177235           Prob > F      =  0.0000
    Residual |   286356456    69  4150093.57           R-squared     =  0.5491
-------------+------------------------------           Adj R-squared =  0.5230
       Total |   635065396    73  8699525.97           Root MSE      =  2037.2

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -13.40719   72.10761    -0.19   0.853    -157.2579    130.4436
      weight |   5.716181   1.016095     5.63   0.000     3.689127    7.743235
      length |  -92.48018    33.5912    -2.75   0.008    -159.4928   -25.46758
     foreign |   3550.194   655.4564     5.42   0.000     2242.594    4857.793
       _cons |    5515.58   5241.941     1.05   0.296    -4941.807    15972.97
------------------------------------------------------------------------------

. gen x=mpg + length

. regress price weight x foreign

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  3,    70) =   27.57
       Model |   343962903     3   114654301           Prob > F      =  0.0000
    Residual |   291102493    70  4158607.05           R-squared     =  0.5416
-------------+------------------------------           Adj R-squared =  0.5220
       Total |   635065396    73  8699525.97           Root MSE      =  2039.3

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      weight |   4.990597   .7571384     6.59   0.000     3.480532    6.500662
           x |  -82.38323      32.27    -2.55   0.013    -146.7437   -18.02273
     foreign |   3443.444   648.4746     5.31   0.000     2150.102    4736.785
       _cons |   7309.644   4971.321     1.47   0.146    -2605.344    17224.63
------------------------------------------------------------------------------

. regress price mpg weight length foreign

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  4,    69) =   21.01
       Model |   348708940     4    87177235           Prob > F      =  0.0000
    Residual |   286356456    69  4150093.57           R-squared     =  0.5491
-------------+------------------------------           Adj R-squared =  0.5230
       Total |   635065396    73  8699525.97           Root MSE      =  2037.2

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -13.40719   72.10761    -0.19   0.853    -157.2579    130.4436
      weight |   5.716181   1.016095     5.63   0.000     3.689127    7.743235
      length |  -92.48018    33.5912    -2.75   0.008    -159.4928   -25.46758
     foreign |   3550.194   655.4564     5.42   0.000     2242.594    4857.793
       _cons |    5515.58   5241.941     1.05   0.296    -4941.807    15972.97
------------------------------------------------------------------------------

. testparm mpg = length
=exp not allowed
r(101);

. test mpg = length

 ( 1)  mpg - length = 0

       F(  1,    69) =    1.14
            Prob > F =    0.2886

. test mpg + length + weight = 10

 ( 1)  mpg + weight + length = 10

       F(  1,    69) =    1.69
            Prob > F =    0.1979

. clear all

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = rnormal()

.
. gen y = 13 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =   54.57
       Model |  76.6687251     1  76.6687251           Prob > F      =  0.0001
    Residual |  11.2391137     8  1.40488922           R-squared     =  0.8721
-------------+------------------------------           Adj R-squared =  0.8562
       Total |  87.9078388     9  9.76753765           Root MSE      =  1.1853

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .9640113   .1304951     7.39   0.000     .6630892    1.264933
       _cons |   12.57386   .3804552    33.05   0.000     11.69653    13.45119
------------------------------------------------------------------------------

.
end of do-file

. l

     +---------------------------+
     |  x           u          y |
     |---------------------------|
  1. | -4   -.4408787   8.559121 |
  2. | -3    .9444048    10.9444 |
  3. | -2    1.112015   12.11201 |
  4. | -1   -1.636805    10.3632 |
  5. |  0   -2.022099    10.9779 |
     |---------------------------|
  6. |  1   -1.056625   12.94337 |
  7. |  2   -.3617832   14.63822 |
  8. |  3   -1.638646   14.36135 |
  9. |  4    .1321672   17.13217 |
 10. |  5    .5269327   18.52693 |
     +---------------------------+

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = rnormal()

.
. gen y = 13 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =  153.21
       Model |   89.278253     1   89.278253           Prob > F      =  0.0000
    Residual |  4.66183805     8  .582729757           R-squared     =  0.9504
-------------+------------------------------           Adj R-squared =  0.9442
       Total |  93.9400911     9  10.4377879           Root MSE      =  .76337

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |    1.04027    .084044    12.38   0.000     .8464637    1.234075
       _cons |    12.6796   .2450282    51.75   0.000     12.11456    13.24463
------------------------------------------------------------------------------

.
end of do-file

. l

     +---------------------------+
     |  x           u          y |
     |---------------------------|
  1. | -4    .4131801    9.41318 |
  2. | -3   -.2172103   9.782789 |
  3. | -2   -1.940526   9.059474 |
  4. | -1    .1595429   12.15954 |
  5. |  0   -.4351972    12.5648 |
     |---------------------------|
  6. |  1   -.4824004    13.5176 |
  7. |  2   -.6852596   14.31474 |
  8. |  3    .3119282   16.31193 |
  9. |  4   -.6512468   16.34875 |
 10. |  5    .5245214   18.52452 |
     +---------------------------+

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 2*rnormal()

.
. gen y = 13 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    6.12
       Model |   57.454403     1   57.454403           Prob > F      =  0.0385
    Residual |   75.124869     8  9.39060862           R-squared     =  0.4334
-------------+------------------------------           Adj R-squared =  0.3625
       Total |  132.579272     9  14.7310302           Root MSE      =  3.0644

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |    .834516   .3373804     2.47   0.038     .0565153    1.612517
       _cons |   12.81116   .9836245    13.02   0.000     10.54291     15.0794
------------------------------------------------------------------------------

.
end of do-file

. l

     +---------------------------+
     |  x           u          y |
     |---------------------------|
  1. | -4    1.889196    10.8892 |
  2. | -3    2.905338   12.90534 |
  3. | -2   -1.560753   9.439247 |
  4. | -1     1.74258   13.74258 |
  5. |  0   -5.770178   7.229822 |
     |---------------------------|
  6. |  1   -3.310988   10.68901 |
  7. |  2   -.3816336   14.61837 |
  8. |  3    .8416764   16.84168 |
  9. |  4    3.211821   20.21182 |
 10. |  5   -2.282907   15.71709 |
     +---------------------------+

. sum u

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           u |        10   -.2715849    2.932275  -5.770178   3.211821

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 2*rnormal()

.
. gen y = 13 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =   17.10
       Model |  107.077818     1  107.077818           Prob > F      =  0.0033
    Residual |  50.0827225     8  6.26034031           R-squared     =  0.6813
-------------+------------------------------           Adj R-squared =  0.6415
       Total |  157.160541     9  17.4622823           Root MSE      =  2.5021

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |    1.13926   .2754685     4.14   0.003     .5040282    1.774491
       _cons |   13.31803   .8031219    16.58   0.000     11.46603    15.17003
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. set seed 123456

.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 2*rnormal()

.
. gen y = 13 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =   23.50
       Model |  96.7017654     1  96.7017654           Prob > F      =  0.0013
    Residual |  32.9152951     8  4.11441189           R-squared     =  0.7461
-------------+------------------------------           Adj R-squared =  0.7143
       Total |   129.61706     9  14.4018956           Root MSE      =  2.0284

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.082655   .2233196     4.85   0.001     .5676794    1.597631
       _cons |   12.31683    .651083    18.92   0.000     10.81543    13.81823
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. set seed 123456

.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 2*rnormal()

.
. gen y = 13 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =   23.50
       Model |  96.7017654     1  96.7017654           Prob > F      =  0.0013
    Residual |  32.9152951     8  4.11441189           R-squared     =  0.7461
-------------+------------------------------           Adj R-squared =  0.7143
       Total |   129.61706     9  14.4018956           Root MSE      =  2.0284

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.082655   .2233196     4.85   0.001     .5676794    1.597631
       _cons |   12.31683    .651083    18.92   0.000     10.81543    13.81823
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. set seed 123456

.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 2*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =   23.50
       Model |  96.7017588     1  96.7017588           Prob > F      =  0.0013
    Residual |  32.9152966     8  4.11441208           R-squared     =  0.7461
-------------+------------------------------           Adj R-squared =  0.7143
       Total |  129.617055     9   14.401895           Root MSE      =  2.0284

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.082655   .2233196     4.85   0.001     .5676793    1.597631
       _cons |   .3168316    .651083     0.49   0.640    -1.184569    1.818232
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 4*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    9.21
       Model |   86.985876     1   86.985876           Prob > F      =  0.0162
    Residual |  75.5966165     8  9.44957706           R-squared     =  0.5350
-------------+------------------------------           Adj R-squared =  0.4769
       Total |  162.582493     9  18.0647214           Root MSE      =   3.074

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.026827   .3384381     3.03   0.016     .2463877    1.807267
       _cons |    2.89625   .9867081     2.94   0.019     .6208968    5.171603
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 10*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.79
       Model |  147.954858     1  147.954858           Prob > F      =  0.4002
    Residual |  1499.17104     8   187.39638           R-squared     =  0.0898
-------------+------------------------------           Adj R-squared = -0.0239
       Total |   1647.1259     9  183.013988           Root MSE      =  13.689

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |  -1.339176    1.50714    -0.89   0.400    -4.814647    2.136295
       _cons |    4.82151   4.394031     1.10   0.304    -5.311143    14.95416
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 8*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.81
       Model |  70.4872591     1  70.4872591           Prob > F      =  0.3933
    Residual |   692.66558     8  86.5831974           R-squared     =  0.0924
-------------+------------------------------           Adj R-squared = -0.0211
       Total |  763.152839     9  84.7947599           Root MSE      =   9.305

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .9243327   1.024448     0.90   0.393    -1.438048    3.286714
       _cons |   -.649502   2.986753    -0.22   0.833    -7.536967    6.237963
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 6*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    5.95
       Model |  116.484353     1  116.484353           Prob > F      =  0.0406
    Residual |  156.669295     8  19.5836619           R-squared     =  0.4264
-------------+------------------------------           Adj R-squared =  0.3547
       Total |  273.153648     9  30.3504054           Root MSE      =  4.4253

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.188247   .4872142     2.44   0.041     .0647292    2.311765
       _cons |   2.580169   1.420461     1.82   0.107     -.695421    5.855759
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.87
       Model |  41.9120937     1  41.9120937           Prob > F      =  0.3789
    Residual |  386.497566     8  48.3121958           R-squared     =  0.0978
-------------+------------------------------           Adj R-squared = -0.0149
       Total |   428.40966     9  47.6010733           Root MSE      =  6.9507

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |    .712759   .7652466     0.93   0.379    -1.051903    2.477421
       _cons |   2.885526   2.231058     1.29   0.232    -2.259304    8.030355
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    3.15
       Model |  139.153144     1  139.153144           Prob > F      =  0.1139
    Residual |  353.565661     8  44.1957076           R-squared     =  0.2824
-------------+------------------------------           Adj R-squared =  0.1927
       Total |  492.718805     9  54.7465338           Root MSE      =   6.648

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.298732   .7319191     1.77   0.114    -.3890764     2.98654
       _cons |   .3043066   2.133892     0.14   0.890    -4.616458    5.225071
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.17
       Model |  20.4067413     1  20.4067413           Prob > F      =  0.6880
    Residual |  941.257844     8  117.657231           R-squared     =  0.0212
-------------+------------------------------           Adj R-squared = -0.1011
       Total |  961.664586     9  106.851621           Root MSE      =  10.847

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |  -.4973474   1.194214    -0.42   0.688    -3.251211    2.256516
       _cons |   .4303908   3.481704     0.12   0.905    -7.598432    8.459214
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.51
       Model |  66.6436542     1  66.6436542           Prob > F      =  0.4955
    Residual |   1045.5088     8    130.6886           R-squared     =  0.0599
-------------+------------------------------           Adj R-squared = -0.0576
       Total |  1112.15246     9  123.572495           Root MSE      =  11.432

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |    .898778   1.258612     0.71   0.495    -2.003587    3.801143
       _cons |   1.394959   3.669453     0.38   0.714    -7.066815    9.856733
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    3.11
       Model |  143.407101     1  143.407101           Prob > F      =  0.1157
    Residual |  368.598698     8  46.0748372           R-squared     =  0.2801
-------------+------------------------------           Adj R-squared =  0.1901
       Total |  512.005799     9  56.8895332           Root MSE      =  6.7878

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.318434   .7473171     1.76   0.116    -.4048825     3.04175
       _cons |   2.706078   2.178785     1.24   0.249    -2.318209    7.730366
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    2.25
       Model |  132.168254     1  132.168254           Prob > F      =  0.1724
    Residual |  470.954897     8  58.8693622           R-squared     =  0.2191
-------------+------------------------------           Adj R-squared =  0.1215
       Total |  603.123151     9  67.0136835           Root MSE      =  7.6726

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.265717   .8447296     1.50   0.172    -.6822329    3.213667
       _cons |  -2.030329   2.462789    -0.82   0.434     -7.70953    3.648872
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =   47.40
       Model |  448.724827     1  448.724827           Prob > F      =  0.0001
    Residual |  75.7391763     8  9.46739704           R-squared     =  0.8556
-------------+------------------------------           Adj R-squared =  0.8375
       Total |  524.464003     9  58.2737781           Root MSE      =  3.0769

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   2.332185    .338757     6.88   0.000      1.55101    3.113361
       _cons |    2.07579    .987638     2.10   0.069    -.2017077    4.353287
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

.
. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    1.42
       Model |  39.7839516     1  39.7839516           Prob > F      =  0.2682
    Residual |  224.743003     8  28.0928754           R-squared     =  0.1504
-------------+------------------------------           Adj R-squared =  0.0442
       Total |  264.526955     9  29.3918839           Root MSE      =  5.3003

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .6944276   .5835407     1.19   0.268    -.6512196    2.040075
       _cons |   1.131362   1.701299     0.66   0.525     -2.79184    5.054564
------------------------------------------------------------------------------

.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =   15.27
       Model |  453.616177     1  453.616177           Prob > F      =  0.0045
    Residual |  237.692273     8  29.7115342           R-squared     =  0.6562
-------------+------------------------------           Adj R-squared =  0.6132
       Total |  691.308451     9  76.8120501           Root MSE      =  5.4508

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   2.344862   .6001165     3.91   0.004     .9609909    3.728733
       _cons |   2.365843   1.749625     1.35   0.213      -1.6688    6.400486
------------------------------------------------------------------------------

. test x = 1

 ( 1)  x = 1

       F(  1,     8) =    5.02
            Prob > F =    0.0553

.
.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    5.74
       Model |  99.9924721     1  99.9924721           Prob > F      =  0.0435
    Residual |  139.384517     8  17.4230646           R-squared     =  0.4177
-------------+------------------------------           Adj R-squared =  0.3449
       Total |  239.376989     9  26.5974432           Root MSE      =  4.1741

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.100922   .4595527     2.40   0.043      .041192    2.160653
       _cons |   .7777693   1.339815     0.58   0.578    -2.311849    3.867388
------------------------------------------------------------------------------

. test x = 1

 ( 1)  x = 1

       F(  1,     8) =    0.05
            Prob > F =    0.8317

.
.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.09
       Model |  3.49474224     1  3.49474224           Prob > F      =  0.7739
    Residual |  316.589232     8   39.573654           R-squared     =  0.0109
-------------+------------------------------           Adj R-squared = -0.1127
       Total |  320.083975     9  35.5648861           Root MSE      =  6.2908

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .2058167   .6925898     0.30   0.774    -1.391298    1.802932
       _cons |   4.210882   2.019229     2.09   0.071     -.445468    8.867233
------------------------------------------------------------------------------

. test x = 1

 ( 1)  x = 1

       F(  1,     8) =    1.31
            Prob > F =    0.2846

.
.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10
obs was 0, now 10

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

. regress y x

      Source |       SS       df       MS              Number of obs =      10
-------------+------------------------------           F(  1,     8) =    0.34
       Model |  14.7237939     1  14.7237939           Prob > F      =  0.5778
    Residual |  350.000794     8  43.7500993           R-squared     =  0.0404
-------------+------------------------------           Adj R-squared = -0.0796
       Total |  364.724588     9  40.5249543           Root MSE      =  6.6144

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .4224574   .7282199     0.58   0.578    -1.256821    2.101735
       _cons |   2.700083   2.123108     1.27   0.239    -2.195812    7.595978
------------------------------------------------------------------------------

. test x = 1

 ( 1)  x = 1

       F(  1,     8) =    0.63
            Prob > F =    0.4506

.
.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10000
obs was 0, now 10000

.
. gen x = _n - _N/2

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

. regress y x

      Source |       SS       df       MS              Number of obs =   10000
-------------+------------------------------           F(  1,  9998) =       .
       Model |  8.3335e+10     1  8.3335e+10           Prob > F      =  0.0000
    Residual |  482616.999  9998  48.2713542           R-squared     =  1.0000
-------------+------------------------------           Adj R-squared =  1.0000
       Total |  8.3336e+10  9999  8334426.92           Root MSE      =  6.9478

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   1.000013   .0000241  4.2e+04   0.000     .9999655     1.00006
       _cons |    1.12393   .0694776    16.18   0.000       .98774     1.26012
------------------------------------------------------------------------------

. test x = 1

 ( 1)  x = 1

       F(  1,  9998) =    0.28
            Prob > F =    0.5972

.
.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10000
obs was 0, now 10000

.
. gen x = (_n - _N/2)/1000

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

. regress y x

      Source |       SS       df       MS              Number of obs =   10000
-------------+------------------------------           F(  1,  9998) = 1701.29
       Model |  82590.2737     1  82590.2737           Prob > F      =  0.0000
    Residual |  485359.915  9998  48.5457006           R-squared     =  0.1454
-------------+------------------------------           Adj R-squared =  0.1453
       Total |  567950.188  9999  56.8006989           Root MSE      =  6.9675

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .9955317    .024136    41.25   0.000     .9482202    1.042843
       _cons |   1.032252   .0696747    14.82   0.000     .8956755    1.168829
------------------------------------------------------------------------------

. test x = 1

 ( 1)  x = 1

       F(  1,  9998) =    0.03
            Prob > F =    0.8531

.
.
end of do-file

. do "C:\DOCUME~1\labuser\LOCALS~1\Temp\STD04000000.tmp"

. clear all

. * set seed 123456
.
. set obs 10000
obs was 0, now 10000

.
. gen x = (_n - _N/2)/1000

.
. gen u = 7*rnormal()

.
. gen y = 1 + 1* x + u

. regress y x

      Source |       SS       df       MS              Number of obs =   10000
-------------+------------------------------           F(  1,  9998) = 1628.90
       Model |  80970.0689     1  80970.0689           Prob > F      =  0.0000
    Residual |  496985.193  9998   49.708461           R-squared     =  0.1401
-------------+------------------------------           Adj R-squared =  0.1400
       Total |  577955.262  9999  57.8013063           Root MSE      =  7.0504

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .9857184   .0244234    40.36   0.000     .9378437    1.033593
       _cons |   .9531072   .0705042    13.52   0.000     .8149047     1.09131
------------------------------------------------------------------------------

. test x = 1

 ( 1)  x = 1

       F(  1,  9998) =    0.34
            Prob > F =    0.5587

.
.
end of do-file

---------------------------------------------------------------------------------------

clear all
set seed 123456
set obs 10000
gen x = (_n - _N/2)/1000

gen u = 7*rnormal()

gen y = 1 + 1* x + u
regress y x
test x = 1

No comments: