Announcement

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

  • Difference in differences

    Dear All

    I need some help with Difference-in Differences.

    I have two groups of firms, SOE and DNSOE and two time periods pre reform and post reform (DPOSTSSR=1).

    I need to compare the average coefficient (coefficient from difference in difference regression) of last year's earnings (NETPROFIT) for SOE and DNSOE firms pre- and post-reform.

    FNETPROF is the lead variable of NETPROFIT.

    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long ID float(YEAR FNETPROF) double NETPROFIT_w float(DNSOE DPOSTSSR)
    2 2008 6430007296 4639869152.73 0 1
    2 2009 7025428480 6417605258 0 1
    2 2010 7025428480 6417605258 0 1
    6 2008 335222976 150211068.91 0 1
    6 2009 496465088 335222969.08 0 1
    6 2010 434116992 496465075.46 0 1
    11 2008 96934288 9833936.59 0 0
    11 2009 174998528 96934287.02 0 1
    11 2010 257461072 174998534.79 0 1
    14 2008 83167160 43649562.04 0 1
    14 2009 77617072 83167157.62 0 1
    14 2010 64633036 77617075.01 0 1
    16 2008 147386576 277795888.3 0 1
    16 2009 101189496 147386572.25 0 1
    16 2010 24179368 101189494.95 0 1
    19 2008 -9865188 16013561.03 0 1
    19 2009 8985389 -9865188.3 0 1
    19 2010 9643239 8985389.49 0 1
    20 2008 4154593 7567912.54 1 1


    Many thanks

    Yahya Ghazali

  • #2
    First, there is something wrong with your data. You say that FNETPROFIT is the lead of NETPROFIT--but examining the data this is clearly not true. It is close, but not exact. I see that NETPROFIT is a -double- but FNETPROFIT is a -float-. I'm guessing that in creating the FNETPROFIT variable you just used a -generate- command without specifying a storage type: that leads to getting a default float storage type, and, in the process, loss of precision. Now, based on what you have described of your project so far, you don't actually need an FNETPROFIT variable at all. And even if you do need such a variable for other aspects of the project, it is likely that just refering to F1.NETPROFIT will do the trick, without actually creating a new variable. But if you do actually need such a variable, the correct code would be

    Code:
    xtset ID YEAR
    gen double FNETPROFIT = F1.NETPROFIT
    As for setting up your DID estimation, it is unclear whether the reform in question is initiated in the same year in all of the IDs that are subject to it. In your example data DNSOE is always 0, except for ID 20 (which has only a single observation), and DPOSTSSR is always 1 except for the year 2008 observation of ID 11. So I can't tell what's going on. And if there isn't more variation in both DNSOE and DPOSTSSR you will not be able to do a DID estimation.

    I'm going to assume that the reform is implemented in different years among the different IDs that undergo the reform. And I'm going to assume that DPOSTSSR is always 0 in the group that does not get the reform, is 0 in the pre-reform observations of the group that does get the reform, and is 1 in post-reform observations of the group that does get the reform. On those assumptions, you can do a DID estimation as follows:

    Code:
    xtreg NETPROFIT i.DSPOSTSSR i.YEAR, fe
    The coefficient of DSPOSTSSR will be the DID estimator of the effect of the reform. You may want to use clustered standard errors for this.

    Comment


    • #3
      Thank you for this

      Comment

      Working...
      X