Announcement

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

  • Including p-values and F statistic in table using asdoc

    Hi,

    I created a table using:

    asdoc xtreg lnGDPper high_frac_dem low_frac_dem lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper i.year, fe vce(cluster country), replace label nest tzok

    But I want to suppress the output of the year fixed effects on my table. Also, I want to add [local TwowayFixedEffects "Yes"] and the p-value of:

    ttest low_frac_dem == high_frac_dem

    as a separate row in my table. In addition, as part of the following command,

    asdoc ivreghdfe lnGDPper lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper lnGDP_trans (high_frac_dem low_frac_dem = frac_iv3 frac_iv4), robust cluster (country) first, label nest tzok

    I want to include the following as separate rows:

    qui matrix A=e(first)
    scalar R2first = A[3,1]
    scalar Ffirst = A[4,1]
    scalar R2first2 = A[3,2]
    scalar Ffirst2 = A[4,2]

    How do I do all the above efficiently using the asdoc command? I'm quite specific about asdoc as it neatly produces journal publications-compatible tables. Can someone please help?

    Thank you for your time!

  • #2
    Jeff Pitblado (StataCorp) could you please help with this?

    Comment


    • #3
      Originally posted by Abhinaya Kanakasabai View Post
      Hi,

      I created a table using:

      asdoc xtreg lnGDPper high_frac_dem low_frac_dem lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper i.year, fe vce(cluster country), replace label nest tzok

      But I want to suppress the output of the year fixed effects on my table. Also, I want to add [local TwowayFixedEffects "Yes"] and the p-value of:

      ttest low_frac_dem == high_frac_dem

      as a separate row in my table. In addition, as part of the following command,

      asdoc ivreghdfe lnGDPper lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper lnGDP_trans (high_frac_dem low_frac_dem = frac_iv3 frac_iv4), robust cluster (country) first, label nest tzok

      I want to include the following as separate rows:

      qui matrix A=e(first)
      scalar R2first = A[3,1]
      scalar Ffirst = A[4,1]
      scalar R2first2 = A[3,2]
      scalar Ffirst2 = A[4,2]

      How do I do all the above efficiently using the asdoc command? I'm quite specific about asdoc as it neatly produces journal publications-compatible tables. Can someone please help?

      Thank you for your time!
      asdoc is not an official Stata program. You might want to ask Attaullah Shah

      Comment


      • #4
        Thank you for your reply, Girish!

        Attaullah Shah Could you please help?

        Comment


        • #5
          Hello Abhinaya Kanakasabai
          I can comment on the following:
          1. The first line of code has incorrect syntax. You have two commas in the code.
          Code:
          asdoc xtreg lnGDPper high_frac_dem low_frac_dem lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper ///
          i.year, fe vce(cluster country), replace label nest tzok
          it should be
          Code:
          asdoc xtreg lnGDPper high_frac_dem low_frac_dem lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper ///
          i.year, fe vce(cluster country) replace label nest tzok
          2. If you wish to report only selected variables in the nested regression, you can use either the keep() option of nested regression of asdoc or the drop() option of nested regressions of asdoc.

          3. To add additional text or statistics, you can use the add() option. The following text is copied from the 'asdoc' help file, which you can access yourself by typing -help asdoc-

          add(text1, text2 | text3, text4...)
          This option adds text legends to the bottom cells of the nested regression table. This option is usually used to show the presence or absence of some variables in the respective regression models. For example, we might include firm, year or industry dummies in a regression model and just indicate with 'yes' or 'no' the presence of these dummies. This version of asdoc supports up to a maximum of three categories of legends. The text legends should be added in pairs of two, each one separated by a comma. For example:
          Code:
                      add(Year dummies, yes)
                      add(Year dummies, yes, industry dummies, yes)
                      add(Year dummies, yes, industry dummies, yes, country dummies, no)
          Since I don't have access to your data, I'm providing a tentative code based on your request.

          Code:
          * You need to have the macros ready before running the asdoc command
          ivreghdfe lnGDPper lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper lnGDP_trans ///
          (high_frac_dem low_frac_dem = frac_iv3 frac_iv4), robust cluster (country) first
          
          qui matrix A=e(first)
          
          loc R2first: dis %9.3f = A[3,1]
          loc Ffirst: dis %9.3f = A[4,1]
          loc R2first2 : dis %9.3f = A[3,2]
          loc Ffirst2:dis %9.3f =A[4,2]
          
          asdoc ivreghdfe lnGDPper lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper lnGDP_trans ///
                    (high_frac_dem low_frac_dem = frac_iv3 frac_iv4), robust cluster (country) first, ///
                    label nest tzok add(R2first, `R2first', Ffirst, `Ffirst', Ffirst2, `Ffirst2') ///
                    keep(lag1_lnGDPper lag2_lnGDPper lag3_lnGDPper lag4_lnGDPper lnGDP_trans) replace
          An example that I tested because I have its data:
          Code:
          sysuse auto
          ivreghdfe price weight (length=gear), absorb(rep78, tol(1e-6)) first
          qui matrix A=e(first)
          loc R2first: dis %9.3f = A[3,1]
          loc Ffirst: dis %9.3f = A[4,1]
          loc R2first2 : dis %9.3f = A[3,2]
          loc Ffirst2:dis %9.3f =A[4,2]
          asdoc ivreghdfe price weight (length=gear), absorb(rep78) ///
                    nest label tzok add(R2first, `R2first', Ffirst, `Ffirst', Ffirst2, `Ffirst2') ///
                     keep(weight) replace
          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	25.8 KB
ID:	1725833


          If you need more elegance, flexibility, and options, consider asdocx that can export to Excel, Word, LaTeX, or HTML with dozen additional features.



          Last edited by Attaullah Shah; 02 Sep 2023, 13:23.
          Regards
          --------------------------------------------------
          Attaullah Shah, PhD.
          Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
          FinTechProfessor.com
          https://asdocx.com
          Check out my asdoc program, which sends outputs to MS Word.
          For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

          Comment


          • #6
            Attaullah Shah thank you so much for your reply!

            Comment

            Working...
            X