Announcement

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

  • Graphs with Coarsened exact matching (CEM)

    Hi, I want to do a graph to check for parallel pre-treatment trends.

    I have done it on the unmatched sample using:

    separate yvariable, by(treated)
    bysort Year: egen Untreated = mean(yvariable0)
    bysort Year: egen Treated = mean(yvariable1)
    twoway (connect Untreated Year) (connect Treated Year)

    But I have also performed a coarsened exact matching which I include in the regressions by:

    reg yvariable Treated Post PostTreated X [iweight=cem_weights].

    I can however not find a way to include the weights given from the matching in the graphs, can anyone help?

    Thanks in advance

  • #2
    It is not clear to me what effect specifying weights would have on a two-way graph. Can you elaborate on how you expect the results to differ between weighted and unweighted graphs?

    Comment


    • #3
      Yes, due to the assumptions of difference-in-difference, I want the treatment and control group to be as similar as possible in characteristics. They are not before matching, i.e. smaller firms seems to have higher productivity according to my measure of TFP. There might also be differences in share with university education etcetera. As I understand the matching, it takes one treated firm and compare it with a weighted average of for example 10 different untreated firms which are similar in the matched characteristics. The graphs I got from the beginning include all firms considered treated in relation to all untreated and I can because of that don“t say if I get something similar to parallel pre-treatment trends.

      Did it become more clear?

      Comment


      • #4
        I still do not understand exactly what you are doing, but if what you want to do is reproduce the separate, egen, and twoway commands taking into account the weights, then the place to do it is in the calculation of the means. To do that, what you want to use is the collapse command, which would also have worked with unweighted means. Perhaps try to reproduce your current graph using collapse, then modify it to add the weights.

        Comment


        • #5
          I tried to do collapse in the same way and it became the same graphs as before. Then I tried to add the matching and got different so I think it worked.

          I did like this:
          gen IndexUntreated = Index if treated==0
          gen IndexTreated = Index if treated==1

          collapse (mean)IndexUntreated IndexTreated [iweight=cem_weights], by(Year)
          Then the graph:
          twoway (connect IndexUntreated Year) (connect IndexTreated Year).

          It should be like that, shouldn't it?

          Thanks a lot.

          Comment


          • #6
            That looks like what I had in mind, yes. I'm glad to hear that collapse was able to reproduce your previous results, and that with the CEM weights included it provided what you needed.

            Comment


            • #7
              Yes, thanks a lot again.

              Have a good weekend

              Comment

              Working...
              X