Announcement

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

  • #16
    Andrew Musau
    thank you for your time,
    i have tried but it is not working because est restore first is in red color, y is dependent variable and x is the independent variable, lag_x is the lag 1st of independent variable x. and c1 c2 c3 are control variables
    Code:
    ivreg2 y c1 c2 c3  i.year i.industry ( x= lag_x), gmm2s first
    est restore first
    outreg2 using myfile, cttop(first) replace
    est restore second
    outreg2 using myfile, cttop(second)
    seeout using "myfile.txt"
    Below is my actual codes which i want to outreg by using your commands
    Code:
    ivreg2 y c1 c2 c3  i.year i.industry (x = lag_x), gmm2s first
    ivreg2 y  c1 c2 c3  i.year i.industry (x= lag_x, gmm2s
    looking forward for your suggestions.

    Comment


    • #17
      # 16 above
      Last edited by Ayub UOM; 15 Oct 2019, 02:59.

      Comment


      • #18
        Try

        Code:
        ivreg2 y c1 c2 c3  i.year i.industry (x = lag_x), gmm2s first savefirst
        est restore _ivreg2_x
        outreg2 using "myfile", replace
        ivreg2 y  c1 c2 c3  i.year i.industry (x= lag_x), gmm2s
        outreg2 using "myfile", append
        Important: The first stage estimates are stored as "_ivreg2_var" where you replace "var" with the name of your endogenous variable (in the case above, it is "x"). If it is named differently, change accordingly.

        Comment


        • #19
          Andrew Musau thank you so much ,now it is working,its really a very nice.thanks once again
          Ayub

          Comment


          • #20
            I am new to stata. I use the state 13 version. My question related to post #13

            I used global to define control variables ($controls). sd3_roa1a is the dependent variable. Variable "soct_bev" is endogenous variable. Dialect_N Mingroup_N Minority are IV variables. yr* and bkt* are year dummies and industry dummies.

            I used following codes:

            ivregress2 2sls sd3_roa1a $controls yr* bkt* (soct_bev=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
            est restore first
            outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) replace
            est restore second
            outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second)

            ivregress 2sls sd3_roa1a $controls yr* bkt* (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
            est restore first
            outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
            est restore second
            outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append

            I got the output Table in MS Word. Columns 1 (first stage) and 2 (second stage) do not have a problem. The Columns 3 and 4 results are different in the Stata screen. But, the MS Word table gives the same output as columns 1 and 2. This is the incorrect output of the table

            I changed est restore in the 2nd blocks of code as est restore first1 and est restore second1. Then, I got an error message (estimates haven't stored).

            Please help. Thank you.
            Last edited by Pradeep Fonseka; 24 Feb 2021, 03:45.

            Comment


            • #21
              You should attempt to clear estimates after each estimation round as you are appending new estimates.

              Code:
              outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second)
              estimates clear
              ivregress 2sls sd3_roa1a $controls yr* bkt* (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
              If this does not work, provide a reproducible example.

              Comment


              • #22
                Thank you. It works for the above (#20) two sets of 2SLS regressions (attachment Result#22).

                If I want to make a MS Word Table of four sets of 2SLS regressions, It would not work. The dependent variables of the first two sets of 2SLS are sd3_roa1a and the dependent variables of the first two sets of 2SLS are sd5_roa1a

                ivregress2 2sls sd3_roa1a $controls yr* bkt* (soct_bev=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                est restore first
                outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) replace
                est restore second
                outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second)
                estimates clear
                ivregress2 2sls sd3_roa1a $controls yr* bkt* (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                est restore first
                outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                est restore second
                outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append
                estimates clear
                ivregress2 2sls sd5_roa1a $controls yr* bkt* (soct_bev=Dialect_N Mingroup_N Minority),first vce(cluster bankcode_n)
                est restore first
                outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) replace
                est restore second
                outreg2 using myfile1.doc.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second)
                estimates clear
                ivregress2 2sls sd5_roa1a $controls yr* bkt* (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                est restore first
                outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                est restore second
                outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append

                The above codes do not give a single Table with 8 columns. There were two- MS Word files resulted. But, there were wrong (#22a has 3 columns and #22b 1 columns). Is it a problem with "replace" and "append" usage? I am highly appreciated Andrew Musau or anyone's help!
                Attached Files

                Comment


                • #23
                  Without a reproducible example, there is not much that I can do. To increase your chances of getting a helpful reply, include a data example using dataex that reproduces the problem. Either your data or use one of Stata's datasets as was done in #1 of this thread. Also, 8 columns in an RTF file may not be practical. You may be able to pull it off in a LaTeX table.
                  Last edited by Andrew Musau; 24 Feb 2021, 11:26.

                  Comment


                  • #24
                    global controls AGE SIZE BKOWN CAP_ADQ3 insitute_effic GFC

                    ivregress2 2sls sd3_roa1a $controls (soct_bev=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                    est restore first
                    outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) replace
                    est restore second
                    outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second)
                    estimates clear
                    ivregress2 2sls sd3_roa1a $controls (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                    est restore first
                    outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                    est restore second
                    outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append
                    estimates clear
                    ivregress2 2sls sd5_roa1a $controls (soct_bev=Dialect_N Mingroup_N Minority),first vce(cluster bankcode_n)
                    est restore first
                    outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) replace
                    est restore second
                    outreg2 using myfile1.doc.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second)
                    estimates clear
                    ivregress2 2sls sd5_roa1a $controls (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                    est restore first
                    outreg2 using myfile1,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                    est restore second
                    outreg2 using myfile1.doc,tstat alpha(.10, .02, .002) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append

                    Code:
                    * Example generated by -dataex-. To install: ssc install dataex
                    clear
                    input long bankcode_n double(year sd3_roa1a sd5_roa1a) float AGE double BKOWN float CAP_ADQ3 double insitute_effic float GFC double(soct_bev soct_berv) byte(Dialect_N Mingroup_N) double Minority
                     1 2008  .0013788382198485956  .0013788382198485956  3.135494 1  .06222172 1 0 3.25 25 1 3 4.31
                     1 2009  .0010271216383689336  .0010271216383689336  3.178054 1  .05760975 1 0 3.25 25 1 3 4.31
                     1 2010  .0006970550119765839  .0012059687795255205  3.218876 1   .0610506 1 1 3.18 25 1 3 4.09
                     1 2011  .0012479350855277439  .0015079247330053024 3.2580965 1  .06188739 1 1 3.18 25 1 3 4.09
                     1 2012   .000697107943354997  .0011871626697970597  3.295837 1 .064328186 1 1 3.17 27 1 3 4.09
                     1 2013 .00022073510313930594   .001207765688211853 3.3322046 1  .06758007 1 1 3.17 27 1 3 4.09
                     1 2014   .000248924364440276  .0005945486285482678  3.367296 1  .07459037 1 1 3.17 27 1 3 4.09
                     1 2015  .0007077929346929115  .0005237554706997091 3.4011974 1  .08106875 1 1 3.17 27 1 3 4.09
                     1 2016  .0009211640289542774  .0009556310928822579  3.433987 1  .08207902 1 1 3.71 25 1 3 4.09
                     1 2017  .0007515202442324755  .0012093220079504694         . 1  .08207354 1 1 3.71 25 1 3 4.09
                     1 2018   .000399579281117943   .001090409619320918         . 1  .08465422 1 1 3.71 25 1 3 4.09
                     2 2008  .0006489360995680761  .0006489360995680761 3.0910425 1  .04142094 1 0 3.25 25 1 3 4.31
                     2 2009  .0005349708557513947  .0005349708557513947  3.135494 1  .03860643 1 0 3.25 25 1 3 4.31
                     2 2010  .0010706040177080743   .000887639127115408  3.178054 1  .05245378 1 1 3.18 25 1 3 4.09
                     2 2011  .0015724257628278555  .0013281254842171704  3.218876 1  .05564408 1 1 3.18 25 1 3 4.09
                     2 2012  .0009143992183318454  .0016984972929984543 3.2580965 1  .05673019 1 1 3.17 27 1 3 4.09
                     2 2013  .0004854615718491452  .0016495574425891744  3.295837 1  .05799554 1 1 3.17 27 1 3 4.09
                     2 2014 .00022992670245796574  .0008978243842092749 3.3322046 1 .064643115 1 1 3.17 27 1 3 4.09
                     2 2015  .0006783608261539567  .0005291074264253244  3.367296 1  .06811637 1 1 3.17 27 1 3 4.09
                     2 2016    .00092085334416307  .0008383698562980255 3.4011974 1 .067531265 1 1 3.71 25 1 3 4.09
                     2 2017  .0005162791172014669  .0010254949668760084  3.433987 1  .06789394 1 1 3.71 25 1 3 4.09
                     2 2018 .00022156097321141913  .0009281930306648318         . 1 .074074574 1 1 3.71 25 1 3 4.09
                     3 2008  .0006989582597612134  .0006989582597612134  3.218876 1 .071006715 1 0 3.25 25 1 3 4.31
                     3 2009  .0004974393127579914  .0004974393127579914 3.2580965 1  .06231691 1 0 3.25 25 1 3 4.31
                     3 2010   .000574106588147582  .0005264177588351443  3.295837 1 .064642325 1 1 3.18 25 1 3 4.09
                     3 2011  .0006347400901065485   .000648533478145318 3.3322046 1  .06389601 1 1 3.18 25 1 3 4.09
                     3 2012  .0005035984141731497  .0008791888707050151  3.367296 1  .06794166 1 1 3.17 27 1 3 4.09
                     3 2013 .00039595397118019637 .00081655383392058095 3.4011974 1  .06929914 1 1 3.17 27 1 3 4.09
                     3 2014 .00015499037878055537  .0005317900135395384  3.433987 1   .0775948 1 1 3.17 27 1 3 4.09
                     3 2015  .0006076474148548342  .0004654846105920355         . 1  .08073487 1 1 3.17 27 1 3 4.09
                     3 2016  .0007485567595694405  .0007089851524532079         . 1  .08193846 1 1 3.71 25 1 3 4.09
                     3 2017  .0005845392705767404  .0009739331215645906         . 1  .08099063 1 1 3.71 25 1 3 4.09
                     3 2018   .000548982638513453   .001006104421079075         . 1   .0811292 1 1 3.71 25 1 3 4.09
                     4 2008  .0012605268819498134  .0012605268819498134 1.3862944 1  .06188405 1 0 3.25 25 1 3 4.31
                     4 2009  .0009047110172939055  .0009047110172939055  1.609438 1  .05808993 1 0 3.25 25 1 3 4.31
                     4 2010  .0007447316863017719  .0009548798586174344 1.7917595 1  .06483667 1 1 3.18 25 1 3 4.09
                     4 2011  .0013473005462289725   .001289558081421044   1.94591 1  .06649341 1 1 3.18 25 1 3 4.09
                     4 2012   .000771234787571077   .001153987339431114 2.0794415 1  .06796112 1 1 3.17 27 1 3 4.09
                     4 2013 .00010627180621073333  .0012470687219067994 2.1972246 1  .06992868 1 1 3.17 27 1 3 4.09
                     4 2014  .0001868130549053324  .0006096413928567057 2.3025851 1  .07479415 1 1 3.17 27 1 3 4.09
                     4 2015    .00079739021017226   .000617167833076137  2.397895 1   .0787533 1 1 3.17 27 1 3 4.09
                     4 2016  .0012748205693483793  .0012327033086445788  2.484907 1  .07582887 1 1 3.71 25 1 3 4.09
                     4 2017   .000823830457152679  .0013909220246516244  2.564949 1  .08116958 1 1 3.71 25 1 3 4.09
                     4 2018                     .  .0011790198673339222 2.6390574 1  .08576068 1 1 3.71 25 1 3 4.09
                     5 2008  .0005915791465386024  .0005915791465386024 3.0445225 1  .05437944 1 0  3.4 29 1 1  .63
                     5 2009  .0007608782548068111  .0007608782548068111 3.0910425 1  .04968818 1 0  3.4 29 1 1  .63
                     5 2010  .0007597014493132941  .0006217472493933387  3.135494 1   .0565992 1 1 3.33 29 1 1  1.2
                     5 2011   .000950029443214343  .0007429190413608019  3.178054 1    .059158 1 1 3.33 29 1 1  1.2
                     5 2012  .0006598043597872159  .0008311860199829443  3.218876 1  .07233445 1 1 3.25 28 1 1  1.2
                     5 2013  .0003342088582104378  .0008198045061378563 3.2580965 1  .07070768 1 1 3.25 28 1 1  1.2
                     5 2014   .000336953702786569 .00047587955060072134  3.295837 1  .07555559 1 1 3.25 28 1 1  1.2
                     5 2015  .0006741161213380615  .0007006669980716571 3.3322046 1  .07520123 1 1 3.25 28 1 1  1.2
                     5 2016  .0012423498454600672  .0012127253032821756  3.367296 1  .07525818 1 1 3.66 21 1 1  1.2
                     5 2017   .000818673484442531  .0012890966671830475 3.4011974 1   .0748232 1 1 3.66 21 1 1  1.2
                     5 2018 .00014534223102803635  .0012055589188263455  3.433987 1  .07400014 1 1 3.66 21 1 1  1.2
                     6 2008  .0021324723099496947  .0021324723099496947 3.0445225 1   .0802686 1 0 3.25 25 1 3 4.31
                     6 2009   .001739776650289625   .001739776650289625 3.0910425 1  .06028514 1 0 3.25 25 1 3 4.31
                     6 2010  .0015674721438045612  .0015538194259793689  3.135494 1  .05983624 1 1 3.18 25 1 3 4.09
                     6 2011  .0015428738419985336  .0015308396670300263  3.178054 1 .064637996 1 1 3.18 25 1 3 4.09
                     6 2012 .00036349286991212674  .0012322742465726642  3.218876 1  .06861155 1 1 3.17 27 1 3 4.09
                     6 2013  .0002747267609466403   .001183885634068696 3.2580965 1  .06336522 1 1 3.17 27 1 3 4.09
                     6 2014 .00045330723609986065 .00043431652176836427  3.295837 1  .06459482 1 1 3.17 27 1 3 4.09
                     6 2015  .0014079417538677868  .0012046521357539765 3.3322046 1  .06241073 1 1 3.17 27 1 3 4.09
                     6 2016  .0015015844197526368  .0016729549756149167  3.367296 1  .06482764 1 1 3.71 25 1 3 4.09
                     6 2017   .000552311126692738  .0016552652627404715 3.4011974 1  .07264097 1 1 3.71 25 1 3 4.09
                     6 2018  .0002740305767049023  .0011680559726566248  3.433987 1  .07468392 1 1 3.71 25 1 3 4.09
                     7 2008  .0012527660305665612  .0012527660305665612  2.772589 1   .0390122 1 0 3.25 25 1 3 4.31
                     7 2009  .0011690707750465915  .0011690707750465915  2.833213 1  .04017835 1 0 3.25 25 1 3 4.31
                     7 2010   .001283835088948537  .0011716490739595866  2.890372 1  .05489584 1 1 3.18 25 1 3 4.09
                     7 2011   .002029770573287135  .0016226331816490435  2.944439 1  .05547055 1 1 3.18 25 1 3 4.09
                     7 2012   .001026489480370765  .0016587816222213888  2.995732 1  .05015674 1 1 3.17 27 1 3 4.09
                     7 2013  .0003939691224315441  .0019055593454471343 3.0445225 1  .06337331 1 1 3.17 27 1 3 4.09
                     7 2014  .0003680048143624869  .0009326408348462385 3.0910425 1  .06557631 1 1 3.17 27 1 3 4.09
                     7 2015  .0008951255652311467  .0006346106717706791  3.135494 1 .070728384 1 1 3.17 27 1 3 4.09
                     7 2016   .001513259205682365  .0013942300830235483  3.178054 1  .06245407 1 1 3.71 25 1 3 4.09
                     7 2017  .0009803445162352236  .0016009123969891609  3.218876 1  .07471082 1 1 3.71 25 1 3 4.09
                     7 2018 .00010190964165633255  .0013227022403399927 3.2580965 1  .07400698 1 1 3.71 25 1 3 4.09
                     8 2008  .0004595738059098695  .0004595738059098695  2.772589 0  .03747945 1 0 3.25 25 1 3 4.31
                     8 2009  .0004646895020874128  .0004646895020874128  2.833213 0 .035760783 1 0 3.25 25 1 3 4.31
                     8 2010  .0008382123254706992  .0009280603590306405  2.890372 0 .034123093 1 1 3.18 25 1 3 4.09
                     8 2011  .0014852808381196783  .0015349087457638259  2.944439 0  .05138494 1 1 3.18 25 1 3 4.09
                     8 2012  .0014246619364185868   .001897885814042564  2.995732 0  .05018781 1 1 3.17 27 1 3 4.09
                     8 2013  .0009426906087281084   .001993395958928695 3.0445225 0  .05143302 1 1 3.17 27 1 3 4.09
                     8 2014  .0005732269297787483  .0015997443198790934 3.0910425 0  .05514013 1 1 3.17 27 1 3 4.09
                     8 2015 .00024059510846154264  .0009181041567058888  3.135494 0   .0585904 1 1 3.17 27 1 3 4.09
                     8 2016  .0006994063456712245  .0005643493654202412  3.178054 0  .06492264 1 1 3.71 25 1 3 4.09
                     8 2017  .0007349520575766373  .0007472461966549212  3.218876 0  .06755796 1 1 3.71 25 1 3 4.09
                     8 2018  .0002931329490528474   .000858486860549426 3.2580965 0  .08159242 1 1 3.71 25 1 3 4.09
                     9 2008  .0004232344133074848  .0004232344133074848  2.484907 0  .05185375 1 0 3.25 25 1 3 4.31
                     9 2009  .0008089285380020792  .0008089285380020792  2.564949 0  .06232088 1 0 3.25 25 1 3 4.31
                     9 2010   .001107944020731539  .0012311690553488336 2.6390574 0  .05771501 1 1 3.18 25 1 3 4.09
                     9 2011   .002201590333895278  .0023249420411234154   2.70805 0  .06016427 1 1 3.18 25 1 3 4.09
                     9 2012  .0015826784895920745  .0022359722017471816  2.772589 0  .05247321 1 1 3.17 27 1 3 4.09
                     9 2013  .0007463781160650889  .0020892599357807628  2.833213 0  .06332105 1 1 3.17 27 1 3 4.09
                     9 2014  .0010664390845460023  .0014285145249907955  2.890372 0  .06170551 1 1 3.17 27 1 3 4.09
                     9 2015   .001541382104499782  .0011792253226452437  2.944439 0 .068525635 1 1 3.17 27 1 3 4.09
                     9 2016  .0015751205962891022  .0019093560119410435  2.995732 0  .05970732 1 1 3.71 25 1 3 4.09
                     9 2017  .0011402732294078161  .0021010621288900413 3.0445225 0  .06604648 1 1 3.71 25 1 3 4.09
                     9 2018 .00018009426251313363   .001385206206452322 3.0910425 0  .07189555 1 1 3.71 25 1 3 4.09
                    10 2008  .0006290617881707212  .0006290617881707212   2.70805 0  .05134081 1 0 3.32 27 3 1  .86
                    end
                    label values bankcode_n bankcode_n
                    label def bankcode_n 1 "B0001", modify
                    label def bankcode_n 2 "B0002", modify
                    label def bankcode_n 3 "B0003", modify
                    label def bankcode_n 4 "B0004", modify
                    label def bankcode_n 5 "B0005", modify
                    label def bankcode_n 6 "B0006", modify
                    label def bankcode_n 7 "B0007", modify
                    label def bankcode_n 8 "B0008", modify
                    label def bankcode_n 9 "B0009", modify
                    label def bankcode_n 10 "B0010", modify

                    Comment


                    • #25
                      Your data example does not have the variable "SIZE", so the first error message that I get is

                      . ivregress2 2sls sd3_roa1a $controls (soct_bev=Dialect_N Mingroup_N Minority),
                      > first vce(cluster bankcode_n)
                      variable SIZE not found
                      r(111);
                      If I drop this variable and run the code, I get

                      Code:
                      . ivregress2 2sls sd3_roa1a $controls (soct_bev=Dialect_N Mingroup_N Minority),
                      > first vce(cluster bankcode_n)
                      note: insitute_effic dropped because of collinearity
                      
                      First-stage regressions
                      -----------------------
                                 _iv_vce_wrk():  3001  expected 21 arguments but received 20
                                       <istmt>:     -  function returned error
                      r(3001);

                      Simplify the codes or data and present something that runs. Make sure that you test your codes on the example data and that it replicates your problem.
                      Last edited by Andrew Musau; 25 Feb 2021, 05:57.

                      Comment


                      • #26
                        Thank you for your help. I use original data and run following code:
                        ivregress2 2sls sd3_roa1a $controls yr* bkt* (soct_bev=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                        est restore first
                        outreg2 using myfile1,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                        est restore second
                        outreg2 using myfile1.doc,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second)append
                        estimates clear
                        ivregress2 2sls sd3_roa1a $controls yr* bkt* (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                        est restore first
                        outreg2 using myfile2,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                        est restore second
                        outreg2 using myfile2.doc,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append
                        estimates clear
                        ivregress2 2sls sd5_roa1a $controls yr* bkt* (soct_bev=Dialect_N Mingroup_N Minority),first vce(cluster bankcode_n)
                        est restore first
                        outreg2 using myfile3,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                        est restore second
                        outreg2 using myfile3.doc.doc,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append
                        estimates clear
                        ivregress2 2sls sd5_roa1a $controls yr* bkt* (soct_berv=Dialect_N Mingroup_N Minority), first vce(cluster bankcode_n)
                        est restore first
                        outreg2 using myfile4,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(first) append
                        est restore second
                        outreg2 using myfile4.doc,tstat e(chi2) nonotes addnote(t-statistics in parentheses, one-sided t-statistics, *p<.10; **p<.05; ***p<.01) cttop(second) append

                        It gives the output without a big problem. (four files). Thank you Andrew Musau!
                        Last edited by Pradeep Fonseka; 25 Feb 2021, 10:15.

                        Comment


                        • #27
                          Originally posted by Andrew Musau View Post
                          #1 through #7 illustrates that you cannot output xtivreg2 first stage results using outreg2. So you have 2 options

                          1. Install ivregress2 from SSC and follow the instructions in this thread, or
                          2. Keeping with xtivreg2, use esttab

                          Code:
                          eststo clear
                          *IV WITH FIRST STAGE
                          eststo: xi: xtivreg2 ln_L (ln_exp_value = wlngdpdest_lcu03) i.year, fe i(region_industry) cluster(region_industry) first savefirst savefprefix(st1)
                          esttab est1 st1* using myfile.xls, replace
                          I cannot use ivregress2 for the large sample (it seems it takes me very long time to run the "ivregress Y X"-like code), and only xtreg-like code works for me, but I got the ERROR "estimation result st1* not found" when using solution 2. Could you give me some suggestions?

                          Comment


                          • #28
                            What estimator are you using? Can you post the exact command line that you ran?

                            Comment


                            • #29
                              Originally posted by Andrew Musau View Post
                              Thanks for the data example. Two points

                              1. You cannot use ivregress. From #6: First

                              Code:
                              ssc install ivregress2
                              2. -append- for subsequent regressions, do not -replace-

                              Code:
                              ivregress2 2sls Y Control_1 Control_2 Control_3 Control_4 Control_5 Control_6 Control_7 Control_8 Control_9 Control_10 (X1 = Instrument_1 Instrument_2), first
                              est restore first
                              outreg2 using myfile, cttop(first) replace
                              est restore second
                              outreg2 using myfile, cttop(second)
                              
                              ivregress2 2sls Y Control_1 Control_2 Control_3 Control_4 Control_5 Control_6 Control_7 Control_8 Control_9 Control_10 (X2 = Instrument_1 Instrument_2), first
                              est restore first
                              outreg2 using myfile, cttop(first) append
                              est restore second
                              outreg2 using myfile, cttop(second) append
                              What if you get the following error? What's the reason for that? The problem appears only when you use robust or clustering as an option.

                              First-stage regressions
                              -----------------------
                              _iv_vce_wrk(): 3001 expected 21 arguments but received 20
                              <istmt>: - function returned error
                              Last edited by Pantelis Kazakis; 23 Feb 2023, 06:58.

                              Comment


                              • #30
                                Is it a problem with ivregress2 or can you replicate the problem with ivregress? If the former, I would recommend that you estimate the model with ivreg2 instead. If it is the latter, then the issue is with your data and/or model.

                                Code:
                                sysuse auto, clear
                                ivreg2 price i.rep78 (foreign = weight turn trunk), first savefirst
                                est restore _ivreg2_foreign
                                outreg2 using "ivreg2-12", replace
                                ivreg2 price i.rep78 (foreign = weight turn trunk)
                                outreg2 using "ivreg2-12", append

                                Comment

                                Working...
                                X