Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Including a ratio coefficient of other coefficients in the regression

    Dear All,
    I have been trying to run analysis using the paper of Acemoglu et al. (2008) about the association between democracy and income. One of coefficient in their regression output is (L1.gdppercapita / (1- L1.democracy) ).
    This follows that this coefficient using the coefficient in the the regression for gdp per capita at t-1 divided by the coefficient of 1 minus lagged democracy status. I did try to generate new variables one for 1-L.Democracy and one for the results of the divination, unfortunately with no success as it includes it in the regression, and does not use it for the ration between the total coefficients. How can I run this based on the fact it is the ratio between coefficients?

    Additionally, I have been trying to include in my regression output (using Outreg2) additional rows for robustness checks such as, Hansen J test and AR(2) test (in addition to the regular results of the regression. Does anyone kindly know how would it be possible to do so?

    Thank you in advance.
    Regards

  • #2
    Here is a link to the paper that you reference: https://economics.mit.edu/files/5677

    Originally posted by Louise Jacobs View Post
    One of coefficient in their regression output is (L1.gdppercapita / (1- L1.democracy) ).
    Regards
    Click image for larger version

Name:	Screenshot 2022-05-01 001228.png
Views:	1
Size:	206.5 KB
ID:	1662389




    This is the coefficient named "Implied cumulative effect of income". You calculate it from the estimated coefficients:

    Code:
    . di 0.072/(1-0.706)
    .24489796
    To get the P-value, use lincom or margins: First column:

    Code:
    reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.year_ if sample==1, cluster(code)
    margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
    Res.:

    Code:
    
    .   reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.year_ if sample==1, cluster(code)
    
    Linear regression                               Number of obs     =        945
                                                    F(10, 149)        =     423.18
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.7251
                                                    Root MSE          =     .19154
    
                                     (Std. Err. adjusted for 150 clusters in code)
    ------------------------------------------------------------------------------
                 |               Robust
     fhpolrigaug |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
     fhpolrigaug |
             L1. |   .7063698   .0354523    19.92   0.000     .6363157     .776424
                 |
         lrgdpch |
             L1. |   .0723185   .0099233     7.29   0.000     .0527099     .091927
                 |
    year_numeric |
             34  |  -.0828789   .0223588    -3.71   0.000    -.1270603   -.0386976
             35  |  -.1993669   .0325256    -6.13   0.000    -.2636378   -.1350959
             36  |  -.1117535   .0265578    -4.21   0.000     -.164232   -.0592751
             37  |  -.0501157   .0262773    -1.91   0.058    -.1020399    .0018086
             38  |  -.0726218   .0244017    -2.98   0.003      -.12084   -.0244037
             39  |  -.0526251   .0205823    -2.56   0.012     -.093296   -.0119543
             40  |  -.0322847   .0272072    -1.19   0.237    -.0860466    .0214772
             41  |  -.0562632   .0201141    -2.80   0.006     -.096009   -.0165173
                 |
           _cons |  -.3468646   .0617091    -5.62   0.000    -.4688026   -.2249266
    ------------------------------------------------------------------------------
    
    . margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
    Warning: expression() does not contain predict() or xb().
    Warning: prediction constant over observations.
    
    Predictive margins                              Number of obs     =        945
    Model VCE    : Robust
    
    Expression   : _b[L.lrgdpch]/ (1-_b[L.fhpolrigaug])
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           _cons |    .246291   .0162961    15.11   0.000     .2143513    .2782307
    ------------------------------------------------------------------------------
    
    .
    Last edited by Andrew Musau; 30 Apr 2022, 17:37.

    Comment


    • #3
      o get the P-value, use lincom or margins:
      Actually, given the nature of the expression being evaluated, -lincom- will not work. But -nlcom- will.

      Comment


      • #4
        Originally posted by Clyde Schechter View Post
        Actually, given the nature of the expression being evaluated, -lincom- will not work. But -nlcom- will.
        Correct. Thanks Clyde.

        Comment


        • #5
          Originally posted by Andrew Musau View Post
          Here is a link to the paper that you reference: https://economics.mit.edu/files/5677

          [ATTACH=CONFIG]n1662389[/ATTACH]



          This is the coefficient named "Implied cumulative effect of income". You calculate it from the estimated coefficients:

          Code:
          . di 0.072/(1-0.706)
          .24489796
          To get the P-value, use lincom or margins: First column:

          Code:
          reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.year_ if sample==1, cluster(code)
          margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
          Res.:

          Code:
          
          . reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.year_ if sample==1, cluster(code)
          
          Linear regression Number of obs = 945
          F(10, 149) = 423.18
          Prob > F = 0.0000
          R-squared = 0.7251
          Root MSE = .19154
          
          (Std. Err. adjusted for 150 clusters in code)
          ------------------------------------------------------------------------------
          | Robust
          fhpolrigaug | Coef. Std. Err. t P>|t| [95% Conf. Interval]
          -------------+----------------------------------------------------------------
          fhpolrigaug |
          L1. | .7063698 .0354523 19.92 0.000 .6363157 .776424
          |
          lrgdpch |
          L1. | .0723185 .0099233 7.29 0.000 .0527099 .091927
          |
          year_numeric |
          34 | -.0828789 .0223588 -3.71 0.000 -.1270603 -.0386976
          35 | -.1993669 .0325256 -6.13 0.000 -.2636378 -.1350959
          36 | -.1117535 .0265578 -4.21 0.000 -.164232 -.0592751
          37 | -.0501157 .0262773 -1.91 0.058 -.1020399 .0018086
          38 | -.0726218 .0244017 -2.98 0.003 -.12084 -.0244037
          39 | -.0526251 .0205823 -2.56 0.012 -.093296 -.0119543
          40 | -.0322847 .0272072 -1.19 0.237 -.0860466 .0214772
          41 | -.0562632 .0201141 -2.80 0.006 -.096009 -.0165173
          |
          _cons | -.3468646 .0617091 -5.62 0.000 -.4688026 -.2249266
          ------------------------------------------------------------------------------
          
          . margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
          Warning: expression() does not contain predict() or xb().
          Warning: prediction constant over observations.
          
          Predictive margins Number of obs = 945
          Model VCE : Robust
          
          Expression : _b[L.lrgdpch]/ (1-_b[L.fhpolrigaug])
          
          ------------------------------------------------------------------------------
          | Delta-method
          | Margin Std. Err. z P>|z| [95% Conf. Interval]
          -------------+----------------------------------------------------------------
          _cons | .246291 .0162961 15.11 0.000 .2143513 .2782307
          ------------------------------------------------------------------------------
          
          .

          That makes a lot if sense. Thank you.
          I used the following code for it:
          Code:
          nlcom _b[L.lrgdpch]/(1- _b[L.fhpolrigaug])
          Which sets to get the same results as margin command, but both are still not as accurate as the original paper. I am wondering why?
          How is it possible to add this to the table after the estimations of the regression and forming a table by outreg2, same as the author did?

          Thanks you very much for all that help Andrew! Much appreciated.

          Comment


          • #6
            Originally posted by Louise Jacobs View Post
            I used the following code for it:
            Code:
            nlcom _b[L.lrgdpch]/(1- _b[L.fhpolrigaug])
            Which sets to get the same results as margin command, but both are still not as accurate as the original paper. I am wondering why?

            Obviously, the authors used the rounded coefficients.


            How is it possible to add this to the table after the estimations of the regression and forming a table by outreg2, same as the author did?

            outreg2 is from SSC (FAQ Advice #12). Something like the following. Label the coefficients to replicate the table exactly.

            Code:
            reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.year_ if sample==1, cluster(code)
            local coef= `:di %4.3f `=round(`=_b[L.lrgdpch]', .001)/round(`=(1-_b[L.fhpolrigaug])' , .001)'' 
            margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
            local p= "[`:di %4.3f `=r(table)["pvalue", 1]'']"
            est sto m1
            outreg2 [m1] using myfile.rtf, replace noobs nor2 nocons ///
            addtext("Implied cumulative", "`coef'", "   effect of income", "`p'") ///
            addstat(Observations, e(N), Countries, e(N_clust), R-squared, e(r2)) keep(L.fhpolrigaug L.lrgdpch)
            Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	21.7 KB
ID:	1662408

            Comment


            • #7
              With extra models, you just repeat the code appending the results: Columns 1 and 2:

              Code:
              reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.year_ if sample==1, cluster(code)
              local coef= `:di %4.3f `=round(`=_b[L.lrgdpch]', .001)/round(`=(1-_b[L.fhpolrigaug])' , .001)'' 
              margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
              local p= "[`:di %4.3f `=r(table)["pvalue", 1]'']"
              est sto m1
              outreg2 [m1] using myfile.rtf, replace noobs nor2 nocons ///
              addtext("Implied cumulative", "`coef'", "   effect of income", "`p'") ///
              addstat(Observations, e(N), Countries, e(N_clust), R-squared, e(r2)) keep(L.fhpolrigaug L.lrgdpch)
              
              encode country, g(ncntry)
              reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.ncntry i.year_ if sample==1, cluster(code)
              local coef= `:di %4.3f `=round(`=_b[L.lrgdpch]', .001)/round(`=(1-_b[L.fhpolrigaug])' , .001)'' 
              margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
              local p= "[`:di %4.3f `=r(table)["pvalue", 1]'']"
              est sto m2
              outreg2 [m2] using myfile.rtf, append noobs nor2 nocons ///
              addtext("Implied cumulative", "`coef'", "   effect of income", "`p'") ///
              addstat(Observations, e(N), Countries, e(N_clust), R-squared, e(r2)) keep(L.fhpolrigaug L.lrgdpch)
              Click image for larger version

Name:	Screenshot 2022-05-01 042715.png
Views:	1
Size:	32.6 KB
ID:	1662412

              Comment


              • #8
                Originally posted by Andrew Musau View Post
                With extra models, you just repeat the code appending the results: Columns 1 and 2:

                Code:
                reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.year_ if sample==1, cluster(code)
                local coef= `:di %4.3f `=round(`=_b[L.lrgdpch]', .001)/round(`=(1-_b[L.fhpolrigaug])' , .001)''
                margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
                local p= "[`:di %4.3f `=r(table)["pvalue", 1]'']"
                est sto m1
                outreg2 [m1] using myfile.rtf, replace noobs nor2 nocons ///
                addtext("Implied cumulative", "`coef'", " effect of income", "`p'") ///
                addstat(Observations, e(N), Countries, e(N_clust), R-squared, e(r2)) keep(L.fhpolrigaug L.lrgdpch)
                
                encode country, g(ncntry)
                reg fhpolrigaug L.(fhpolrigaug lrgdpch) i.ncntry i.year_ if sample==1, cluster(code)
                local coef= `:di %4.3f `=round(`=_b[L.lrgdpch]', .001)/round(`=(1-_b[L.fhpolrigaug])' , .001)''
                margins, expression(_b[L.lrgdpch]/ (1-_b[L.fhpolrigaug]))
                local p= "[`:di %4.3f `=r(table)["pvalue", 1]'']"
                est sto m2
                outreg2 [m2] using myfile.rtf, append noobs nor2 nocons ///
                addtext("Implied cumulative", "`coef'", " effect of income", "`p'") ///
                addstat(Observations, e(N), Countries, e(N_clust), R-squared, e(r2)) keep(L.fhpolrigaug L.lrgdpch)
                [ATTACH=CONFIG]n1662412[/ATTACH]
                Dear Andrew,

                Your code fully worked and I really appreciate your help.
                Unfortunately, I am still experiencing a few issues with specific variable and the specification tests while replicating all the results and tables.
                1. In Table 4- there is an additional variable called “age structure”, I have tried to run the calculations as we did with Implied Cumulative effect of Income with no success.
                2. The results included in some of the models included with Hansen Test and Ar(2) specification test. I ran “ereturn list” after running these specification tests using the code provided by the author and the figures of the p-values of these tests differ.
                3. In Tables 5 and 6- the authors include the panel B which includes the first stage results (Panel B) such as, saving rate (t-2) or Labour Share (t-1). I have tried to run “ivreg2” and restoring the results for “outreg2” with no success.

                The rest works fine so thank you again.
                Thank you in advance.
                Regards
                Last edited by Louise Jacobs; 03 May 2022, 16:28.

                Comment


                • #9
                  On outputting the first and second stages of ivreg2 (SSC) using outreg2, see https://www.statalist.org/forums/for...eg2-by-outreg2. I do not have time to replicate the other models, so be specific in what commands you ran and show which results differ from the authors'. In this way, forum members may be able to give you comments.

                  Comment

                  Working...
                  X