Announcement

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

  • Graph for parallel trend

    Dear Stata users,

    Using a panel data collected during the years 2011, 2013, and 2015, I am trying to measure the effect of a policy shock introduced in 2013 on income (measured based on USD) across gender. Here are some of my codes. My question is how to graph the parallel trend? Thank you.

    [CODE] gen post2013=year>=2013
    [CODE] global controls1 age lnrhhcpaes primary secondary tertiary i.year
    Code:
     xi: xtreg income i.gender*post2013 $controls1  if sample_eligible==1, fe cluster (individual_id)
    dataex income year age gender lnrhhcpaes primary secondary tertiary


    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(income year age) byte gender double(lnrhhcpaes primary secondary tertiary)
                      . 2011                 77 0  .8152432071821061 0 0 0
                      . 2013                 78 0  1.399673295772694 0 0 0
                      . 2015 .16666666666666666 0 1.3608679383262754 0 0 0
                      . 2011                 40 1  .8152432071821061 0 0 0
                  32.71 2013                 41 1  1.399673295772694 0 0 0
                      . 2015 .16666666666666666 . 1.3608679383262754 0 0 0
                      . 2011                 35 0  .8152432071821061 0 0 0
                      . 2013                 36 0  1.399673295772694 1 0 0
                      . 2015 .16666666666666666 . 1.3608679383262754 0 0 0
                  18.55 2011                 18 1  .8152432071821061 0 0 0
                      . 2013                  0 .  1.399673295772694 1 0 0
                      . 2015 .16666666666666666 . 1.3608679383262754 0 0 0
                      . 2011                 13 1  .8152432071821061 0 0 0
                      . 2013                 16 1  1.399673295772694 0 0 0
                      . 2015 .16666666666666666 . 1.3608679383262754 0 0 0
                      . 2011                  9 0  .8152432071821061 1 0 0
                  28.11 2013                 13 0  1.399673295772694 0 0 0
                      . 2015 .16666666666666666 . 1.3608679383262754 0 0 0
                      . 2011                  5 1  .8152432071821061 0 0 0
                      . 2013  6.666666666666667 1  1.399673295772694 0 0 0
                      . 2015 .16666666666666666 . 1.3608679383262754 0 0 0
                      . 2011  4.166666666666667 0  .8152432071821061 1 0 0
                      . 2013               5.25 0  1.399673295772694 0 0 0
                      . 2015 .16666666666666666 . 1.3608679383262754 0 0 0
                      . 2011                 36 1  .7193044973232724 0 0 0
                      . 2013                 37 1  3.232227423733143 0 0 0
                  21.03 2015 .16666666666666666 1  .5995618093761934 1 0 0
                  21.93 2011                 31 0  .7193044973232724 0 0 0
                      . 2013                 30 0  3.232227423733143 0 0 0
                  -3.72 2015 .16666666666666666 0  .5995618093761934 0 0 0
                      . 2011                 13 1  .7193044973232724 0 0 0
                      . 2013                 14 1  3.232227423733143 0 0 0
                      . 2015 .16666666666666666 1  .5995618093761934 1 0 0
                      . 2011                 11 1  .7193044973232724 0 0 0
                  36.77 2013                 13 1  3.232227423733143 0 0 0
                      . 2015 .16666666666666666 1  .5995618093761934 0 0 0
                      . 2011                  9 0  .7193044973232724 0 0 0
                      . 2013                 10 0  3.232227423733143 0 0 0
                  29.67 2015 .16666666666666666 0  .5995618093761934 0 0 0
                      . 2011                  7 0  .7193044973232724 0 0 0
                      . 2013                6.5 0  3.232227423733143 0 0 0
                      . 2015 .16666666666666666 1  .5995618093761934 0 0 0
                      . 2011  4.666666666666667 1  .7193044973232724 0 0 0
                   4.09 2013  4.833333333333333 1  3.232227423733143 0 0 0
                      . 2015 .16666666666666666 0  .5995618093761934 1 0 0
                      . 2011                 70 0 1.7775088132066008 0 0 0
                      . 2013                 78 0 1.9099625153003028 0 0 0
                      . 2015 .16666666666666666 0 2.4955796926748524 0 0 0
                      . 2011                 30 0 1.2134501434897833 0 0 0
                      . 2013                 30 0 1.5612222436648233 1 0 0
                      . 2015 .16666666666666666 0 1.5102051179424925 1 0 0
                      . 2011                 58 0 1.2134501434897833 1 0 0
                      . 2013                  0 0 1.5612222436648233 1 0 0
                      . 2015 .16666666666666666 . 1.5102051179424925 1 0 0
                      . 2011                 11 0 1.2134501434897833 1 0 0
                      . 2013                 15 0 1.5612222436648233 0 0 0
                      . 2015 .16666666666666666 0 1.5102051179424925 0 0 0
                      . 2011                  9 0 1.2134501434897833 0 0 0
                      . 2013                 12 0 1.5612222436648233 1 0 0
                      . 2015 .16666666666666666 0 1.5102051179424925 0 0 0
                      . 2011                 69 1 1.6875512638620518 1 0 0
                      . 2013                 71 1 1.2325500218852072 1 0 0
                      . 2015 .16666666666666666 1 2.2155150970556936 0 0 0
                      . 2011                 47 0 1.6875512638620518 0 0 0
                      . 2013                 66 0 1.2325500218852072 0 0 0
                      . 2015 .16666666666666666 0 2.2155150970556936 0 0 0
                      . 2011                 18 0 1.6875512638620518 1 0 0
                      . 2013                 19 0 1.2325500218852072 1 0 0
                      . 2015 .16666666666666666 . 2.2155150970556936 0 0 0
                      . 2011                 11 0 1.6875512638620518 0 0 0
                      . 2013                 13 0 1.2325500218852072 0 0 0
                      . 2015 .16666666666666666 . 2.2155150970556936 0 0 0
                      . 2011                 24 0 1.4456412409332522 0 0 0
                  38.04 2013                 28 0 1.9155319084074485 0 0 0
                      . 2015 .16666666666666666 0  1.322350734931026 1 0 0
                      . 2011                  8 1 1.4456412409332522 0 0 0
                      . 2013                  9 1 1.9155319084074485 0 0 0
                      . 2015 .16666666666666666 1  1.322350734931026 1 0 0
                      . 2011                  5 0 1.4456412409332522 1 0 0
                  21.46 2013               6.75 0 1.9155319084074485 0 0 0
                      . 2015 .16666666666666666 0  1.322350734931026 1 0 0
                      . 2011                  5 0 1.4456412409332522 1 0 0
                      . 2013               6.75 1 1.9155319084074485 1 0 0
                      . 2015 .16666666666666666 0  1.322350734931026 1 0 0
                      . 2011                 36 1  .8076357240438148 0 0 0
                  27.32 2013                 37 1  1.434296226303937 0 1 0
                      . 2015 .16666666666666666 1  .9992357091229473 0 0 0
                      . 2011                 28 0  .8076357240438148 1 0 0
                   9.05 2013                 30 0  1.434296226303937 0 0 0
                      . 2015 .16666666666666666 0  .9992357091229473 0 0 0
                      . 2011                 15 0  .8076357240438148 0 0 0
                      . 2013                 18 0  1.434296226303937 1 0 0
                      . 2015 .16666666666666666 .  .9992357091229473 0 0 0
                      . 2011                  5 0  .8076357240438148 0 0 0
                      . 2013                  7 0  1.434296226303937 0 0 0
     14.540000000000001 2015 .16666666666666666 0  .9992357091229473 1 0 0
    -2.5100000000000002 2011 2.5833333333333335 1  .8076357240438148 0 1 0
                   -2.1 2013  4.666666666666667 1  1.434296226303937 0 0 0
                      . 2015 .16666666666666666 1  .9992357091229473 0 1 0
                  12.74 2011                 30 1 1.3247277823012955 0 0 0
    end
    label values sex sex
    label def sex 0 "female", modify
    label def sex 1 "male", modify
    ------------------ copy up to and including the previous line ------------------


  • #2
    you cannot establish parallel (pre) trends with only one time point observed before the policy shock, the best you can do is to compare income by sex in 2011

    Comment


    • #3
      Dear Snilsberg,

      Thank you for your response. OK, so how could I implement your recommendation in Stata to verify whether the parallel trend holds?



      Code:
        gen post2011=year>=2011

      Comment


      • #4
        He just said you can't verify it. You'd need a longer time series of pre intervention data.

        Comment


        • #5
          Hi Greathouse,

          I understand, but I am saying how to perform the "income comparison by sex in 2011" in Stata. Thanks.

          Comment


          • #6
            Analytically, you'd just do
            Code:
             
             xtreg income i.gender##c.post2013
            but graphically, you'd just use line graphs to look at the pre and post outcome data

            Comment


            • #7
              As an aside to the very helpful advice, Bahre Kiros you should note that the parallel trends assumption can never be tested and proven beyond reasonable doubt, although tests exist they have been heavily criticised in the literature (see e.g. Roth et al. 2022). You'll have to argue it holds.

              Comment


              • #8
                Thank you so much, Morlet. I would refer to the mentioned source.

                Comment


                • #9
                  Bahre Kiros what specific policy are you studying and what exactly are the units you're comparing?

                  Comment

                  Working...
                  X