Announcement

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

  • Panel regression conditional on specific values of a regressor

    Dear all,

    I have a strongly panel data

    xtset id year

    I want to run the regression of y on x and z, conditional on z being greater than a known value, say z>k and I want to see the slope coefficient on z below and above k under two separate cases

    a) the slope coefficient on x does not change before and after k.
    b) the slope coefficient on x changes before and after k.

    Is there a way of doing that?

    Thank you very much in advance!

  • #2
    I'm not sure I fully understand what you are asking for. But maybe it's this:
    Code:
    // a)
    gen byte z_gt_k = (z > k) if !missing(z)
    regress y x c.z##i.z_gt_k
    lincom z // z COEFFICIENT WHEN z <= k
    lincom z + 1.z_gt_k // z COEFFICIENT WHEN z > k
    
    // b)
    regress y (i.z_gt_k)##c.(x z)
    lincom z // z COEFFICIENT WHEN z <= k
    lincom z + 1.z_gt_k#c.z // z COEFFICIENT WHEN z > k
    lincom x // x COEFFICIENT WHEN z <= k
    lincom x + 1.z_gt_k#c.x // x COEFFICIENT WHEN z > k

    Comment


    • #3
      Yes and thank you very much. Is there any relevant econometric theory behind this code where I can have a look at?
      Does this code implement a particular econometric model that I should be aware of?

      Many many thanks!

      Comment


      • #4
        I'm not aware of any citable theory or model class that applies to this. It's just routine use of interactions. But I'm not an econometrician, so perhaps in that field these exist without my being aware of them.

        Comment


        • #5
          thank you. One final question, I am trying to interpret

          c.z##i.z_gt_k and (i.ESG_gt_k)##c.(Cap ESG)


          What do these terms do? Thank you again

          Comment


          • #6
            Those are factor variable notation, which you should read about: -help fvvarlist-.

            c.z##i.z_gt_k, for example, expands to c.z, i.z_gt_k, and c.z#i.z_gt_k. In other words, it expands to the interaction between continuous variable z and discrete variable z_gt_k, as well as the two variables separately as "main" effects.

            Comment


            • #7
              thank you!

              Comment

              Working...
              X