Announcement

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

  • Nesting several lags in one (neat) table using estout/outreg/etc.

    Hello everyone,

    With code of the following type:
    eststo: xtlogit impairment ROE log_TA bshare opexp_prem int_rate output_gap growth_prem if type=="LH"| type=="M", iterate(50)
    eststo: xtlogit impairment L.ROE L.log_TA L.bshare L.opexp_prem L.int_rate L.output_gap L.growth_prem if type=="LH"| type=="M", iterate(50)
    eststo: xtlogit impairment L2.ROE L2.log_TA L2.bshare L2.opexp_prem L2.int_rate L2.output_gap L2.growth_prem if type=="LH"| type=="M", iterate(50)
    eststo: xtlogit impairment L3.ROE L3.log_TA L3.bshare L3.opexp_prem L3.int_rate L3.output_gap L3.growth_prem if type=="LH"| type=="M", iterate(50)
    eststo: xtlogit impairment L4.ROE L4.log_TA L4.bshare L4.opexp_prem L4.int_rate L4.output_gap L4.growth_prem if type=="LH"| type=="M", iterate(50)
    esttab using LH_regs1_roe.csv, pr2 replace
    I of course get a sort of checkerboard table which, at the top, reports the coefficients of X1, X2, etc; followed by the coefficients for L.X1, L.X2, etc; followed by the coefficients for L2.X1, L2.X2, etc.

    In other words, each lag is treated as a distinct variable, logically enough.

    Is there any way (without the manual work) to have my coefficients for the 1st lag in column 1, then the 2nd lag in column 2, etc?

    Please let me know if this isn't clear enough. And thank you so much for your help.

    John

  • #2
    John,

    I mostly use estout. From what I understand you want to do, you need to use the rename option. You would want to do something like...
    Code:
    rename(L.X1 X1 L.X2 X2)
    That should make it so the coefficients in the subsequent columns line up with the original, non-lagged variable but represent the correspondent lags.

    Best,
    Lance

    Comment


    • #3
      Lance,

      Thanks so much for your answer. I tried your command using the syntax

      Code:
      rename (old1 old2 ...) (new1 new2 ...) [, options1]
      But I got the error:

      Code:
      Syntax is rename oldname newname
          You used . in oldname, not newname.  . is used in newname to indicate that the corresponding wildcard in oldname
          be skipped.  E.g., "rename a*b* a.b*" removes what is between a and b; variable ausbvalue would be renamed
          abvalue.
      For what it's worth, I do not generate these variables beforehand; I simply use the L. lag notation.

      I was also curious if you used preserve/restore for each regression to avoid mixing the lag with the original.

      Thanks in advance for any advice.

      John

      Comment


      • #4
        John,

        It seems that you’re using the rename command but you need to use the rename option that is part of the estout command...the syntax is different so you should double check the help file for estout. I don’t have access to Stata at the moment but I think the syntax is something like,
        Code:
        estout, rename(old1 new1 [old2 new2 ...])
        So, the syntax you’re reporting isn’t right and there’s no need to preserve/restore the data. It also doesn’t matter that you’re using the L. lag notation...you just need to make sure that the name that appears in the Stata output is the the name that you use in the rename option.

        Lance

        Comment


        • #5
          Awesome, this works perfectly! There is probably a neater way to do this for ~6 variables and 4 lags besides renaming each one, but even then, this is fine. Thanks a ton for the help!

          Comment

          Working...
          X