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

  • How to do DID Analysis using stata?

    Hello everyone, I am a student at a university and i am very new to DID analysis.
    The purpose of my research was to see the impact of an anti-dumping policy applied to several countries on import volumes.
    I have 7 countries to research and the data is taken from 2014-2018

    Here are some of the information i have

    4 Control group: countries that do not receive treatment /ADpolicy (non-named countries)
    3 Treatment group: countries receiving treatment / ADpolicy (named countries)

    The data were taken from 2014 to 2018.
    With a note that 2014 and 2015 are before treatment and
    2016,2017, and 2018 are during treatment

    1. Is the arrangement of my data already correct?

    Click image for larger version

Views:	1
Size:	20.6 KB
ID:	1596503

    2. I saw some posts on statalist and tried to take the following actions.Is this correct to explain the impact of the policy on import volume?

    i used code:
    xtset country
    xtreg volimpor i.treated##i.time, fe vce(robust)
    im sorry, fyi i don't know how to decide use random effect or fixed effect.

    3. With that code above i have this but i don't know how to interpret the result

    Click image for larger version

Name:	did panel data estimator.PNG
Views:	1
Size:	21.3 KB
ID:	1596504

    Could you teach me how to solved that problem ?
    Thank you and have a nice day everyone

  • #2
    The data organization appears correct. And the model you have fit to it is a basic difference in difference analysis. On the assumption that this is observational, not experimental, data, the question arises whether there are other variables that should be taken into account--an issue you should think about and perhaps consult with somebody in this field. Most people in economics will tell you t use a Hausman test to choose between the fixed and random effects models, and the -xtoverid- command, available from SSC, can be used for that purpose. However, I advocate using the fixed effects model regardless (unless this is experimental data from a randomized trial). You will also want to investigate whether your data are consistent with the parallel trends assumption that underlies causal inference using the DID approach. (However, within only 7 countries and 2 pre-treatment observations of each, your investigation of that will likely be inconclusive.)

    There is one problem with the analysis you have done:you have used the robust (actually, in -xtreg, fe- this is replaced by the cluster robust) standard error. But that is not appropriate with only 7 clusters. While there is not a consensus about the minimum number of clusters required for this, I think nearly everyone would agree that 7 is too few.

    As for interpretation, the coefficient of the interaction term, -0.2517465 is your DID estimate of the treatment effect. The 95% confidence interval runs from about -1.56 to +1.06 suggesting that the data does not identify the effect with sufficient precision to even determine whether it is positive or negative. The study would thus be considered inconclusive unless an effect of that magnitude in either direction would be too small to be worth considering in any case. (I don't know how large an effect on this variable would be meaningful--that is a substantive question, not a statistical one.)

    In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.


    • #3
      Thank you for your response and answer Sir. I will discuss it with my professor for further observation. I really appreciate your help. Hopefully i can finish my observation. Thanks again and have a nice day