-------------
      name:  <unnamed>
       log:  C:\Users\kriegj\Desktop\Generalized Least Squares.smcl
  log type:  smcl
 opened on:  23 Jan 2023, 13:28:39

. drop res

. reg math4 math3 exp size

      Source |       SS           df       MS      Number of obs   =    38,537
-------------+----------------------------------   F(3, 38533)     =  15113.06
       Model |  19832.9387         3  6610.97956   Prob > F        =    0.0000
    Residual |  16855.6765    38,533  .437434835   R-squared       =    0.5406
-------------+----------------------------------   Adj R-squared   =    0.5405
       Total |  36688.6152    38,536  .952060805   Root MSE        =    .66139

-------------+----------------------------------------------------------------
        math4 |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       math3 |    .7300081    .0034367    212.42    0.000      .7232721     .7367441
         exp |    .0026091      .00035      7.45    0.000       .001923     .0032952
        size |    .0008199    .0006955      1.18    0.238     -.0005433     .0021831
       _cons |   -.0338728    .0159763     -2.12    0.034     -.0651868    -.0025589
-------------+----------------------------------------------------------------

. predict res, resid

. gen res2 = res^2

. gen lnres2 = ln(res2)

. reg lnres2 math3 exp size

      Source |       SS           df       MS      Number of obs   =    38,537
-------------+----------------------------------   F(3, 38533)     =      1.91
       Model |  30.1300572         3  10.0433524   Prob > F        =    0.1253
    Residual |  202471.547    38,533  5.25449737   R-squared       =    0.0001
-------------+----------------------------------   Adj R-squared   =    0.0001
       Total |  202501.677    38,536  5.25487018   Root MSE        =    2.2923

-------------+----------------------------------------------------------------
       lnres2 |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       math3 |    .0233119    .0119111      1.96    0.050     -.0000341     .0466578
         exp |   -.0002603    .0012132     -0.21    0.830     -.0026382     .0021176
        size |   -.0032317    .0024105     -1.34    0.180     -.0079564     .0014931
       _cons |   -2.160667    .0553714    -39.02    0.000     -2.269196    -2.052138
-------------+----------------------------------------------------------------

. predict andy, xb

. gen expandy = exp(andy)

. gen w = 1/(expandy^.5)

. gen wmath4 = w*math4

. gen wmath3 =w*math3

. gen wexp = w*exp

. gen wsize = w*size

. reg math4 math3 size exp

      Source |       SS           df       MS      Number of obs   =    38,537
-------------+----------------------------------   F(3, 38533)     =  15113.06
       Model |  19832.9387         3  6610.97956   Prob > F        =    0.0000
    Residual |  16855.6765    38,533  .437434835   R-squared       =    0.5406
-------------+----------------------------------   Adj R-squared   =    0.5405
       Total |  36688.6152    38,536  .952060805   Root MSE        =    .66139

-------------+----------------------------------------------------------------
        math4 |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
       math3 |    .7300081    .0034367    212.42    0.000      .7232721     .7367441
        size |    .0008199    .0006955      1.18    0.238     -.0005433     .0021831
         exp |    .0026091      .00035      7.45    0.000       .001923     .0032952
       _cons |   -.0338728    .0159763     -2.12    0.034     -.0651868    -.0025589
-------------+----------------------------------------------------------------

. reg wmath4 w wmath3 wsize wexp, noconstant

      Source |       SS           df       MS      Number of obs   =    38,537
-------------+----------------------------------   F(4, 38533)     =  11451.72
       Model |  186718.037         4  46679.5092   Prob > F        =    0.0000
    Residual |  157068.265    38,533  4.07620132   R-squared       =    0.5431
-------------+----------------------------------   Adj R-squared   =    0.5431
       Total |  343786.302    38,537  8.92094097   Root MSE        =     2.019

-------------+----------------------------------------------------------------
       wmath4 |      Coef.    Std. Err.       t    P>|t|      [95% Con f. Interval]
-------------+----------------------------------------------------------------
           w |   -.0305968    .0160298     -1.91    0.056     -.0620155     .0008219
      wmath3 |    .7305715    .0034351    212.68    0.000      .7238386     .7373043
       wsize |    .0006852    .0006959      0.98    0.325     -.0006788     .0020491
        wexp |    .0025807    .0003494      7.39    0.000      .0018958     .0032656
-------------+----------------------------------------------------------------

. log close
      name:  <unnamed>
       log:  C:\Users\kriegj\Desktop\Generalized Least Squares.smcl
  log type:  smcl
 closed on:  23 Jan 2023, 13:50:02
-------------