----------------------------------------
      name:  <unnamed>
       log:  C:\Users\acer\Desktop\426 2
> .2.log
  log type:  text
 opened on:   3 Feb 2021, 21:44:19

. use "C:\Users\acer\Desktop\assign2.dta", clear

. gen ldt = ln(dt)

. gen lgdp = ln(gdp)

. gen lpx2 = ln(px2)

. 
. 
. 
. gen lpx3 = ln(px3)

. 
. 
. 
. gen lpx4 = ln(px4)

. gen lst = ln(st)

. gen pd = pm+t

. gen lpd = ln(pd)

. reg3 (lst lpd lpx2 lpx3 lpx4) (ldt lpd
>  lgdp), ols

Multivariate regression
----------------------------------------
> ----------------------------------
Equation             Obs   Parms        
> RMSE    "R-sq"     F-Stat        P
----------------------------------------
> ----------------------------------
lst                   22       4    .165
> 2258    0.9103      43.14   0.0000
ldt                   22       2    .139
> 1259    0.9069      92.53   0.0000
----------------------------------------
> ----------------------------------

----------------------------------------
> --------------------------------------
             |      Coef.   Std. Err.   
>    t                                  
>         P>|t|                         
>                   [95% Con            
>                           f. Interval]
-------------+----------------------------------------------------------------
lst          |
         lpd |  -1.111835   .4515147    -2.46   0.019    -2.027549   -.1961207
        lpx2 |  -.4189546   .1431634    -2.93   0.006    -.7093034   -.1286059
        lpx3 |  -.9424196   .2585266    -3.65   0.001    -1.466736   -.4181034
        lpx4 |   -.521346   .3441643    -1.51   0.139    -1.219344    .1766516
       _cons |    41.4946   3.661911    11.33   0.000      34.0679     48.9213
-------------+----------------------------------------------------------------
ldt          |
         lpd |  -2.181329   .2946999    -7.40   0.000    -2.779008    -1.58365
        lgdp |   .5776586   .0887536     6.51   0.000      .397658    .7576593
       _cons |   31.03578   3.761201     8.25   0.000     23.40771    38.66385
------------------------------------------------------------------------------

. reg3 (lst lpd lpx2 lpx3 lpx4) (ldt lpd lgdp), 2sls nodfk inst(lpx2 lpx3 lpx4 lgdp)

Two-stage least-squares regression
--------------------------------------------------------------------------
Equation             Obs   Parms        RMSE    "R-sq"     F-Stat        P
--------------------------------------------------------------------------
lst                   22       4     .329951    0.6424      13.81   0.0000
ldt                   22       2    .1454858    0.8982      89.20   0.0000
--------------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lst          |
         lpd |    2.10611   1.926677     1.09   0.282    -1.801371    6.013591
        lpx2 |  -.7279628   .3026471    -2.41   0.021     -1.34176    -.114166
        lpx3 |  -1.122146    .464304    -2.42   0.021    -2.063798    -.180494
        lpx4 |  -1.428722   .7811544    -1.83   0.076    -3.012977    .1555325
       _cons |   18.59914   14.05113     1.32   0.194    -9.897873    47.09616
-------------+----------------------------------------------------------------
ldt          |
         lpd |  -2.574157   .4046743    -6.36   0.000    -3.394875    -1.75344
        lgdp |   .5212921   .0955104     5.46   0.000      .327588    .7149961
       _cons |   35.93499   5.106302     7.04   0.000     25.57893    46.29105
------------------------------------------------------------------------------
Endogenous variables:  lst lpd ldt 
Exogenous variables:   lpx2 lpx3 lpx4 lgdp 
------------------------------------------------------------------------------

. reg3 (lst lpd lpx2 lpx3 lpx4) (ldt lpd lgdp), 3sls inst(lpx2 lpx3 lpx4 lgdp)

Three-stage least-squares regression
--------------------------------------------------------------------------
Equation             Obs   Parms        RMSE    "R-sq"       chi2        P
--------------------------------------------------------------------------
lst                   22       4    .2963642    0.6266      57.47   0.0000
ldt                   22       2     .135203    0.8982     178.41   0.0000
--------------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lst          |
         lpd |   2.171576   1.926095     1.13   0.260    -1.603501    5.946652
        lpx2 |  -.7990055   .2985983    -2.68   0.007    -1.384247   -.2137635
        lpx3 |  -1.329743   .4560002    -2.92   0.004    -2.223487   -.4359989
        lpx4 |  -1.171403    .775654    -1.51   0.131    -2.691657     .348851
       _cons |   17.84948   14.04122     1.27   0.204    -9.670808    45.36976
-------------+----------------------------------------------------------------
ldt          |
         lpd |  -2.574157   .4046743    -6.36   0.000    -3.367304    -1.78101
        lgdp |   .5212921   .0955104     5.46   0.000     .3340951     .708489
       _cons |   35.93499   5.106302     7.04   0.000     25.92682    45.94316
------------------------------------------------------------------------------
Endogenous variables:  lst lpd ldt 
Exogenous variables:   lpx2 lpx3 lpx4 lgdp 
------------------------------------------------------------------------------

. reg3 (lst lpd lpx2 lpx3 lpx4) (ldt lpd lgdp), 3sls ireg3 inst(lpx2 lpx3 lpx4 lgdp)

Iteration 1:   tolerance =   .1059484
Iteration 2:   tolerance =  .04569793
Iteration 3:   tolerance =  .01846611
Iteration 4:   tolerance =  .00725496
Iteration 5:   tolerance =  .00281814
Iteration 6:   tolerance =  .00108981
Iteration 7:   tolerance =  .00042072
Iteration 8:   tolerance =  .00016231
Iteration 9:   tolerance =   .0000626
Iteration 10:   tolerance =  .00002414
Iteration 11:   tolerance =  9.310e-06
Iteration 12:   tolerance =  3.590e-06
Iteration 13:   tolerance =  1.384e-06
Iteration 14:   tolerance =  5.339e-07

Three-stage least-squares regression, iterated 
--------------------------------------------------------------------------
Equation             Obs   Parms        RMSE    "R-sq"       chi2        P
--------------------------------------------------------------------------
lst                   22       4    .3022006    0.6117      54.83   0.0000
ldt                   22       2     .135203    0.8982     178.41   0.0000
--------------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lst          |
         lpd |   2.212666   2.005956     1.10   0.270    -1.718936    6.144268
        lpx2 |  -.8435967   .3049354    -2.77   0.006    -1.441259   -.2459342
        lpx3 |  -1.460044   .4623671    -3.16   0.002    -2.366267   -.5538216
        lpx4 |  -1.009892   .7998393    -1.26   0.207    -2.577548     .557764
       _cons |   17.37893   14.61488     1.19   0.234    -11.26571    46.02357
-------------+----------------------------------------------------------------
ldt          |
         lpd |  -2.574157   .4046743    -6.36   0.000    -3.367304    -1.78101
        lgdp |   .5212921   .0955104     5.46   0.000     .3340951     .708489
       _cons |   35.93499   5.106302     7.04   0.000     25.92682    45.94316
------------------------------------------------------------------------------
Endogenous variables:  lst lpd ldt 
Exogenous variables:   lpx2 lpx3 lpx4 lgdp 
------------------------------------------------------------------------------

. reg lst lpd lpx2 lpx3 lpx4

      Source |       SS           df       MS      Number of obs   =        22
-------------+----------------------------------   F(4, 17)        =     43.14
       Model |  4.71070935         4  1.17767734   Prob > F        =    0.0000
    Residual |  .464092568        17  .027299563   R-squared       =    0.9103
-------------+----------------------------------   Adj R-squared   =    0.8892
       Total |  5.17480192        21  .246419139   Root MSE        =    .16523

------------------------------------------------------------------------------
         lst |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         lpd |  -1.111835   .4515147    -2.46   0.025    -2.064448   -.1592222
        lpx2 |  -.4189546   .1431634    -2.93   0.009    -.7210029   -.1169063
        lpx3 |  -.9424196   .2585266    -3.65   0.002    -1.487863   -.3969762
        lpx4 |   -.521346   .3441643    -1.51   0.148    -1.247469    .2047773
       _cons |    41.4946   3.661911    11.33   0.000     33.76865    49.22056
------------------------------------------------------------------------------

. estimate store ols

. ivregress 2sls lst lpx2 lpx3 lpx4 (lpd=lgdp)

Instrumental variables (2SLS) regression          Number of obs   =         22
                                                  Wald chi2(4)    =      55.22
                                                  Prob > chi2     =     0.0000
                                                  R-squared       =     0.6424
                                                  Root MSE        =     .29004

------------------------------------------------------------------------------
         lst |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         lpd |    2.10611   1.926677     1.09   0.274    -1.670107    5.882327
        lpx2 |  -.7279628   .3026471    -2.41   0.016     -1.32114   -.1347853
        lpx3 |  -1.122146    .464304    -2.42   0.016    -2.032165    -.212127
        lpx4 |  -1.428722   .7811544    -1.83   0.067    -2.959757    .1023125
       _cons |   18.59914   14.05113     1.32   0.186    -8.940569    46.13886
------------------------------------------------------------------------------
Instrumented:  lpd
Instruments:   lpx2 lpx3 lpx4 lgdp

. estimate store iv

. hausman iv ols

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |       iv          ols         Difference          S.E.
-------------+----------------------------------------------------------------
         lpd |     2.10611    -1.111835        3.217945        1.873023
        lpx2 |   -.7279628    -.4189546       -.3090082         .266645
        lpx3 |   -1.122146    -.9424196       -.1797266        .3856712
        lpx4 |   -1.428722     -.521346        -.907376        .7012511
------------------------------------------------------------------------------
                       b = consistent under Ho and Ha; obtained from ivregress
          B = inconsistent under Ha, efficient under Ho; obtained from regress

    Test:  Ho:  difference in coefficients not systematic

                  chi2(4) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =        2.95
                Prob>chi2 =      0.5659

. reg ldt lpd lgdp

      Source |       SS           df       MS      Number of obs   =        22
-------------+----------------------------------   F(2, 19)        =     92.53
       Model |  3.58210899         2  1.79105449   Prob > F        =    0.0000
    Residual |  .367764099        19  .019356005   R-squared       =    0.9069
-------------+----------------------------------   Adj R-squared   =    0.8971
       Total |  3.94987309        21  .188089195   Root MSE        =    .13913

------------------------------------------------------------------------------
         ldt |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         lpd |  -2.181329   .2946999    -7.40   0.000    -2.798143   -1.564515
        lgdp |   .5776586   .0887536     6.51   0.000     .3918952    .7634221
       _cons |   31.03578   3.761201     8.25   0.000      23.1635    38.90807
------------------------------------------------------------------------------

. estimate store ols

. ivregress 2sls ldt lgdp (lpd=lpx2 lpx3 lpx4)

Instrumental variables (2SLS) regression          Number of obs   =         22
                                                  Wald chi2(2)    =     178.41
                                                  Prob > chi2     =     0.0000
                                                  R-squared       =     0.8982
                                                  Root MSE        =      .1352

------------------------------------------------------------------------------
         ldt |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         lpd |  -2.574157   .4046743    -6.36   0.000    -3.367304    -1.78101
        lgdp |   .5212921   .0955104     5.46   0.000     .3340951     .708489
       _cons |   35.93499   5.106302     7.04   0.000     25.92682    45.94316
------------------------------------------------------------------------------
Instrumented:  lpd
Instruments:   lgdp lpx2 lpx3 lpx4

. hausman iv ols

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |       iv          ols         Difference          S.E.
-------------+----------------------------------------------------------------
         lpd |     2.10611    -2.181329        4.287439        1.904005
------------------------------------------------------------------------------
                       b = consistent under Ho and Ha; obtained from ivregress
          B = inconsistent under Ha, efficient under Ho; obtained from regress

    Test:  Ho:  difference in coefficients not systematic

                  chi2(1) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =        5.07
                Prob>chi2 =      0.0243

. 
. ivregress 2sls ldt lgdp (lpd=lpx2 lpx3 lpx4)

Instrumental variables (2SLS) regression          Number of obs   =         22
                                                  Wald chi2(2)    =     178.41
                                                  Prob > chi2     =     0.0000
                                                  R-squared       =     0.8982
                                                  Root MSE        =      .1352

------------------------------------------------------------------------------
         ldt |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         lpd |  -2.574157   .4046743    -6.36   0.000    -3.367304    -1.78101
        lgdp |   .5212921   .0955104     5.46   0.000     .3340951     .708489
       _cons |   35.93499   5.106302     7.04   0.000     25.92682    45.94316
------------------------------------------------------------------------------
Instrumented:  lpd
Instruments:   lgdp lpx2 lpx3 lpx4

. estimate store iv

. hausman iv ols

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |       iv          ols         Difference          S.E.
-------------+----------------------------------------------------------------
         lpd |   -2.574157    -2.181329       -.3928286        .2773324
        lgdp |    .5212921     .5776586       -.0563666         .035285
------------------------------------------------------------------------------
                       b = consistent under Ho and Ha; obtained from ivregress
          B = inconsistent under Ha, efficient under Ho; obtained from regress

    Test:  Ho:  difference in coefficients not systematic

                  chi2(2) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =        2.01
                Prob>chi2 =      0.3667
                (V_b-V_B is not positive definite)

. gen lqt = ldt

. reg3 (lqt lpd lpx2 lpx3 lpx4) (lqt lpd lgdp), ols

Multivariate regression
--------------------------------------------------------------------------
Equation             Obs   Parms        RMSE    "R-sq"     F-Stat        P
--------------------------------------------------------------------------
lqt                   22       4     .136235    0.9201      48.95   0.0000
2lqt                  22       2    .1391259    0.9069      92.53   0.0000
--------------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lqt          |
         lpd |  -1.353506   .3722912    -3.64   0.001    -2.108548   -.5984645
        lpx2 |  -.3864994   .1180437    -3.27   0.002    -.6259031   -.1470957
        lpx3 |  -.6782817   .2131651    -3.18   0.003    -1.110601   -.2459629
        lpx4 |  -.3606189   .2837767    -1.27   0.212    -.9361448    .2149069
       _cons |   40.10218   3.019386    13.28   0.000     33.97858    46.22578
-------------+----------------------------------------------------------------
2lqt         |
         lpd |  -2.181329   .2946999    -7.40   0.000    -2.779008    -1.58365
        lgdp |   .5776586   .0887536     6.51   0.000      .397658    .7576593
       _cons |   31.03578   3.761201     8.25   0.000     23.40771    38.66385
------------------------------------------------------------------------------

. reg3 (lqt lpd lpx2 lpx3 lpx4) (lqt lpd lgdp), 2sls nodfk inst(lpx2 lpx3 lpx4 lgdp)

Two-stage least-squares regression
--------------------------------------------------------------------------
Equation             Obs   Parms        RMSE    "R-sq"     F-Stat        P
--------------------------------------------------------------------------
lqt                   22       4    .2329302    0.7665      20.29   0.0000
2lqt                  22       2    .1454858    0.8982      89.20   0.0000
--------------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lqt          |
         lpd |   .7752765   1.360145     0.57   0.572    -1.983225    3.533778
        lpx2 |  -.5909191   .2136549    -2.77   0.009    -1.024231   -.1576068
        lpx3 |  -.7971771   .3277773    -2.43   0.020     -1.46194    -.132414
        lpx4 |  -.9608797    .551459    -1.74   0.090    -2.079291    .1575311
       _cons |   24.95604   9.919453     2.52   0.016     4.838457    45.07362
-------------+----------------------------------------------------------------
2lqt         |
         lpd |  -2.574157   .4046743    -6.36   0.000    -3.394875    -1.75344
        lgdp |   .5212921   .0955104     5.46   0.000      .327588    .7149961
       _cons |   35.93499   5.106302     7.04   0.000     25.57893    46.29105
------------------------------------------------------------------------------
Endogenous variables:  lqt lpd 
Exogenous variables:   lpx2 lpx3 lpx4 lgdp 
------------------------------------------------------------------------------

.  reg3 (lqt lpd lpx2 lpx3 lpx4) (lqt lpd lgdp), 3sls inst(lpx2 lpx3 lpx4 lgdp)

Three-stage least-squares regression
--------------------------------------------------------------------------
Equation             Obs   Parms        RMSE    "R-sq"       chi2        P
--------------------------------------------------------------------------
lqt                   22       4    .2056595    0.7644      81.74   0.0000
2lqt                  22       2     .135203    0.8982     178.41   0.0000
--------------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lqt          |
         lpd |   .7879239   1.360114     0.58   0.562    -1.877851    3.453699
        lpx2 |  -.6046439   .2134422    -2.83   0.005    -1.022983   -.1863049
        lpx3 |  -.8372831   .3273419    -2.56   0.011    -1.478861   -.1957047
        lpx4 |  -.9111679   .5511692    -1.65   0.098     -1.99144    .1691039
       _cons |   24.81121   9.918929     2.50   0.012     5.370467    44.25195
-------------+----------------------------------------------------------------
2lqt         |
         lpd |  -2.574157   .4046743    -6.36   0.000    -3.367304    -1.78101
        lgdp |   .5212921   .0955104     5.46   0.000     .3340951     .708489
       _cons |   35.93499   5.106302     7.04   0.000     25.92682    45.94316
------------------------------------------------------------------------------
Endogenous variables:  lqt lpd 
Exogenous variables:   lpx2 lpx3 lpx4 lgdp 
------------------------------------------------------------------------------

. exit, clear
