-------------
      name:  <unnamed>
       log:  C:\Users\kriegj\Desktop\White's Correction.smcl
  log type:  smcl
 opened on:  25 Jan 2023, 12:08:33

. reg math4 math3

      Source |       SS           df       MS      Number of obs   =    38,537
-------------+----------------------------------   F(1, 38535)     =  45215.17
       Model |  19807.5063         1  19807.5063   Prob > F        =    0.0000
    Residual |  16881.1089    38,535  .438072114   R-squared       =    0.5399
-------------+----------------------------------   Adj R-squared   =    0.5399
       Total |  36688.6152    38,536  .952060805   Root MSE        =    .66187

-------------+----------------------------------------------------------------
        math4 |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       math3 |    .7308445     .003437    212.64    0.000      .7241078     .7375812
       _cons |    .0176832    .0033843      5.23    0.000      .0110499     .0243165
-------------+----------------------------------------------------------------

. predict res, resid

. gen res2 = res^2

. sum math3

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       math3 |     38,537    .0852288     .980972  -2.562944   1.910122

. gen andy = (math3 - .0852288)^2

. total andy

Total estimation                  Number of obs   =     38,537

-------------+------------------------------------------------
             |      Total    Std. Err.      [95% Con f. Interval]
-------------+------------------------------------------------
        andy |    37083.43    236.5973       36619.69     37547.16
-------------+------------------------------------------------

. gen ian = res2*andy

. total ian

Total estimation                  Number of obs   =     38,537

-------------+------------------------------------------------
             |      Total    Std. Err.      [95% Con f. Interval]
-------------+------------------------------------------------
         ian |    19759.37    329.0541       19114.41     20404.32
-------------+------------------------------------------------

. reg math4 math3, robust

Linear regression                               Number of obs     =     38,537
                                                F(1, 38535)       =   37171.84
                                                Prob > F          =     0.0000
                                                R-squared         =     0.5399
                                                Root MSE          =     .66187

-------------+----------------------------------------------------------------
             |               Robust
        math4 |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       math3 |    .7308445    .0037907    192.80    0.000      .7234147     .7382743
       _cons |    .0176832    .0033768      5.24    0.000      .0110646     .0243018
-------------+----------------------------------------------------------------

. use "C:\Users\kriegj\Documents\Classes\475 Winter, 2023\class autocorrelation.dta", clear

. line pce year || line pdi year

. browse

. reg pce pdi

      Source |       SS           df       MS      Number of obs   =       228
-------------+----------------------------------   F(1, 226)       >  99999.00
       Model |  1.1300e+09         1  1.1300e+09   Prob > F        =    0.0000
    Residual |  1177220.88       226  5208.94194   R-squared       =    0.9990
-------------+----------------------------------   Adj R-squared   =    0.9990
       Total |  1.1311e+09       227  4982986.28   Root MSE        =    72.173

-------------+----------------------------------------------------------------
          pce |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
         pdi |    .9308109    .0019985    465.75    0.000      .9268729      .934749
       _cons |   -49.44969    6.711127     -7.37    0.000     -62.67408    -36.22531
-------------+----------------------------------------------------------------

. predict res, resid

. line res year

. gen lres = res[_n-1]
(1 missing value generated)

. browse

. scatter res lres

. reg res lres

      Source |       SS           df       MS      Number of obs   =       227
-------------+----------------------------------   F(1, 225)       =   1345.64
       Model |  1006513.64         1  1006513.64   Prob > F        =    0.0000
    Residual |  168295.551       225  747.980226   R-squared       =    0.8567
-------------+----------------------------------   Adj R-squared   =    0.8561
       Total |  1174809.19       226  5198.27073   Root MSE        =    27.349

-------------+----------------------------------------------------------------
          res |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
        lres |    .9433398     .025716     36.68    0.000      .8926648     .9940148
       _cons |    .6750858    1.815394      0.37    0.710     -2.902264     4.252436
-------------+----------------------------------------------------------------

. reg res lres, noconstant

      Source |       SS           df       MS      Number of obs   =       227
-------------+----------------------------------   F(1, 226)       =   1350.67
       Model |  1006420.78         1  1006420.78   Prob > F        =    0.0000
    Residual |  168398.985       226  745.128254   R-squared       =    0.8567
-------------+----------------------------------   Adj R-squared   =    0.8560
       Total |  1174819.76       227  5175.41746   Root MSE        =    27.297

-------------+----------------------------------------------------------------
          res |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
        lres |    .9432119    .0256646     36.75    0.000      .8926393     .9937845
-------------+----------------------------------------------------------------

. line res year

. exit, clear