Announcement

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

  • Diff in diff gives strange output

    Hi all
    (see images below)

    For a project, I have to check whether anti dumping measures against china had an effect on eu imports after 2016 (first measures, see image). Japan is the control group.
    I cut my data from 2011 upto 2018, and it seems that the lines go rather parallel, as such i thought of doing diff in diff. However it does seem like things go wrong. estat trendplots gives strange increasing results(?) and estat ptrends gives no output at all.
    The ATET coefficient on my interaction term is also positive, which would be the opposite of what i would expect.

    Coefficient Std. err. t P>|t| [95% conf. interval]
    treatXpost | 3.32445 4.467837 0.74 0.458 -5.496659 12.14556


    Code and images are included, thanks in advance for any help.

    Code:
    import excel "C:\Users\........\Panel data format for stata.xlsx", sheet("Sheet1") firstrow
    
    gen newdate = date(Yeardate, "DMY")
    format newdate %td
    order newdate, after(Yeardate)
    
    encode Country, gen(country_num)
    order country_num, after(Country)
    
    gen treated = 0
    replace treated = 1 if Country == "China"
    
    gen postfirsttreatment = 0
    replace postfirsttreatment=1 if newdate > date("01/07/2016","DMY")
    
    generate treatXpost = treated * postfirsttreatment
    
    drop if newdate >= date("01/01/2019","DMY")  /**avoid data where the second peak is starting*/
    
    
    /** didregress (index12monthslidingwindow) (treatXpost), group(country_num) time(newdate) **/
    
    xtset country_num
    xtdidregress (index12monthslidingwindow treated postfirsttreatment) (treatXpost), group(country_num) time(newdate) aeq
    
    estat trendplots
    estat ptrends






    Click image for larger version

Name:	Screenshot 2024-04-24 122448.png
Views:	1
Size:	173.9 KB
ID:	1751075
    Click image for larger version

Name:	Screenshot 2024-04-24 122244.png
Views:	1
Size:	140.6 KB
ID:	1751076
    Click image for larger version

Name:	Screenshot 2024-04-24 122402.png
Views:	1
Size:	90.7 KB
ID:	1751077
Working...
X