Announcement

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

  • Kernel-based Propensity Score Matching diff-in-diff

    Hi Stata Users,

    Below is an example of my data set. I want to perform the Kernel-based Propensity Score Matching diff-in-diff. I am actually using the following command. However, it is giving me an "error 2000". Please, would someone help in letting me know where are the mistakes in the command and how to run the regression?


    Code:
    #delimit;
    diff mw, treat_interaction
    cov(county unemployment population median_age median_income Graduates ghi) kernel ktype (gaussian) id(county) support bw (0.05) cluster (county) bs reps(50) robust 
    ;
    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str17 county double unemployment long population double median_age long median_income double Graduates float(ghi treat_interaction)
    "alameda"        9.2 1494876 36.4 70821 16.6 247.483 1
    "butte"         13.1  221578 36.9 43165  8.4 120.275 1
    "calaveras"     11.8   45507 49.5 54686    6 225.646 0
    "contracosta"    9.5 1037817 38.3 79135 13.9 247.483 1
    "humboldt"      10.5  135034 37.4 42197  9.5 156.278 0
    "inyo"           7.1   18457 45.1 49571  8.1  223.37 0
    "lassen"         9.4   31945 36.4 51457  4.9 198.262 0
    "losangeles"      11 9974203 35.3 55870 10.4 236.282 1
    "marin"          7.6  254643 44.8 90839 23.4 162.841 1
    "merced"        15.7  265001 30.6 44397  4.8 228.114 1
    "nevada"        10.7   98606 48.8 56949 11.4 120.275 0
    "placer"          10  355924 40.4 72725 11.4 211.771 1
    "plumas"        17.2   19586 49.9 45794  9.4 211.771 0
    "riverside"     11.2 2109464 33.4 57768  7.2 221.971 1
    "sanbenito"     13.8   56115 34.5 66237  4.7 232.761 0
    "sanbernardino" 14.5 2056915 31.9 54090  6.5  280.19 1
    "sanluisobispo"  5.5  278680   39 64014 12.4 306.788 1
    "santaclara"     7.8 1739396 35.8 86850 19.6 341.417 1
    "santacruz"      7.6  269278   37 67256   15 216.777 1
    "sierra"         9.1    3163 51.6 42500  5.6 198.943 0
    "solano"        11.4  425753 37.3 66828  7.4 216.777 1
    "sonoma"         8.7  478551 39.7 64343 11.3 247.483 1
    "stanislaus"    16.3  522794 33.3 49573  5.4  122.71 0
    "ventura"        8.6  840833 37.1 77348 11.7 187.689 1
    "yuba"          12.7   73897 32.2 48739  4.9 198.262 1
    "alameda"        7.1 1605217 37.2 79831 18.5 215.606 1
    "alameda"        7.7 1457095 36.1   672   16  307.61 0
    "alameda"        8.5 1477980 36.2 69384 16.3 341.417 1
    "alameda"        9.6 1559308 36.9 73775 17.5  213.38 1
    "alameda"        9.9 1515136 36.6 71516 16.8 240.482 1
    "alameda"        8.3 1584983 37.1 75619   18 216.777 1
    "alameda"       10.3 1535248 36.8 72112 17.2 162.841 1
    "amador"        11.4   38327 47.2 54758  5.8 217.474 0
    "amador"        17.3   37764 48.4 53462  4.8 225.646 0
    "amador"        15.2   38244   48 56180  5.7  223.37 0
    "amador"        16.8   37422 49.1 53684  5.1 232.761 0
    "amador"          14   36995   50 54171  6.6 91.5255 0
    "amador"        10.4   38039 46.3  3857  6.1  206.85 0
    "amador"        15.9   37159 49.6 52964  6.2  122.71 0
    "amador"        11.6   36963 50.3 57032  6.9 228.114 0
    "butte"         14.4  220101 37.3 43339  8.1 198.943 0
    "butte"         13.2  219309 37.2 42971  7.9 194.679 0
    "butte"         10.6  217917 36.6  1295  8.4 296.228 0
    "butte"         10.7  223877 36.9 44366  8.7 198.262 1
    "butte"         14.1  220542   37 43752  8.2 211.771 0
    "butte"         11.5  218635 37.2 43170  8.1 189.696 0
    "butte"         12.1  222564 36.8 43444  8.3 156.278 1
    "calaveras"      9.6   44787 51.2 53502  6.5 228.114 0
    "calaveras"     12.1   44767 50.7 53233  6.5 91.5255 0
    "calaveras"      9.2   45794   49 55256  6.4  223.37 0
    "calaveras"      8.2   46548 47.7  3490  6.8  206.85 0
    "calaveras"      7.6   45994 48.5 54971  6.6 217.474 0
    "calaveras"     11.6   45147   50 55295  6.2 232.761 0
    "calaveras"     11.3   44921 50.3 54936  6.1  122.71 0
    "colusa"        13.8   21297 33.5 49558  2.9 194.679 0
    "colusa"        12.9   21001   33  4129  3.7 296.228 0
    "colusa"        10.4   21396   34 52168  3.2 156.278 1
    "colusa"        12.4   21424 34.1 50503  3.1 120.275 0
    "colusa"        13.3   21366 33.9 52158  2.5 211.771 0
    "colusa"        14.4   21329 33.9 52165  2.5 198.943 0
    "colusa"         8.7   21361 34.7 54946  3.4 198.262 1
    "colusa"        14.2   21165   34 48016  2.9 189.696 0
    "contracosta"    7.2 1015571   38   718 13.4  307.61 0
    "contracosta"    8.2 1024809 38.1 78385 13.7 341.417 0
    "contracosta"    7.7 1107925 39.1 82881 14.7 215.606 1
    "contracosta"   10.4 1065794 38.6 78756 14.1 162.841 1
    "contracosta"    8.8 1096068 38.8 80185 14.4 216.777 1
    "contracosta"   10.1 1052047 38.5 78187 14.1 240.482 1
    "contracosta"    9.8 1081232 38.7 79799 14.3  213.38 1
    "eldorado"       9.6  183000 45.2 72586   12 198.262 1
    "eldorado"       8.2  179053 42.6 70000 10.1 189.696 0
    "eldorado"         7  175941 41.6  1640   10 296.228 0
    "eldorado"      11.1  182093 44.9 69584 11.3 156.278 0
    "eldorado"        12  180982 44.1 69297 10.4 211.771 0
    "eldorado"      11.3  181465 44.4 68507 10.8 120.275 0
    "eldorado"      10.9  180441 43.5 70117   10 198.943 0
    "eldorado"       9.7  179878 43.1 68815  9.7 194.679 0
    "fresno"        14.3  948844 31.2 45201  6.4  122.71 1
    "fresno"        14.5  939605 30.9 45563  6.5 232.761 1
    "fresno"        12.7  920623 30.6 46903  6.3  223.37 0
    "fresno"        11.4  908830 30.4 46430  6.3 217.474 0
    "fresno"          10  890750 30.3   597  6.1  206.85 0
    "fresno"          14  930517 30.7 45741  6.3 225.646 1
    "fresno"        11.9  963160 31.6 45963  6.6 228.114 1
    "fresno"        13.2  956749 31.4 45233  6.4 91.5255 1
    "glenn"          7.1   27891 34.5  1743  3.3 296.228 0
    "glenn"          9.9   27976 36.9 41699  3.2 198.262 1
    "glenn"         13.5   28019 36.7 40106    5 120.275 0
    "glenn"         12.6   28029 37.2 39349  4.2 156.278 1
    "glenn"         12.8   28054 37.2 43023  4.5 211.771 0
    "glenn"           10   28027 35.3 43239  4.3 194.679 0
    "glenn"         10.5   28078 36.5 42641  4.4 198.943 0
    "glenn"          8.3   27935 35.1 43074  4.3 189.696 0
    "humboldt"       7.9  129003 36.5  1423    9 296.228 0
    "humboldt"      11.1  134613 37.5 41426  8.8 211.771 0
    "humboldt"      11.3  134876 37.4 42153    9 120.275 0
    "humboldt"       8.6  133058 37.1 40089  8.6 189.696 0
    "humboldt"      10.4  134317 37.5 40830  8.8 198.943 0
    "humboldt"       9.5  135182 37.6 42685  9.5 198.262 1
    "humboldt"       9.7  133585 37.3 40376  8.6 194.679 0
    end
    Thank you
    Ali

  • #2
    Hi, Ali, Your data example doesn't help (at least, where is the outcome variable mw?). More importantly, please help diff. You didn't provide two "required" options:
    Code:
     Model - Required
          period(varname)     Indicates the binary period variable (0: before; 1: after). Note: if your data contains a periodical frequency (monthly, quarterly, yearly, etc.), it is suggested to specify option period(varname) and
                                include a binary variable for each frequency in option cov(varlist).
          treated(varname)    Indicates the binary treatment variable (0: controls; 1:treated).
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

    Comment


    • #3
      Hi River,

      Thank for your reply. This is the code that I have used again. Below also the results of the regression. However, it might be important to note again that the treatment happens at different times over the time period of the study for each county.



      Code:
      #delimit;
      diff mw, treated(treated) period(period) 
      cov(lnpop 
      age 
      income    
      democrats
      ghi 
      lnwatt 
      unemployment
      Graduates 
      Bachelors 
      no_degree 
      High_school
      rebates) kernel ktype(gaussian) id(id) support bw(0.05) cluster(id)  reps(50)
      robust 
      ;



      Code:
      KERNEL PROPENSITY SCORE MATCHING DIFFERENCE-IN-DIFFERENCES
          Estimation on common support
          Matching iterations...
      .......................
      DIFFERENCE-IN-DIFFERENCES ESTIMATION RESULTS
      Number of observations in the DIFF-IN-DIFF: 39
                  Before         After    
         Control: 15             0           15
         Treated: 23             1           24
                  38             1
      --------------------------------------------------------
       Outcome var.   | mw      | S. Err. |   |t|   |  P>|t|
      ----------------+---------+---------+---------+---------
      Before          |         |         |         | 
         Control      | 0.539   |         |         | 
         Treated      | 0.703   |         |         | 
         Diff (T-C)   | 0.164   | 0.456   | 0.36    | 0.726
      After           |         |         |         | 
         Control      | -0.154  |         |         | 
         Treated      | 0.010   |         |         | 
         Diff (T-C)   | 0.164   | 0.456   | 0.36    | 0.726
                      |         |         |         | 
      Diff-in-Diff    | 0.000   |    .    |    .    |    .
      --------------------------------------------------------
      R-square:    0.02
      * Means and Standard Errors are estimated by linear regression
      **Robust Std. Errors
      **Clustered Std. Errors
      **Inference: *** p<0.01; ** p<0.05; * p<0.1

      Comment


      • #4
        Dear Ali, The -diff- command is not applicable to the cases where the treatment happens to different time periods for different counties. Please visit http://faculty.haas.berkeley.edu/ross_levine/papers.htm, and see the paper "Big Bad Banks: The Winners and Losers from Bank Deregulation in the United States." (with Thorsten Beck and Alexey Levkov) Journal of Finance, October 2010, 1637-1667. Lead Article. Data Appendix. Data.
        Ho-Chuan (River) Huang
        Stata 17.0, MP(4)

        Comment


        • #5
          Dear River,

          Thank you for the link. In fact, I have done the regression based on Diff-in-Diff. I have the results and everything is alright. However, I wanted to extend the analysis to Propensity Score Matching where I interact the Diff-in-Diff with PSM (reduce bias and ensure somehow the validation of the parallel trend key assumption). This paper you have sent me is not about the DD-Matching using PSM algorithms.

          I was looking here for some help with the code in STATA to run the regression DiD-PSM.

          Hope I have clarified my query.

          Best regards Ali

          Comment


          • #6
            Dear Ali, My bad. People often use (ssc install) -psmatch2- command to obtain matched treatment and control groups, and then use the matched sample to do DID analysis.
            Ho-Chuan (River) Huang
            Stata 17.0, MP(4)

            Comment


            • #7
              Hi River,

              Your answer helped a lot! These are my data example, commads and results:
              Code:
              * Example generated by -dataex-. To install: ssc install dataex
              clear
              input str17 county float(year Treatment mw lnpop age income rebates) double(unemployment Graduates Bachelors no_degree High_school _pscore) byte(_treated _support) double(_weight _mw) int(_id _n1) float _nn double _pdif
              "alameda"       2009 0  5.213826 14.191956 1 36.1 1  7.7   16 23.9   18 20.6     .17207173990663555 0 1 .                 . 138   . 0                    .
              "amador"        2009 0      .007 10.546368 1 46.3 0 10.4  6.1 13.4 28.2 30.5  9.085493932516473e-06 0 1 .                 .   7   . 0                    .
              "butte"         2009 0   .810153  12.29187 1 36.6 1 10.6  8.4 16.5   28 24.1   .0042588457485206715 0 1 .                 .  34   . 0                    .
              "calaveras"     2009 0    .00196  10.74824 1 47.7 0  8.2  6.8 12.5   29 31.7 1.5731362422987475e-06 0 1 .                 .   4   . 0                    .
              "colusa"        2009 0  2.166067  9.952325 1   33 1 12.9  3.7  9.2 21.9 24.8   9.30798356204902e-06 0 1 .                 .   8   . 0                    .
              "contracosta"   2009 0  3.434727  13.83096 1   38 1  7.2 13.4 24.2 22.1 20.2      .1010816742043289 0 1 .                 . 117   . 0                    .
              "eldorado"      2009 0   .227966 12.077904 1 41.6 0    7   10 21.1   28 22.9                      . . . .                 . 375   . .                    .
              "fresno"        2009 0  2.280215  13.69982 1 30.3 1   10  6.1 13.3 22.4 23.3     .03659443424232766 0 1 .                 .  78   . 0                    .
              "glenn"         2009 0   .093392  10.23606 1 34.5 1  7.1  3.3 11.2 25.8 26.3  .00019735786798760716 0 1 .                 .  15   . 0                    .
              "humboldt"      2009 0   .114414  11.76759 1 36.5 1  7.9    9 17.9 27.8 26.2    .007215482305381358 0 1 .                 .  39   . 0                    .
              "inyo"          2009 0  .3326908  9.766407 1 44.5 0  6.2  7.4 13.7 29.4 29.8  .00014780484697631972 0 1 .                 .  14   . 0                    .
              "kern"          2009 0 1.9256383  13.56827 1 30.3 1 10.2  4.7  9.9 22.2 27.5     .02882676273520452 0 1 .                 .  71   . 0                    .
              "kings"         2009 0  .7658589 11.896118 1   30 1 12.9  3.2  8.3 22.3   29   .0027175780885518473 0 1 .                 .  29   . 0                    .
              "lake"          2009 0  1.038458 11.078382 1 43.1 1    9  4.8 11.3 28.7 33.8   .0006241329578870803 0 1 .                 .  22   . 0                    .
              "losangeles"    2009 0  8.406075 16.096392 1 33.8 1  7.7  9.7 18.7 18.6 21.7      .2504151415139132 0 1 .                 . 152   . 0                    .
              "madera"        2009 0   .528687 11.883067 1 33.1 0 10.8    4  8.8 22.7 25.9   .0007987036125668357 0 1 1                 .  24   . 0                    .
              "marin"         2009 0  1.268648 12.415973 1 43.7 1  4.5 22.4 31.5 18.8 13.3    .036242829794880804 0 1 .                 .  77   . 0                    .
              "mendocino"     2009 0   .978011 11.362452 1 40.8 1    8  8.9 14.4 24.3 25.8     .01801417873580537 0 1 .                 .  59   . 0                    .
              "merced"        2009 0   .097564 12.397664 1 29.4 1 12.6    4  8.6 21.9 25.5  .00011992841617426987 0 1 .                 .  12   . 0                    .
              "monterey"      2009 0  1.307963  12.91145 1 32.5 1  9.6  9.1 14.5 19.2 20.9   .0052994441391376575 0 1 .                 .  37   . 0                    .
              "napa"          2009 0  1.652392 11.791867 1 39.3 1  6.5 10.5 19.8 22.6 21.4    .020393069624002082 0 1 .                 .  61   . 0                    .
              "nevada"        2009 0   .024596 11.483115 1 46.5 1  7.2   11 21.5 27.6 22.8   .0006034140114764289 0 1 .                 .  21   . 0                    .
              "orange"        2009 0  1.693514  14.90637 1 35.3 1  6.2 12.2   23 20.9   19     .05144083127046602 0 1 .                 .  92   . 0                    .
              "placer"        2009 0   .619071 12.713068 1 39.8 1  5.6 10.6 22.8 26.9 21.4     .04640311414244417 0 1 .                 .  88   . 0                    .
              "plumas"        2009 0    .00473  9.930616 1 48.7 1  9.1  6.5 14.3 31.4 28.3   4.78687998463466e-07 0 1 .                 .   2   . 0                    .
              "riverside"     2009 1  4.794819 14.526647 1 33.1 1  9.2  7.1 13.3 24.5 26.5     .08125239502194635 1 1 1 4.546688079833984 222 112 1 .0022908747256457362
              "sacramento"    2009 0    .21736 14.134404 1 34.4 1  8.8  8.8   19 25.3 22.8    .023329664020411634 0 1 .                 .  66   . 0                    .
              "sanbernardino" 2009 0  7.012949 14.501953 1 30.7 1  9.5  6.2   12 23.8 27.1      .1279859466903562 0 1 .                 . 126   . 0                    .
              "sandiego"      2009 0 17.532698 14.909962 1 34.5 1  6.7 12.7 21.3   23 20.2     .36248869108616655 0 1 .                 . 167   . 0                    .
              "sanfrancisco"  2009 0   .336379  13.58895 1 38.2 1  6.6 19.4 31.7 14.5 14.6    .042865372832227355 0 1 .                 .  85   . 0                    .
              "sanjoaquin"    2009 0    .99221 13.407002 1   32 1 10.8    5 12.1 23.4 27.2     .04524175641893645 0 1 .                 .  87   . 0                    .
              "sanluisobispo" 2009 0  1.678141 12.476668 1 38.8 1  6.7 10.9 19.1 25.3 22.3     .08490016251641339 0 1 .                 . 113   . 0                    .
              "sanmateo"      2009 0  1.716875 13.461526 1 38.8 1  6.1 16.7 26.9   19 18.2    .034481011026707656 0 1 .                 .  75   . 0                    .
              "santabarbara"  2009 0  .4965744  12.90427 1 33.7 1  6.4 12.6 18.6 22.1 19.1     .03761570654096888 0 1 .                 .  80   . 0                    .
              "santaclara"    2009 0  4.546688 14.363273 1 35.5 1    7 18.7 25.2 17.2 17.1     .07896152029630062 0 1 1                 . 112   . 0                    .
              "santacruz"     2009 0   .246138 12.434793 1 36.7 1  7.5 14.7   24 21.9 16.6    .013414403862695375 0 1 .                 .  52   . 0                    .
              "shasta"        2009 0   .037001   12.0973 1 40.8 1 10.5  6.4 13.1 30.2 27.6    .000525819371599372 0 1 .                 .  20   . 0                    .
              "solano"        2009 0  3.250113 12.915243 1 35.9 1  7.9    7 16.9 26.5 24.5    .010346486324972698 0 1 .                 .  45   . 0                    .
              "sonoma"        2009 0  2.713032  13.04811 1 39.3 1  6.6 10.9 20.1 24.8 21.5     .05225242845132609 0 1 .                 .  94   . 0                    .
              "stanislaus"    2009 0   .417333  13.13264 1 32.2 0 11.1    5 11.1 23.9 28.2     .17260372320723155 0 1 .                 . 139   . 0                    .
              "sutter"        2009 0   .082268 11.415654 1 34.2 1 11.2  5.6 12.9 24.8 25.3 2.2863400956189747e-06 0 1 .                 .   5   . 0                    .
              "tehama"        2009 0    .03024 11.012067 1 39.3 0  9.8    4  8.9 29.1 30.3 1.3411710143675346e-06 0 1 .                 .   3   . 0                    .
              "tulare"        2009 0  6.924015  12.93916 1 29.3 1 10.4  4.1  8.8 21.7 25.1     .01019322996805464 0 1 .                 .  44   . 0                    .
              "tuolumne"      2009 0    .00729  10.92883 1 45.9 1  8.9  6.1 11.6 29.2 29.4  .00005006025218890656 0 1 .                 .  11   . 0                    .
              "ventura"       2009 0  2.416562 13.582712 1 36.1 1  6.2 11.1 19.2 23.5 20.3    .010564143175592173 0 1 .                 .  48   . 0                    .
              "yolo"          2009 0  2.378922  12.17031 1 29.1 1  8.2 17.2 19.6 18.8 21.1      .0417702523562325 0 1 .                 .  83   . 0                    .
              "yuba"          2009 0   .006356  11.16911 1 30.8 0 12.1  3.6  9.3 27.8 27.1  6.355860672463473e-06 0 1 .                 .   6   . 0                    .
              "alameda"       2010 1 10.110526 14.206187 4 36.2 1  8.5 16.3   24 18.4 20.3      .7763258862707272 1 1 1 7.138447284698486 299 212 1  .002899764643883862
              "amador"        2010 0   .039496  10.55391 4 47.2 1 11.4  5.8 13.2 28.5 30.5    .015441136017234078 0 1 .                 .  57   . 0                    .
              "butte"         2010 0  4.762092  12.29516 3 37.2 1 11.5  8.1 16.1 28.8 23.7     .19278913301035214 0 1 .                 . 141   . 0                    .
              "calaveras"     2010 0   .026645 10.736266 4 48.5 1  7.6  6.6 13.1   31 30.2    .003399665327882444 0 1 .                 .  31   . 0                    .
              "colusa"        2010 0  2.214139  9.960104 3   34 1 14.2  2.9  8.8 23.1 27.4    .010524132480071082 0 1 .                 .  47   . 0                    .
              "contracosta"   2010 0  6.223766 13.840016 4 38.1 1  8.2 13.7 24.5 22.3 19.7      .5061933776961568 0 1 1                 . 187   . 0                    .
              "eldorado"      2010 0   .065586 12.095437 4 42.6 0  8.2 10.1 20.9 28.3 23.3     .19890425236567777 0 1 .                 . 142   . 0                    .
              "fresno"        2010 0  3.069286 13.719913 3 30.4 1 11.4  6.3 13.4 22.6 23.2     .21932412591348152 0 1 2                 . 150   . 0                    .
              "glenn"         2010 0   .065024 10.237636 3 35.1 1  8.3  4.3 11.8 27.2 24.2    .005202208269297772 0 1 .                 .  36   . 0                    .
              "humboldt"      2010 0   .031196  11.79854 3 37.1 1  8.6  8.6 17.7 29.3   26     .10912939465486207 0 1 .                 . 121   . 0                    .
              "inyo"          2010 0      .006  9.821952 3   45 1  6.8  7.5 13.4 29.2 30.5   .0016123225392308635 0 1 .                 .  27   . 0                    .
              "kern"          2010 0 12.340534 13.611794 3 30.6 1 11.4  4.8  9.8 22.7 26.8     .34465224956730856 0 1 .                 . 165   . 0                    .
              "kings"         2010 0  1.155362 11.925842 3 30.8 1   12  3.3  8.5 22.3 28.1     .06439053614508496 0 1 .                 . 102   . 0                    .
              "lake"          2010 0   .053505 11.072418 3 44.1 1 11.8  4.7 11.7 28.9 32.9    .000999960569028737 0 1 .                 .  25   . 0                    .
              "lassen"        2010 0   .032175 10.465415 4 37.2 1  9.2  3.9  8.5 29.5 26.7    .005762090997736122 0 1 .                 .  38   . 0                    .
              "losangeles"    2010 0 14.877266 16.093624 4 34.3 1  8.7  9.9   19 18.8 21.3      .9250380990701319 0 1 6                 . 219   . 0                    .
              "madera"        2010 0  3.250327 11.903195 3 33.2 1   12  4.3  9.3 22.3 25.5     .07812582371329241 0 1 .                 . 111   . 0                    .
              "marin"         2010 0   .658034 12.423604 4   44 1  5.6 22.7 31.5 18.5 12.8      .3871594185799518 0 1 1                 . 175   . 0                    .
              "mariposa"      2010 0    .08573   9.81411 3 47.9 0 12.9  6.4 13.9 28.4 32.7   .0003676848468410064 0 1 .                 .  18   . 0                    .
              "mendocino"     2010 0   .527713 11.379246 3 41.2 1    9  8.7 13.9 24.9 25.2     .01811910164639992 0 1 .                 .  60   . 0                    .
              "merced"        2010 0  5.625992  12.43201 3 29.3 1 13.8  4.1  8.4 22.1 25.7       .131712687137657 0 1 .                 . 128   . 0                    .
              "mono"          2010 0   .002115  9.540004 4 36.5 1  6.5 11.3 18.6 23.1 24.4    .026355826133959245 0 1 .                 .  69   . 0                    .
              "monterey"      2010 0  2.745784 12.917637 4 32.8 1 10.2  9.2 14.2 19.6 20.6     .13666225296593706 0 1 .                 . 130   . 0                    .
              "napa"          2010 0  1.975457 11.805976 4 39.4 1  7.4 10.2 19.8   23 20.5     .07805285620409724 0 1 .                 . 110   . 0                    .
              "nevada"        2010 0   .072011  11.49462 4 46.8 1  8.1 10.7 21.2 28.8 22.8    .015377780571893375 0 1 .                 .  56   . 0                    .
              "orange"        2010 0  7.138447 14.902565 4 35.7 1  7.4 12.4 23.5 20.9 18.6      .7734261216268433 0 1 8                 . 212   . 0                    .
              "placer"        2010 1   2.12185 12.726285 4 39.8 1  6.9 10.9 23.2 27.4 20.9     .31241325066064196 1 1 1 3.094980239868164 233 158 1  .005917958706612825
              "plumas"        2010 0    .00336  9.922898 3 48.5 1  9.9  7.3 12.6   33 30.2   .0006307495018411759 0 1 .                 .  23   . 0                    .
              "riverside"     2010 1  3.638173 14.561944 4 33.4 1 11.2  7.2 13.3 24.9 26.2      .6132914690204747 1 1 1 6.980919361114502 269 200 1  .006391297443595678
              "sacramento"    2010 0   .170243 14.148508 4 34.6 1 10.2  8.9   19 25.6 22.4     .06421062608481615 0 1 .                 . 101   . 0                    .
              "sanbenito"     2010 0   .318014  10.90581 4 33.7 1 10.3  5.1 13.2 23.8 23.5     .06504996584391357 0 1 .                 . 104   . 0                    .
              "sanbernardino" 2010 1 11.731922 14.511298 4 31.2 1 11.1  6.3 12.1 24.1 26.8      .6971316480116709 1 1 1 1.328508973121643 276 209 1  .022361710766639842
              "sandiego"      2010 0 23.868277 14.921584 4 34.5 1  7.8 12.7 21.3 23.1 19.8      .9241261580155842 0 1 8                 . 218   . 0                    .
              "sanfrancisco"  2010 0   .806118  13.57874 4 38.3 1  7.1 19.7 31.5 14.5 14.4      .4888044339447812 0 1 1                 . 184   . 0                    .
              "sanjoaquin"    2010 0   4.22111  13.42041 4 32.3 1 12.3  5.3 12.2 23.7 27.2      .5187076984478064 0 1 3                 . 188   . 0                    .
              "sanluisobispo" 2010 0  1.687685  12.48966 4   39 1  7.4 11.4 19.2 25.6   22      .5485032825904009 0 1 1                 . 195   . 0                    .
              "sanmateo"      2010 0   2.82236 13.464998 4   39 1  6.5   17   27   19 17.8      .5853500875968157 0 1 1                 . 198   . 0                    .
              "santabarbara"  2010 0 1.7767404 12.938563 4 33.6 1  7.5 12.4 18.6 22.3 18.5     .36356368432961067 0 1 .                 . 168   . 0                    .
              "santaclara"    2010 1 27.440374 14.369048 4 35.8 1  7.8 19.6 25.7 17.2 16.5      .7609407572388087 1 1 1 7.138447284698486 293 212 1  .012485364388034603
              "santacruz"     2010 0   .110632 12.456446 4 36.6 1  8.3 13.9 23.3   22 16.8      .0694164022686689 0 1 .                 . 105   . 0                    .
              "shasta"        2010 0  1.250782 12.083374 3 41.3 0 11.7  6.4 13.6 30.9 26.8       .206439053014432 0 1 .                 . 147   . 0                    .
              "solano"        2010 1  2.138662 12.924015 4 36.5 1  9.3  7.3 16.7 26.7 24.5      .3537431536408832 1 1 1 7.879004955291748 236 166 1 .0003145855734796865
              "sonoma"        2010 1  9.453146  13.06906 4 39.5 1  7.9 11.1 20.4 25.2   21      .6187456456884606 1 1 1  6.02202033996582 270 201 1  .011046601054420346
              "stanislaus"    2010 0  4.739463 13.141542 4 32.5 1 12.5  5.1 11.1 24.4 27.7       .339091833781088 0 1 1                 . 164   . 0                    .
              "sutter"        2010 0   .704816  11.44486 4 34.2 1 13.4  5.6 13.2 24.6 24.8     .10739918618549874 0 1 .                 . 120   . 0                    .
              "tehama"        2010 0  1.408998  11.04412 3 39.2 1 11.3  3.8  8.7 29.9 30.5     .03482468210395483 0 1 .                 .  76   . 0                    .
              "tulare"        2010 0    4.2453 12.970154 3 29.4 1 12.1  4.2  8.8 22.1 24.5      .1253497159449067 0 1 .                 . 125   . 0                    .
              "tuolumne"      2010 0   .007474 10.934427 3 46.6 1 10.6  6.2 11.2 30.6 29.3   .0013074525311697243 0 1 .                 .  26   . 0                    .
              "ventura"       2010 0 1.6534926 13.603653 4   36 1  7.2 11.2 19.6 23.6 19.8     .37273789496250564 0 1 .                 . 172   . 0                    .
              "yolo"          2010 0  7.195738    12.188 4 30.1 1  8.9 17.4 20.4   19 20.1      .7871216592452046 0 1 5                 . 213   . 0                    .
              "yuba"          2010 0   .125945 11.172687 3 31.5 0 14.6  3.1  9.4 27.5 26.9   .0024559835245293623 0 1 .                 .  28   . 0                    .
              "alameda"       2011 1  5.567919 14.217554 4 36.4 1  9.2 16.6 24.2 18.6 19.9      .7930681291845649 1 1 1 7.195737838745117 305 213 1 .0059464699393603215
              "amador"        2011 0   .155961 10.551742 4   48 0 15.2  5.7 13.1   29 29.4   .0033755265996007326 0 1 .                 .  30   . 0                    .
              end
              label values _treated _treated
              label def _treated 0 "Untreated", modify
              label def _treated 1 "Treated", modify
              label values _support _support
              label def _support 1 "On support", modify
              the outcome is mw
              Treatment variable is the treatment
              the year is the date of obs
              list of control variables
              and the generated variables due to the usage of psmatch2.

              the code I used:
              Code:
              psmatch2 treatment  lnpop age income  democrats ghi lnwatt unemployment Graduates  Bachelors  no_degree  High_school rebates, out(mw)
              The results for PSM:

              Code:
              Probit regression                               Number of obs     =        374
                                                              LR chi2(12)       =     229.68
                                                              Prob > chi2       =     0.0000
              Log likelihood = -138.54367                     Pseudo R2         =     0.4532
              
              ------------------------------------------------------------------------------
                treatment |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
                     lnpop |   .1574885   .0985129     1.60   0.110    -.0355932    .3505703
                       age |   .5958338   .1310093     4.55   0.000     .3390603    .8526072
                    income |  -.0880895   .0359251    -2.45   0.014    -.1585015   -.0176775
                 democrats |   .0173143   .0143467     1.21   0.227    -.0108047    .0454332
                       ghi |  -.0032003   .0020417    -1.57   0.117     -.007202    .0008014
                    lnwatt |  -.4818446   .0788698    -6.11   0.000    -.6364266   -.3272625
              unemployment |  -.0526791   .0523388    -1.01   0.314    -.1552612     .049903
                 Graduates |   .0244692   .0563879     0.43   0.664    -.0860491    .1349875
                 Bachelors |    .086568   .0576767     1.50   0.133    -.0264762    .1996122
                 no_degree |   .0348537   .0414328     0.84   0.400    -.0463531    .1160605
               High_school |   .0894115   .0572846     1.56   0.119    -.0228643    .2016874
                   rebates |  -.4528752   .2252961    -2.01   0.044    -.8944475   -.0113029
                     _cons |  -5.581223   2.118568    -2.63   0.008     -9.73354   -1.428906
              ------------------------------------------------------------------------------
              ----------------------------------------------------------------------------------------
                      Variable     Sample |    Treated     Controls   Difference         S.E.   T-stat
              ----------------------------+-----------------------------------------------------------
                            mw  Unmatched | 9.31545747   2.08819656   7.22726091   .700441069    10.32
                                      ATT | 9.31545747   6.30603991   3.00941755   1.36336104     2.21
              ----------------------------+-----------------------------------------------------------
              Note: S.E. does not take into account that the propensity score is estimated.
              
                         | psmatch2:
               psmatch2: |   Common
               Treatment |  support
              assignment | On suppor |     Total
              -----------+-----------+----------
               Untreated |       220 |       220 
                 Treated |       154 |       154 
              -----------+-----------+----------
                   Total |       374 |       374

              The code that I used for the Difference-in-Differences:

              Code:
              xi: areg mw treatment i.year lnpop age income  democrats ghi lnwatt unemployment Graduates  Bachelors  no_degree  High_school rebates, absorb(county) vce(cluster county)
              My question is how to use the all these results and commands to get the DiD-PSM results. Is it right to use _treated, _id variables now?

              Best
              Ali

              Comment

              Working...
              X