Announcement

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

  • Xthdidregress - estat atetplot doesn't display the ATET pre-treatment

    Hi,

    I'm using xthdidiregress twfe in Stata18 for a staggered diff in diff. I want to visualize the results and they're supposed to look something like this (different example from the Stata manual):

    Click image for larger version

Name:	Immagine 2025-04-09 094523.png
Views:	1
Size:	41.9 KB
ID:	1775616




    But instead, my results only have the right hand part, the posttreatment, and lack any information in the pretreatment part (sorry for not showing it, but I can't manage to upload the picture).

    I guess there needs to be something wrong with the control group?
    Here's what I run:

    xthdidregress twfe (growth log_population log_rainfall dist_primalcity log_lights1992) (treated), group(identifier) controlgroup(notyet)
    estat atetplot

    The dataset is in a panel form (each observation is a unit-year). The "treated" variable is equal to one for treated units starting from the year of the treatment. The first threshold is 2001 and I only have data from 2000, so that could be an issue; the other thresholds are like 2004 2008 2014 and so on, and the dataset is up to 2020. When running the model, Stata says that the never treated and the not yet treated groups are identical (maybe this is relevant?).

    Here is some context: it is a regression of growth in cities next to country borders vs cities in the core, after a policy is implemented. The "treated" variable is equal to one only for cities that are along those borders where the policy occurs, at the years when it occurs; I don't distinguish cities along the border and in the core in any other way in the regression (I don't know if this is relevant).

    The rest of the results look sensible: I have significant effects in certain years and not significant in others; Stata says that the panel is balanced and the estat ptrends test says Prob>F = 0.0000 (how do I interpret this, by the way?)

    Do you have any idea why the plot doesn't show anything in the pretreatment? Does the setup look obviously wrong for some reason?

    Thank you very much

  • #2
    The two-way fixed effects estimator (TWFE) does not estimate coefficients for the pre-treatment periods. The estat atetplot command only works with output from hdidregress or xthdidregress. If you want a graph that includes pre-treatment coefficients, use one of the other estimators: regression adjustment (RA), inverse-probability weighting (IPW), or augmented inverse-probability weighting (AIPW). Below, e.g., using -ra- I get:

    Code:
    webuse akc, clear
    xtset breed year
    xthdidregress ra (registered best) (movie), group(breed)
    estat atetplot
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	37.0 KB
ID:	1775624

    Comment


    • #3
      Alternatively, if you want something like TWFE you can use JWDID, which allows you to estimate pre-treatment ATT IF you have never treated units (and you use the option -never-)

      Comment


      • #4
        Thank you both!

        Comment

        Working...
        X