Announcement

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

  • Control variables for difference-in-difference

    Hi all,

    I have been struggling to get help on this

    I have sales data during an intervention (the introduction of a carbon label) in a standard difference-in-differences way. That is, I have one variable for the treatment period (binary), one for the treatment group (binary) and one for the interaction of both (did). The data is indexed by product (i) and week (time). Thus the basic regression would look like Y = Btreat + Bpost + Bdid.

    However, I would like to see the effect of the label of the colour of the product (it can have 6 colour and I have one variable for the colour id and one dummy for each colour). I was thinking on adding it an interaction of each dummy with treat, post and did. Would that make sense? I am looking for the effect of the particular colour of the label.

    My second question is: what is the best and most effective way to control for the category of the product. Should I include dummies for each category, or include them interacting them with treat, post and did?

    I have been looking for the literature on this but have been unsuccessful. Either I find papers that had a simple treatment that can be translated to a binary variable (introduction of a label) or studies that did not use difference in difference.

    Find below an example of my data:


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int i byte(time treat) float timetreatment byte CarbonColourN double CarbonScoreN float(redscore darkredscore) double amountsold float(categoryid categoryid1 categoryid2 revenueperproduct)
    422 10 1 0 3       1737.836383 0 0                 35 0 0 0     17.15
    141 26 0 1 3       1564.235445 0 0  51.68010156814764 0 0 0  20.15524
    142 10 0 0 3       1702.223617 0 0                 50 0 0 0      49.5
    142 11 0 0 3       1702.223617 0 0              43.35 0 0 0   42.9165
    142 12 0 0 3       1702.223617 0 0            41.3559 0 0 0  40.94234
    142 13 0 0 3       1702.223617 0 0 46.029116699999996 0 0 0  45.56882
    142 14 0 0 3       1702.223617 0 0      56.0174350239 0 0 0  55.45726
    142 15 0 0 3       1702.223617 0 0   47.3347325951955 0 0 0  46.86139
    142 16 0 0 3       1702.223617 0 0   47.3347325951955 0 0 0  46.86139
    142 17 0 0 3       1702.223617 0 0  44.68398756986455 0 0 0  44.23715
    142 19 0 1 3       1702.223617 0 0                 50 0 0 0      49.5
    142 20 0 1 3       1702.223617 0 0 52.400000000000006 0 0 0    51.876
    142 21 0 1 3       1702.223617 0 0            43.5444 0 0 0  43.10896
    142 22 0 1 3       1702.223617 0 0          49.205172 0 0 0  48.71312
    142 23 0 1 3       1702.223617 0 0       52.452713352 0 0 0  51.92818
    142 24 0 1 3       1702.223617 0 0 50.039888537808004 0 0 0  49.53949
    142 25 0 1 3       1702.223617 0 0  66.20277253551998 0 0 0  65.54075
    142 26 0 1 3       1702.223617 0 0  47.66599622557439 0 0 0  47.18933
    144 10 0 0 3       1701.648323 0 0               14.5 0 0 0     7.105
    144 11 0 0 3       1701.648323 0 0            13.1805 0 0 0  6.458445
    144 12 0 0 3       1701.648323 0 0 10.544400000000001 0 0 0  5.166756
    144 13 0 0 3       1701.648323 0 0 13.180500000000002 0 0 0  6.458445
    144 14 0 0 3       1701.648323 0 0            36.9054 0 0 0 18.083647
    144 15 0 0 3       1701.648323 0 0         14.5038222 0 0 0  7.106873
    144 16 0 0 3       1701.648323 0 0      11.8641265596 0 0 0  5.813422
    144 17 0 0 3       1701.648323 0 0   30.3247074863376 0 0 0 14.859107
    144 19 0 1 3       1701.648323 0 0               14.5 0 0 0     7.105
    144 20 0 1 3       1701.648323 0 0               17.4 0 0 0     8.526
    144 21 0 1 3       1701.648323 0 0 29.005799999999997 0 0 0 14.212842
    144 22 0 1 3       1701.648323 0 0           21.75435 0 0 0 10.659632
    144 23 0 1 3       1701.648323 0 0        31.91363145 0 0 0  15.63768
    144 24 0 1 3       1701.648323 0 0      21.7650966489 0 0 0 10.664897
    144 25 0 1 3       1701.648323 0 0 30.471135308459996 0 0 0 14.930857
    539 10 1 0 5       3942.692129 1 0                 35 0 0 0     66.15
    539 11 1 0 5       3942.692129 1 0             46.655 0 0 0  88.17795
    539 12 1 0 5       3942.692129 1 0           36.67083 0 0 0  69.30787
    539 13 1 0 5       3942.692129 1 0 28.346551590000004 0 0 0  53.57498
    539 14 1 0 5       3942.692129 1 0     51.70411010016 0 0 0  97.72077
    539 15 1 0 5       3942.692129 1 0   36.7099181711136 0 0 0 69.381744
    539 16 1 0 5       3942.692129 1 0 35.057971853413484 0 0 0  66.25957
    539 17 1 0 5       3942.692129 1 0 28.396957201264925 0 0 0  53.67025
    539 19 1 1 5       3942.692129 1 0                 35 0 0 0     66.15
    539 20 1 1 5       3942.692129 1 0               45.5 0 0 0    85.995
    539 21 1 1 5       3942.692129 1 0            26.2535 0 0 0  49.61911
    539 22 1 1 5       3942.692129 1 0 33.263184499999994 0 0 0  62.86742
    539 23 1 1 5       3942.692129 1 0  45.50403639599999 0 0 0  86.00263
    539 24 1 1 5       3942.692129 1 0 29.759639802983994 0 0 0  56.24572
    539 25 1 1 5       3942.692129 1 0  40.26479265343734 0 0 0  76.10046
    539 26 1 1 5       3942.692129 1 0 31.527332647641437 0 0 0  59.58666
    144 26 0 1 3       1701.648323 0 0 21.756390610240437 0 0 0  10.66063
    145 10 0 0 5       3695.590017 1 0                4.5 0 0 0     8.955
    145 11 0 0 5       3695.590017 1 0               6.75 0 0 0   13.4325
    145 12 0 0 5       3695.590017 1 0               6.75 0 0 0   13.4325
    145 13 0 0 5       3695.590017 1 0             8.2485 0 0 0 16.414515
    145 14 0 0 5       3695.590017 1 0          8.9991135 0 0 0 17.908236
    145 15 0 0 5       3695.590017 1 0       9.7460399205 0 0 0  19.39462
    145 16 0 0 5       3695.590017 1 0 3.0017802955140005 0 0 0  5.973543
    145 17 0 0 5       3695.590017 1 0 3.7522253693925007 0 0 0  7.466928
    145 19 0 1 5       3695.590017 1 0               14.5 0 0 0    28.855
    145 20 0 1 5       3695.590017 1 0               14.5 0 0 0    28.855
    145 21 0 1 5       3695.590017 1 0               14.5 0 0 0    28.855
    145 22 0 1 5       3695.590017 1 0            21.0975 0 0 0  41.98402
    145 23 0 1 5       3695.590017 1 0           10.54875 0 0 0  20.99201
    145 24 0 1 5       3695.590017 1 0         13.1859375 0 0 0 26.240015
    145 25 0 1 5       3695.590017 1 0 22.416093749999998 0 0 0  44.60803
    145 26 0 1 5       3695.590017 1 0 17.148311718749998 0 0 0  34.12514
    146 10 0 0 5 4270.563581000001 1 0               14.5 0 0 0    27.405
    146 11 0 0 5 4270.563581000001 1 0            15.7035 0 0 0 29.679615
    146 12 0 0 5 4270.563581000001 1 0  8.448483000000001 0 0 0 15.967633
    146 13 0 0 5 4270.563581000001 1 0 13.272566793000001 0 0 0  25.08515
    146 14 0 0 5 4270.563581000001 1 0    24.129526429674 0 0 0   45.6048
    146 15 0 0 5 4270.563581000001 1 0 13.271239536320701 0 0 0 25.082644
    146 16 0 0 5 4270.563581000001 1 0 13.271239536320701 0 0 0 25.082644
    146 17 0 0 5 4270.563581000001 1 0  6.038413989025918 0 0 0 11.412602
    146 19 0 1 5 4270.563581000001 1 0                4.5 0 0 0     8.505
    146 20 0 1 5 4270.563581000001 1 0             14.625 0 0 0  27.64125
    146 21 0 1 5 4270.563581000001 1 0          11.246625 0 0 0  21.25612
    146 22 0 1 5 4270.563581000001 1 0  8.997300000000001 0 0 0 17.004896
    146 23 0 1 5 4270.563581000001 1 0 15.745275000000001 0 0 0  29.75857
    146 24 0 1 5 4270.563581000001 1 0 12.375786150000001 0 0 0 23.390236
    146 25 0 1 5 4270.563581000001 1 0 11.249589610350002 0 0 0 21.261724
    146 26 0 1 5 4270.563581000001 1 0 13.499507532420003 0 0 0  25.51407
    147 10 0 0 5       7292.542534 1 0               14.5 0 0 0    34.655
    147 11 0 0 5       7292.542534 1 0 10.033999999999999 0 0 0  23.98126
    147 12 0 0 5       7292.542534 1 0           5.578904 0 0 0  13.33358
    147 13 0 0 5       7292.542534 1 0  6.694684799999999 0 0 0 16.000298
    147 14 0 0 5       7292.542534 1 0      22.3133844384 0 0 0  53.32899
    147 15 0 0 5       7292.542534 1 0      11.1566922192 0 0 0 26.664494
    147 16 0 0 5       7292.542534 1 0     13.38803066304 0 0 0  31.99739
    147 17 0 0 5       7292.542534 1 0      6.69401533152 0 0 0 15.998696
    147 19 0 1 5       7292.542534 1 0               14.5 0 0 0    34.655
    147 20 0 1 5       7292.542534 1 0               7.25 0 0 0   17.3275
    147 21 0 1 5       7292.542534 1 0           12.08575 0 0 0 28.884943
    147 22 0 1 5       7292.542534 1 0            14.5029 0 0 0  34.66193
    147 23 0 1 5       7292.542534 1 0         19.3323657 0 0 0  46.20435
    147 24 0 1 5       7292.542534 1 0 6.0316980984000015 0 0 0 14.415758
    147 25 0 1 5       7292.542534 1 0 15.682415055840005 0 0 0 37.480972
    147 26 0 1 5       7292.542534 1 0 14.474869096540326 0 0 0 34.594936
    296 21 0 1 4       1894.408927 0 0         16.4931435 0 0 0 13.029583
    296 22 0 1 4       1894.408927 0 0  6.003504233999999 0 0 0 4.7427683
    end
    format %tw time

    Thanks in advance!
Working...
X