Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72862

Help setting up csdid command for staggered DiD analysis

$
0
0
Hi everyone,

I’m working on a staggered DID analysis using csdid in Stata and would appreciate your guidance on properly setting it up. Here’s an overview of my data structure:
  • Name: Name of the firm
  • Firm_ID: Unique identifier for each firm
  • Quarter and Fiscal: Respective quarter and fiscal year of the observation
  • Executive_ID: Unique identifier for each CEO
  • The key variable of interest (IV) is a continuous variable reflecting the intensity of a specific CEO trait in a given year.
  • IV_median represents the median value of IV for a CEO over their tenure at the firm.
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str28 Name double Firm_ID int(Quarter Fiscal) long Executive_ID float(IV IV_Median first_treat firm_treated)
"HELMERICH & PAYNE" 4295903159 200 2010   462  -3.164684  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 201 2010   462  -3.164684  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 202 2010   462  -3.164684  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 203 2010   462  -3.164684  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 204 2011   462  -2.588814  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 205 2011   462  -2.588814  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 206 2011   462  -2.588814  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 207 2011   462  -2.588814  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 208 2012   462  -.7764673  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 209 2012   462  -.7764673  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 210 2012   462  -.7764673  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 211 2012   462  -.7764673  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 212 2013   462  -.7110742  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 213 2013   462  -.7110742  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 214 2013   462  -.7110742  -2.588814    0 1
"HELMERICH & PAYNE" 4295903159 221 2015 30738  -2.413877 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 222 2015 30738  -2.413877 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 223 2015 30738  -2.413877 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 224 2016 30738 -2.2883344 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 225 2016 30738 -2.2883344 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 226 2016 30738 -2.2883344 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 227 2016 30738 -2.2883344 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 228 2017 30738 -2.1911614 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 229 2017 30738 -2.1911614 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 230 2017 30738 -2.1911614 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 231 2017 30738 -2.1911614 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 232 2018 30738 -1.2001128 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 233 2018 30738 -1.2001128 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 234 2018 30738 -1.2001128 -2.1911614 2015 1
"HELMERICH & PAYNE" 4295903159 235 2018 30738 -1.2001128 -2.1911614 2015 1
"INTL PAPER CO"     4295903177 208 2012 23217   3.271951   3.271951    0 0
"INTL PAPER CO"     4295903177 209 2012 23217   3.271951   3.271951    0 0
"INTL PAPER CO"     4295903177 210 2012 23217   3.271951   3.271951    0 0
"INTL PAPER CO"     4295903177 211 2012 23217   3.271951   3.271951    0 0
"INTL PAPER CO"     4295903177 212 2013 23217   3.417064   3.271951    0 0
"INTL PAPER CO"     4295903177 213 2013 23217   3.417064   3.271951    0 0
"INTL PAPER CO"     4295903177 214 2013 23217   3.417064   3.271951    0 0
"INTL PAPER CO"     4295903177 215 2013 23217   3.417064   3.271951    0 0
"INTL PAPER CO"     4295903177 216 2014 23217 -.26951206   3.271951    0 0
"INTL PAPER CO"     4295903177 217 2014 23217 -.26951206   3.271951    0 0
"INTL PAPER CO"     4295903177 224 2016 42529  2.1238246  2.1238246    0 0
"INTL PAPER CO"     4295903177 225 2016 42529  2.1238246  2.1238246    0 0
"INTL PAPER CO"     4295903177 226 2016 42529  2.1238246  2.1238246    0 0
"INTL PAPER CO"     4295903177 227 2016 42529  2.1238246  2.1238246    0 0
"INTL PAPER CO"     4295903177 228 2017 42529  2.3703244  2.1238246    0 0
"INTL PAPER CO"     4295903177 229 2017 42529  2.3703244  2.1238246    0 0
"INTL PAPER CO"     4295903177 230 2017 42529  2.3703244  2.1238246    0 0
"INTL PAPER CO"     4295903177 231 2017 42529  2.3703244  2.1238246    0 0
"INTL PAPER CO"     4295903177 232 2018 42529  1.0787958  2.1238246    0 0
"INTL PAPER CO"     4295903177 233 2018 42529  1.0787958  2.1238246    0 0
"INTL PAPER CO"     4295903177 234 2018 42529  1.0787958  2.1238246    0 0
"INTL PAPER CO"     4295903177 235 2018 42529  1.0787958  2.1238246    0 0
end
format %tq Quarter
Data Description:

My sample consists only of firms that experienced exactly one CEO change during the sample period. This means there are no firms without a CEO change or with more than one CEO change included. Objective:

I’m using a staggered DID model to examine the effect on Y when a firm replaces its CEO with one who has a higher IV_median. In other words, I want to analyze how my dependent variable is affected when a firm replaces its CEO with someone who scores higher on this specific CEO trait.

After researching, I found that csdid addresses some shortcomings of the standard DiD model, particularly in cases where the timing of treatment (the CEO change) differs across firms. Steps So Far:

  1. I created a variable to indicate treatment and control groups:
    • firm_treated takes the value 1 for firms where the new CEO’s IV_median is higher than that of the outgoing CEO, and 0 otherwise.
  2. The next step is to create the gvar variable, which represents the timing of the first treatment (first_treat). This variable captures the first year when the new CEO with a higher IV_median takes over and continues for the remainder of their tenure. If the CEO change does not result in a higher IV_median, it remains 0.
Code:

Here’s the code I ran:
Code:
 
 csdid DV IV_median, ivar(Firm_ID) time(Quarter) gvar(first_treat)
The code executes without errors, but the output shows many omitted coefficients, and I’m not sure why.

As the output is fairly extensive, I will post it upon request.

After running the above code line, -estat all resulted in:

Code:
. estat all
Pretrend Test. H0 All Pre-treatment are equal to 0
chi2(104) =  4.045e+09
p-value  =     0.0000
Average Treatment Effect on Treated
------------------------------------------------------------------------------
             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
         ATT |          0  (omitted)
------------------------------------------------------------------------------
ATT by group
------------------------------------------------------------------------------
             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
    GAverage |          0  (omitted)
------------------------------------------------------------------------------
conformability error
r(503);
I would greatly appreciated your suggestions on what could be causing the omitted coefficients, and how can I properly set up csdid to avoid this issue?

Thanks in advance for your help!







Viewing all articles
Browse latest Browse all 72862

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>