Announcement

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

  • what does this code mean?

    Dear All, I found this code (from a paper)
    Code:
    xi: reg dly lly llk lldebts dlk dldebts ///
        i.nwbcode|dlyT i.nwbcode|llyT i.nwbcode|llkT i.nwbcode|lldebtsT i.nwbcode|dlkT i.nwbcode|dldebtsT i.nwbcode, vce(bootstrap)
    I wonder if anyone can tell me what does the second line mean? Thanks.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    From the help for xi:


    i.varname1|varname3 creates dummies for categorical variable varname1 and continuous variable varname3:
    all interactions and main effect of varname3, but no main effect of varname1
    Note the difference between the following:

    Code:
    webuse grunfeld
    xi: reg invest i.year|kstock
    xi: reg invest i.year*kstock

    Comment


    • #3
      Scott is correct. For what it's worth, you would probably be better off abandoning the -xi:- prefix and recasting the regression command in terms of factor variable notation. Which would be:

      Code:
      reg dly lly llk lldebts dlk dldebts i.nwbcode## c.(dlyT llyT llkT lldebtsT dlkT dldebtsT), vce(bootstrap)
      (Yes, this code, which uses the ## does generate indicators for nwbcode, but the original equation contains a separate i.nwbcode term, so the distinction between | and * in -xi- that Scott correctly points out is neutralized anyway here.)

      Comment


      • #4
        Hi, Scott: Thanks for your explanation.
        Ho-Chuan (River) Huang
        Stata 17.0, MP(4)

        Comment


        • #5
          Hi, Clyde, Thanks for the suggestion. I will try it out.

          Ho-Chuan (River) Huang
          Stata 17.0, MP(4)

          Comment

          Working...
          X