Announcement

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

  • #16
    The post is not important in my case, sorry for having described it.

    Comment


    • #17
      So, I think you want something like this:
      Code:
      gen year = year(dofq(numvar))
      gen flag_2019 = (year == 2019)
      regress ln_unemployment_rate i.post##c.avg_GAP i.year
      predict modeled, xb
      
      //  "NORMALIZE" TO 2019 VALUES BEING ZERO
      isid code year
      by code (flag_2019), sort: gen observed_diff_from_2019 = ln_unemployment_rate - ln_unemployment_rate[_N]
      by code (flag_2019): gen modeled_diff_from_2019 = modeled - modeled[_N]
      
      collapse (mean) observed_diff_from_2019 modeled_diff_from_2019 (sem) se_observed = observed_diff_from_2019 ///
          se_modeled = modeled_diff_from_2019, by(year)
          
      gen lb = modeled_diff_from_2019 - 1.96*se_modeled
      gen ub = modeled_diff_from_2019 + 1.96*se_modeled
      
      sort year
      
      
      graph twoway connect modeled_diff_from_2019 year || rcap lb ub year, ///
          xline(2019) yline(0)
      But, again, this kind of plot is not a plot of any coefficient, so I still don't know what they're talking about, and I'm not confident what I'm showing you here is what you're looking for. But, as I say, I find their graphs to be self-contradictory (optimistically, the contradictions are resolved in the full text of the article--that's a terrible way to do graphs, by the way), so nothing I can come up with will quite match it.

      Comment


      • #18
        Thank you sooo much, I am soooo happy it's exactly what I wished to have. Is there a way to show the time trend if the minimum wage didnt increase and the time trend would continue like before 2019? Again thank you so much.

        Comment


        • #19
          Actually, to get the counterfactual you want, the variable post is very important!

          Note: The following code also fixes an error I found in the earlier code.

          Code:
          gen year = year(dofq(numvar))
          gen flag_2019 = (year == 2019)
          
          regress ln_unemployment_rate i.post##c.avg_GAP i.year
          predict modeled, xb
          gen counterfactual = modeled
          replace counterfactual = modeled - _b[1.post] - _b[1.post#c.avg_GAP]*c.avg_GAP if post == 1
          
          //  "NORMALIZE" TO 2019 VALUES BEING ZERO
          isid code year
          by code (flag_2019), sort: gen observed_diff_from_2019 = ln_unemployment_rate - ln_unemployment_rate[_N]
          by code (flag_2019): gen modeled_diff_from_2019 = modeled - modeled[_N]
          by code (flag_2019): gen counterfactual_diff_from_2019 = counterfactual - counterfactual[_N]
          assert counterfactual_diff_from_2019 == 0 if year == 2019
          
          collapse (mean) observed_diff_from_2019 modeled_diff_from_2019 counterfactual_diff_from_2019 ///
              (sem) se_observed = observed_diff_from_2019 se_modeled = modeled_diff_from_2019, by(year)
              
          gen lb = modeled_diff_from_2019 - 1.96*se_modeled
          gen ub = modeled_diff_from_2019 + 1.96*se_modeled
          
          sort year
          
          graph twoway connect modeled_diff_from_2019 year || rcap lb ub year || ///
              line counterfactual_diff_from_2019 year, xline(2019) yline(0)

          Comment


          • #20
            Thank you very much for the code. Now the problem is, that the counterfactual should be more or less the same line than the other line before 2019 continues in the same direction as before. Now, the trend line is like the green line on the first picture, but it should be like the dashed line on the second picture. Do you know a way to get this? . I would be very thankful.
            Attached Files
            Last edited by Felix Chappuis; 21 Jul 2021, 02:21.

            Comment


            • #21
              As I understand it, before 2019 the counterfactual is the same as reality because there is no "intervention" at that time. The counterfactual and the observed should be the same until they part ways when post goes from 0 to 1. So there is already a problem because you have post = 1 starting at 2018. So the intervention it appears is already underway before your reference period. That means that the counterfactual and the observed part ways before 2019. If you look at the first graph, you can see that the counterfactual is running exactly parallel to the observed. The reason they are parallel but not overlapping is that in terms of your model the counterfactual has to differ from the observed starting in 2018. But you have stipulated that everything is supposed to be zeroed out at 2019, so the counterfactual before that gets shifted away.

              Look, I can figure a way to write code that will resemble your second graph--but it won't be anything coherent in terms of your model. It is by now quite clear that whatever they are doing in the article you linked is rather different from what you are doing here. I am not an economist and I can't comment on the economic appropriateness of the model you are using. And I can't comment on what is in the article because I don't have full information--all I have seen from it is some graphs that don't make any sense in the first place. All I can say is that the two are not the same and you are trying to shoehorn your model's data into their graphs.

              In order for this thread to continue in a sensible way, you need to provide a clear and accurate explanation of what is going on in the article. Then maybe we can put that together with your work.

              Comment

              Working...
              X