Announcement

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

  • Choosing a baseline and examining when the effect occurs

    Dear Statalist experts,

    I would like to post a question. Below is a part of my panel data (xtset firm_id month). There is an intervention happening in month 4, which affects UK firms. So I have "treated" = 1 for UK firms, and = 0 for non-EU firms. My goal to test the effect of this intervention on the variable "esg", specifically pinpointing when the effect began for treated firms. So I want to pick month 4 as baseline, and aim to observe the effect in each month (instead of just creating a dummy time variable = 1 for post-intervention and 0 for pre-intervention). I also include country and time fixed-effects.

    Could you please help me with the relevant codes? I have tried several codes but not sure which one is correct. I understand that I can create dummy variables for each month, but that would make the interactions complex (e.g., month_dummy*treated).

    Also, what is the difference if I use xtset and reghdfe?

    I am hoping for your assistance. Thank you very much.

    Code:
    input str10 firm_id byte month str14 country float esg byte treated
    "FS00008NOQ" 1 "Germany"        22.29 0
    "FS00008NOQ" 2 "Germany"        22.36 0
    "FS00008NOQ" 3 "Germany"        22.55 0
    "FS00008NOQ" 4 "Germany"        22.58 0
    "FS00008NOQ" 5 "Germany"        22.54 0
    "FS00008NOQ" 6 "Germany"        22.77 0
    "FS00008NOQ" 7 "Germany"        23.16 0
    "FS00008WGQ" 1 "Germany"        20.03 0
    "FS00008WGQ" 2 "Germany"         19.9 0
    "FS00008WGQ" 3 "Germany"        20.84 0
    "FS00008WGQ" 4 "Germany"        20.75 0
    "FS00008WGQ" 5 "Germany"        20.77 0
    "FS00008WGQ" 6 "Germany"        20.78 0
    "FS00008WGQ" 7 "Germany"        19.38 0
    "FS00008N1D" 1 "Austria"        22.94 0
    "FS00008N1D" 2 "Austria"        22.66 0
    "FS00008N1D" 3 "Austria"        23.38 0
    "FS00008N1D" 4 "Austria"        23.34 0
    "FS00008N1D" 5 "Austria"        23.24 0
    "FS00008N1D" 6 "Austria"        23.08 0
    "FS00008N1D" 7 "Austria"        22.92 0
    "FS00008LRJ" 3 "France"         25.22 0
    "FS00008LRJ" 4 "France"         24.98 0
    "FS00008LRJ" 5 "France"          24.5 0
    "FS00008LRJ" 6 "France"         24.74 0
    "FS00008LRJ" 7 "France"         25.56 0
    "FS0000DCP4" 1 "Italy"          23.85 0
    "FS0000DCP4" 2 "Italy"          23.74 0
    "FS0000DCP4" 3 "Italy"          24.83 0
    "FS0000DCP4" 4 "Italy"          24.78 0
    "FS0000DCP4" 5 "Italy"          24.86 0
    "FS0000DCP4" 6 "Italy"          24.57 0
    "FS0000DCP4" 7 "Italy"          24.24 0
    "FS00009EMM" 1 "Spain"          23.57 0
    "FS00009EMM" 2 "Spain"          23.46 0
    "FS00009EMM" 3 "Spain"          24.57 0
    "FS00009EMM" 4 "Spain"          24.55 0
    "FS00009EMM" 5 "Spain"          24.56 0
    "FS00009EMM" 6 "Spain"          24.34 0
    "FS00009EMM" 7 "Spain"          24.52 0
    "FSGBR05750" 1 "United Kingdom" 23.83 1
    "FSGBR05750" 2 "United Kingdom"  23.8 1
    "FSGBR05750" 3 "United Kingdom" 23.93 1
    "FSGBR05750" 4 "United Kingdom" 23.55 1
    "FSGBR05750" 5 "United Kingdom" 23.48 1
    "FSGBR05750" 6 "United Kingdom" 23.33 1
    "FSGBR05750" 7 "United Kingdom" 22.34 1
    "FS0000BPTE" 1 "United Kingdom" 23.86 1
    "FS0000BPTE" 2 "United Kingdom" 23.44 1
    "FS0000BPTE" 3 "United Kingdom" 24.26 1
    "FS0000BPTE" 4 "United Kingdom" 24.12 1
    "FS0000BPTE" 5 "United Kingdom" 24.18 1
    "FS0000BPTE" 6 "United Kingdom"  23.9 1
    "FS0000BPTE" 7 "United Kingdom" 23.52 1
    "FS0000EG0J" 1 "United Kingdom" 23.84 1
    "FS0000EG0J" 2 "United Kingdom" 23.76 1
    "FS0000EG0J" 3 "United Kingdom" 24.29 1
    "FS0000EG0J" 4 "United Kingdom" 24.32 1
    "FS0000EG0J" 5 "United Kingdom" 24.16 1
    "FS0000EG0J" 6 "United Kingdom" 23.84 1
    "FS0000EG0J" 7 "United Kingdom" 23.59 1
    "FS0000CLMN" 1 "United Kingdom" 24.41 1
    "FS0000CHAG" 1 "United Kingdom" 25.94 1
    "FS0000CHAG" 2 "United Kingdom" 25.75 1
    "FS0000CHAG" 3 "United Kingdom" 26.33 1
    "FS0000CHAG" 4 "United Kingdom" 26.42 1
    "FS0000CHAG" 5 "United Kingdom" 26.29 1
    "FS0000CHAG" 6 "United Kingdom" 26.16 1
    "FS0000CHAG" 7 "United Kingdom" 26.19 1
    "FSGBR059ON" 1 "United Kingdom" 25.13 1
    "FSGBR059ON" 2 "United Kingdom" 25.03 1
    "FSGBR059ON" 3 "United Kingdom" 25.93 1
    "FSGBR059ON" 4 "United Kingdom" 25.83 1
    "FSGBR059ON" 5 "United Kingdom" 25.74 1
    "FSGBR059ON" 6 "United Kingdom" 25.51 1
    "FSGBR059ON" 7 "United Kingdom" 25.28 1
    "FS0000FHDL" 1 "United Kingdom" 29.95 1
    "FS0000FHDL" 2 "United Kingdom" 29.84 1
    "FS0000FHDL" 3 "United Kingdom" 30.32 1
    "FS0000FHDL" 4 "United Kingdom" 30.62 1
    "FS0000FHDL" 5 "United Kingdom"  30.6 1
    "FS0000FHDL" 6 "United Kingdom" 30.45 1
    "FS0000FHDL" 7 "United Kingdom"  30.6 1
    "FSUSA0A8KV" 1 "United Kingdom" 28.84 1
    "FSUSA0A8KV" 2 "United Kingdom" 28.83 1
    "FSUSA0A8KV" 3 "United Kingdom" 29.58 1
    "FSUSA0A8KV" 4 "United Kingdom" 29.78 1
    "FSUSA0A8KV" 5 "United Kingdom" 29.74 1
    "FSUSA0A8KV" 6 "United Kingdom"  29.4 1
    "FSUSA0A8KV" 7 "United Kingdom" 29.94 1

  • #2
    Code:
    g post = month>4
    reghdfe esg c.treated#c.post#b4.month , absorb(firm_id month)

    Comment


    • #3
      Originally posted by George Ford View Post
      Code:
      g post = month>4
      reghdfe esg c.treated#c.post#b4.month , absorb(firm_id month)
      Thank you for your reply.

      When I ran the code, the first 4 months were omitted. Is this how it works? How can I find the effect before the intervention? Because the firms might know and react to the intervention before it happened. I would appreciate if you could help me further with this matter, please.

      Click image for larger version

Name:	Screenshot 2024-02-21 233311.png
Views:	1
Size:	49.9 KB
ID:	1744111

      Comment


      • #4
        Yes. You said you aren't interested in the pre period coefficients.

        Comment


        • #5
          Originally posted by George Ford View Post
          Yes. You said you aren't interested in the pre period coefficients.
          Could you please guide me on how to examine the coefficients of pre-period time as well? Because there might happen that the firms are aware of the intervention before it took effect, so they might react in advance. In general, can I observe the coefficients for all 7 months?
          Thank you very much for your support. I am quite struggling with this issue.

          Comment


          • #6
            Code:
             
             reghdfe esg c.treated#b1.month , absorb(firm_id month)

            Comment


            • #7
              Originally posted by George Ford View Post
              Code:
              reghdfe esg c.treated#b1.month , absorb(firm_id month)
              Thank you very much for your assistance. May I clarify this a bit further? As I expect that the coefficients of other months would be relative to month 4 (e.g., pre month 4 esg's maybe expected to have negative coefficients and post would have positive coefficients), I aim to omit month 4 from the result. How should I modify the codes?

              Comment


              • #8
                This sets 4 as the base

                Code:
                reghdfe esg c.treated#b4.month , absorb(firm_id month)
                Not much reason to exclude month 4 since you have monthly fixed effects. But to do so,
                Code:
                 reghdfe esg c.treated#b1.month if month!=4, absorb(firm_id month)
                Not that the coefficients are differences from the base (here month 1). For you, I think this makes the most sense:
                Code:
                 reghdfe esg c.treated#b4.month , absorb(firm_id month)

                Comment


                • #9
                  Thank you soooo much for your patience to help me with this matter. I have learned a lot from the codes. Your support is invaluable.

                  Comment

                  Working...
                  X