Announcement

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

  • Difference-in-differences

    Hello, everyone. I am doing my master's thesis, and I am experiencing some problems and doubts on how to apply diff methodology to the panel data I have.
    The purpose of the analysis is to observe whether or not the semiconductor shortage in 2020 had an economic impact on importing companies.
    The data panel covers five consecutive years from 2018 to 2022. I therefore created a dummy for the time period (0 before 2020 and 1 after 2020), a dummy treated and in turn the interaction dummy. The variables on which I have to observe the effect are budget indices. In the final analysis, I added control variables (dummy on the origin north-west north east centre and south) ( dummy number of employees) and two indices that have values between 0 and 1. I am not sure whether the control variables especially the two indices that have values varying from 0 and 1 are set correctly and whether the interaction time period dummy x treated is correct. I don't know how to share my panel data

    Code:
    **Rename some variables
    
    rename Employess employee
    rename ReturnonequityROE roe
    rename ReturnonsalesROS ros
    rename ReturnonassetsROA roa
    rename ReturnoninvestementsROI roi
    rename DummyTreatednoTretaed treat
    rename Year year
    rename Dummynordwest north_west
    rename Dummynordeast north_east
    rename Dummycenter center
    rename DummysouthIsland south_island
    rename Dummysmallbigcompany small_big
    rename VerticalIntegration vertical
    rename Financialindependenceindex financ_index
    
    gen year_only_estb = year(year_estb)
    
    
    
    gen overall_sales = other_revenue+ sales_revenue
    
    **clean the datastset
    drop if vertical > 1
    drop if financ_index > 1
    
    destring, replace
    
    **o set the data to panel
    xtset vat
    
    gen post = 1 if year >= 2021
    replace post = 0 if post !=1
    
    
    ***Differnce in difference estimation anaysis
    **First regression Table
    est clear
    eststo:xtreg roe post treat c.post#c.treat c.post#c.treat#c.north_west c.post#c.treat#c.north_east c.post#c.treat#c.south_island small_big vertical financ_index , vce(robust)
    
    eststo:xtreg ros post treat c.post#c.treat c.post#c.treat#c.north_west c.post#c.treat#c.north_east c.post#c.treat#c.south_island small_big vertical financ_index , vce(robust)
    
    eststo:xtreg roa post treat c.post#c.treat c.post#c.treat#c.north_west c.post#c.treat#c.north_east c.post#c.treat#c.south_island small_big vertical financ_index , vce(robust)
    
    eststo:xtreg roi post treat c.post#c.treat c.post#c.treat#c.north_west c.post#c.treat#c.north_east c.post#c.treat#c.south_island small_big vertical financ_index , vce(robust)
    
    
    esttab using "regression1.tex", booktabs mtitle("\shortstack{\textbf{ROE}}" "\shortstack{\textbf{ROS}}" "\shortstack{\textbf{ROA}}" "\shortstack{\textbf{ROI}}") replace ///
    b(3) se(3)r2 label star(* 0.10 ** 0.05 *** 0.01) ///
    coeflabel(date "year dummy" post "Post" treat "Treat" c.post#c.treat "Treatment Effect" c.post#c.treat#c.north_west "Treat North West" c.post#c.treat#c.north_east "Treat North East" c.post#c.treat#c.south_island "South Island" Small_Big "small_big" vertical "Vertical Integration" financ_index "Financial Index" ) ///
    title(Difference in difference analysis) sfmt(3)
    Last edited by Carlo vorgnano; 13 Oct 2023, 11:23.

  • #2
    Carlo:
    welcome to this forum.
    Sorry to disappoint you, but I do not think that your (too long) query will receive any positive reply.
    I'd recommend you to use CODE delimiters and -dataex- to share what you think can help interested listers to help you out. Thanks.
    As far as DID is concerned, please take a look at -help didregress- and related entry in Stata .pdf manual.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo, Thanks for your advice I have edited the post making it more readable.

      Comment

      Working...
      X