Announcement

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

  • Export IVLASSO regression result to latex

    Hello!

    I'm using stata to do IV with LASSO selected instruments. I use the following code to run the regression:

    ivlasso cm ( i.edu i.region urban cost i.hc1 i.hc2 i.hc3 food_cons nfood_cons) (ir_part_any = dr5-drt25 dr_1015-dr2_0614 any_shock1014 all_shock1014 most_shock1014 any_shock0614 all_shock0614 most_shock0614 dr2_0612 any_shock0612 all_shock0612 most_shock0612) if female==1 & cost>0 & age>=18, cluster(id_geo_ex) first idstats

    where cm is the outcome variable and ir_part_any is the endogenous variable.

    Can anyone tell me how to export the result of this regression to latex? Thanks a lot!

    Best,
    Jiajing

  • #2
    I assume you are using the -ivlasso- command from SSC. The -esttab- command can export results to LaTeX--and ivlasso appears to be set up with a nice e(b) and e(V) matrix that will work well for esttab.

    Code:
    ssc install estout
    sysuse auto, clear
    ivlasso weight foreign (price)
    esttab //just to see what the table will look like
    esttab using myfile.tex, tex
    Note that -esttab- has many, many options to format the output nicely. See its webpage at http://repec.org/bocode/e/estout/esttab.html for details.

    Comment


    • #3
      Originally posted by Kye Lippold View Post
      I assume you are using the -ivlasso- command from SSC. The -esttab- command can export results to LaTeX--and ivlasso appears to be set up with a nice e(b) and e(V) matrix that will work well for esttab.

      Code:
      ssc install estout
      sysuse auto, clear
      ivlasso weight foreign (price)
      esttab //just to see what the table will look like
      esttab using myfile.tex, tex
      Note that -esttab- has many, many options to format the output nicely. See its webpage at http://repec.org/bocode/e/estout/esttab.html for details.
      Thank you Kye! It worked. Do you know how to export only the first stage result from command ivlasso? I read the help file but couldn't find an answer...Thanks!

      Comment


      • #4
        I'm not familiar with the ivlasso command, so this took a little digging. But it appears that while -ivlasso- does not post the first stage results to be readable by -ereturn-, it does keep the first stage results around under the estimation set named _ivlasso_[endogenous variable name]. So this approach works:
        Code:
        estimates clear
        sysuse auto, clear
        ivlasso weight gear (foreign = price mpg trunk turn), first 
        est dir //note ivlasso saves estimation results for the first stage
        esttab _ivlasso_foreign //this is the first stage
        esttab _ivlasso_foreign using myfile.tex, tex

        Comment


        • #5
          Originally posted by Kye Lippold View Post
          I'm not familiar with the ivlasso command, so this took a little digging. But it appears that while -ivlasso- does not post the first stage results to be readable by -ereturn-, it does keep the first stage results around under the estimation set named _ivlasso_[endogenous variable name]. So this approach works:
          Code:
          estimates clear
          sysuse auto, clear
          ivlasso weight gear (foreign = price mpg trunk turn), first
          est dir //note ivlasso saves estimation results for the first stage
          esttab _ivlasso_foreign //this is the first stage
          esttab _ivlasso_foreign using myfile.tex, tex
          Thank you so much Kye! It worked

          Comment

          Working...
          X